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 virtual ~PepperExternalFileRefBackend();
30 // PepperFileRefBackend overrides.
31 virtual int32_t MakeDirectory(ppapi::host::ReplyMessageContext context
,
32 int32_t make_directory_flags
) OVERRIDE
;
33 virtual int32_t Touch(ppapi::host::ReplyMessageContext context
,
34 PP_Time last_accessed_time
,
35 PP_Time last_modified_time
) OVERRIDE
;
36 virtual int32_t Delete(ppapi::host::ReplyMessageContext context
) OVERRIDE
;
37 virtual int32_t Rename(ppapi::host::ReplyMessageContext context
,
38 PepperFileRefHost
* new_file_ref
) OVERRIDE
;
39 virtual int32_t Query(ppapi::host::ReplyMessageContext context
) OVERRIDE
;
40 virtual int32_t ReadDirectoryEntries(ppapi::host::ReplyMessageContext context
)
42 virtual int32_t GetAbsolutePath(ppapi::host::ReplyMessageContext context
)
44 virtual storage::FileSystemURL
GetFileSystemURL() const OVERRIDE
;
45 virtual base::FilePath
GetExternalFilePath() const OVERRIDE
;
47 virtual int32_t CanRead() const OVERRIDE
;
48 virtual int32_t CanWrite() const OVERRIDE
;
49 virtual int32_t CanCreate() const OVERRIDE
;
50 virtual int32_t CanReadWrite() const OVERRIDE
;
53 // Generic reply callback.
54 void DidFinish(ppapi::host::ReplyMessageContext reply_context
,
55 const IPC::Message
& msg
,
56 base::File::Error error
);
58 // Operation specific callbacks.
59 void GetMetadataComplete(ppapi::host::ReplyMessageContext reply_context
,
60 base::File::Error error
,
61 const base::File::Info
& file_info
);
63 ppapi::host::PpapiHost
* host_
;
65 int render_process_id_
;
67 scoped_refptr
<base::TaskRunner
> task_runner_
;
69 base::WeakPtrFactory
<PepperExternalFileRefBackend
> weak_factory_
;
71 DISALLOW_COPY_AND_ASSIGN(PepperExternalFileRefBackend
);
74 } // namespace content
76 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_EXTERNAL_FILE_REF_BACKEND_H_