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