OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_RENDERER_PEPPER_PEPPER_FILE_IO_HOST_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_FILE_IO_HOST_H_ |
6 #define CONTENT_RENDERER_PEPPER_PEPPER_FILE_IO_HOST_H_ | 6 #define CONTENT_RENDERER_PEPPER_PEPPER_FILE_IO_HOST_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
13 #include "base/id_map.h" | 13 #include "base/id_map.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/platform_file.h" | 15 #include "base/platform_file.h" |
16 #include "content/public/renderer/renderer_ppapi_host.h" | 16 #include "content/public/renderer/renderer_ppapi_host.h" |
17 #include "ipc/ipc_listener.h" | 17 #include "ipc/ipc_listener.h" |
18 #include "ipc/ipc_platform_file.h" | 18 #include "ipc/ipc_platform_file.h" |
19 #include "ppapi/host/host_message_context.h" | 19 #include "ppapi/host/host_message_context.h" |
20 #include "ppapi/host/resource_host.h" | 20 #include "ppapi/host/resource_host.h" |
21 #include "ppapi/shared_impl/file_io_state_manager.h" | 21 #include "ppapi/shared_impl/file_io_state_manager.h" |
| 22 #include "ppapi/shared_impl/file_ref_detailed_info.h" |
22 #include "ppapi/thunk/ppb_file_ref_api.h" | 23 #include "ppapi/thunk/ppb_file_ref_api.h" |
23 #include "url/gurl.h" | 24 #include "url/gurl.h" |
24 #include "webkit/common/quota/quota_types.h" | 25 #include "webkit/common/quota/quota_types.h" |
25 | 26 |
26 using ppapi::host::ReplyMessageContext; | 27 using ppapi::host::ReplyMessageContext; |
27 | 28 |
28 namespace content { | 29 namespace content { |
| 30 class PepperPluginInstanceImpl; |
29 class QuotaFileIO; | 31 class QuotaFileIO; |
30 | 32 |
31 class PepperFileIOHost : public ppapi::host::ResourceHost, | 33 class PepperFileIOHost : public ppapi::host::ResourceHost, |
32 public base::SupportsWeakPtr<PepperFileIOHost>, | 34 public base::SupportsWeakPtr<PepperFileIOHost>, |
33 public IPC::Listener { | 35 public IPC::Listener { |
34 public: | 36 public: |
35 typedef base::Callback<void (base::PlatformFileError)> | 37 typedef base::Callback<void (base::PlatformFileError)> |
36 NotifyCloseFileCallback; | 38 NotifyCloseFileCallback; |
37 | 39 |
38 PepperFileIOHost(RendererPpapiHost* host, | 40 PepperFileIOHost(RendererPpapiHost* host, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 ppapi::host::HostMessageContext* context); | 78 ppapi::host::HostMessageContext* context); |
77 // Trusted API. | 79 // Trusted API. |
78 int32_t OnHostMsgGetOSFileDescriptor( | 80 int32_t OnHostMsgGetOSFileDescriptor( |
79 ppapi::host::HostMessageContext* context); | 81 ppapi::host::HostMessageContext* context); |
80 int32_t OnHostMsgWillWrite(ppapi::host::HostMessageContext* context, | 82 int32_t OnHostMsgWillWrite(ppapi::host::HostMessageContext* context, |
81 int64_t offset, | 83 int64_t offset, |
82 int32_t bytes_to_write); | 84 int32_t bytes_to_write); |
83 int32_t OnHostMsgWillSetLength(ppapi::host::HostMessageContext* context, | 85 int32_t OnHostMsgWillSetLength(ppapi::host::HostMessageContext* context, |
84 int64_t length); | 86 int64_t length); |
85 | 87 |
| 88 void DidGetFileRefInfo( |
| 89 ppapi::host::ReplyMessageContext reply_context, |
| 90 int flags, |
| 91 const std::vector<ppapi::FileRef_DetailedInfo>& infos); |
| 92 |
86 // Callback handlers. These mostly convert the PlatformFileError to the | 93 // Callback handlers. These mostly convert the PlatformFileError to the |
87 // PP_Error code and send back the reply. Note that the argument | 94 // PP_Error code and send back the reply. Note that the argument |
88 // ReplyMessageContext is copied so that we have a closure containing all | 95 // ReplyMessageContext is copied so that we have a closure containing all |
89 // necessary information to reply. | 96 // necessary information to reply. |
90 void ExecutePlatformGeneralCallback(ReplyMessageContext reply_context, | 97 void ExecutePlatformGeneralCallback(ReplyMessageContext reply_context, |
91 base::PlatformFileError error_code); | 98 base::PlatformFileError error_code); |
92 void ExecutePlatformOpenFileCallback(ReplyMessageContext reply_context, | 99 void ExecutePlatformOpenFileCallback(ReplyMessageContext reply_context, |
93 base::PlatformFileError error_code, | 100 base::PlatformFileError error_code, |
94 base::PassPlatformFile file); | 101 base::PassPlatformFile file); |
95 void ExecutePlatformOpenFileSystemURLCallback( | 102 void ExecutePlatformOpenFileSystemURLCallback( |
96 ReplyMessageContext reply_context, | 103 ReplyMessageContext reply_context, |
97 base::PlatformFileError error_code, | 104 base::PlatformFileError error_code, |
98 base::PassPlatformFile file, | 105 base::PassPlatformFile file, |
99 quota::QuotaLimitType quota_policy, | 106 quota::QuotaLimitType quota_policy, |
100 const NotifyCloseFileCallback& callback); | 107 const NotifyCloseFileCallback& callback); |
101 void ExecutePlatformQueryCallback(ReplyMessageContext reply_context, | 108 void ExecutePlatformQueryCallback(ReplyMessageContext reply_context, |
102 base::PlatformFileError error_code, | 109 base::PlatformFileError error_code, |
103 const base::PlatformFileInfo& file_info); | 110 const base::PlatformFileInfo& file_info); |
104 void ExecutePlatformReadCallback(ReplyMessageContext reply_context, | 111 void ExecutePlatformReadCallback(ReplyMessageContext reply_context, |
105 base::PlatformFileError error_code, | 112 base::PlatformFileError error_code, |
106 const char* data, int bytes_read); | 113 const char* data, int bytes_read); |
107 void ExecutePlatformWriteCallback(ReplyMessageContext reply_context, | 114 void ExecutePlatformWriteCallback(ReplyMessageContext reply_context, |
108 base::PlatformFileError error_code, | 115 base::PlatformFileError error_code, |
109 int bytes_written); | 116 int bytes_written); |
110 | 117 |
| 118 PepperPluginInstanceImpl* plugin_instance_; |
111 base::PlatformFile file_; | 119 base::PlatformFile file_; |
112 | 120 |
113 // The file system type specified in the Open() call. This will be | 121 // The file system type specified in the Open() call. This will be |
114 // PP_FILESYSTEMTYPE_INVALID before open was called. This value does not | 122 // PP_FILESYSTEMTYPE_INVALID before open was called. This value does not |
115 // indicate that the open command actually succeeded. | 123 // indicate that the open command actually succeeded. |
116 PP_FileSystemType file_system_type_; | 124 PP_FileSystemType file_system_type_; |
117 | 125 |
118 // Valid only for PP_FILESYSTEMTYPE_LOCAL{PERSISTENT,TEMPORARY}. | 126 // Valid only for PP_FILESYSTEMTYPE_LOCAL{PERSISTENT,TEMPORARY}. |
119 GURL file_system_url_; | 127 GURL file_system_url_; |
120 | 128 |
(...skipping 21 matching lines...) Expand all Loading... |
142 AsyncOpenFileCallback; | 150 AsyncOpenFileCallback; |
143 | 151 |
144 IDMap<AsyncOpenFileCallback> pending_async_open_files_; | 152 IDMap<AsyncOpenFileCallback> pending_async_open_files_; |
145 | 153 |
146 DISALLOW_COPY_AND_ASSIGN(PepperFileIOHost); | 154 DISALLOW_COPY_AND_ASSIGN(PepperFileIOHost); |
147 }; | 155 }; |
148 | 156 |
149 } // namespace content | 157 } // namespace content |
150 | 158 |
151 #endif // CONTENT_RENDERER_PEPPER_PEPPER_FILE_IO_HOST_H_ | 159 #endif // CONTENT_RENDERER_PEPPER_PEPPER_FILE_IO_HOST_H_ |
OLD | NEW |