1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_EXTERNAL_FILE_REF_BACKEND_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_EXTERNAL_FILE_REF_BACKEND_H_
10 #include "base/files/file.h"
11 #include "base/files/file_path.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/task_runner.h"
14 #include "content/browser/renderer_host/pepper/pepper_file_ref_host.h"
15 #include "ppapi/c/pp_instance.h"
16 #include "ppapi/c/pp_resource.h"
17 #include "ppapi/c/pp_time.h"
18 #include "ppapi/host/ppapi_host.h"
22 // Implementations of FileRef operations for external filesystems.
23 class PepperExternalFileRefBackend
: public PepperFileRefBackend
{
25 PepperExternalFileRefBackend(ppapi::host::PpapiHost
* host
,
26 int render_process_id
,
27 const base::FilePath
& path
);
28 ~PepperExternalFileRefBackend() override
;
30 // PepperFileRefBackend overrides.
31 int32_t MakeDirectory(ppapi::host::ReplyMessageContext context
,
32 int32_t make_directory_flags
) override
;
33 int32_t Touch(ppapi::host::ReplyMessageContext context
,
34 PP_Time last_accessed_time
,
35 PP_Time last_modified_time
) override
;
36 int32_t Delete(ppapi::host::ReplyMessageContext context
) override
;
37 int32_t Rename(ppapi::host::ReplyMessageContext context
,
38 PepperFileRefHost
* new_file_ref
) override
;
39 int32_t Query(ppapi::host::ReplyMessageContext context
) override
;
40 int32_t ReadDirectoryEntries(
41 ppapi::host::ReplyMessageContext context
) override
;
42 int32_t GetAbsolutePath(ppapi::host::ReplyMessageContext context
) override
;
43 storage::FileSystemURL
GetFileSystemURL() const override
;
44 base::FilePath
GetExternalFilePath() const override
;
46 int32_t CanRead() const override
;
47 int32_t CanWrite() const override
;
48 int32_t CanCreate() const override
;
49 int32_t CanReadWrite() const override
;
52 // Generic reply callback.
53 void DidFinish(ppapi::host::ReplyMessageContext reply_context
,
54 const IPC::Message
& msg
,
55 base::File::Error error
);
57 // Operation specific callbacks.
58 void GetMetadataComplete(ppapi::host::ReplyMessageContext reply_context
,
59 base::File::Error error
,
60 const base::File::Info
& file_info
);
62 ppapi::host::PpapiHost
* host_
;
64 int render_process_id_
;
66 scoped_refptr
<base::TaskRunner
> task_runner_
;
68 base::WeakPtrFactory
<PepperExternalFileRefBackend
> weak_factory_
;
70 DISALLOW_COPY_AND_ASSIGN(PepperExternalFileRefBackend
);
73 } // namespace content
75 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_EXTERNAL_FILE_REF_BACKEND_H_