| 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_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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
| 12 #include "base/files/file.h" | 12 #include "base/files/file.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/platform_file.h" | 14 #include "base/platform_file.h" |
| 15 #include "content/browser/renderer_host/pepper/browser_ppapi_host_impl.h" | 15 #include "content/browser/renderer_host/pepper/browser_ppapi_host_impl.h" |
| 16 #include "ipc/ipc_listener.h" | 16 #include "ipc/ipc_listener.h" |
| 17 #include "ipc/ipc_platform_file.h" | 17 #include "ipc/ipc_platform_file.h" |
| 18 #include "ppapi/c/pp_file_info.h" | 18 #include "ppapi/c/pp_file_info.h" |
| 19 #include "ppapi/c/pp_time.h" | 19 #include "ppapi/c/pp_time.h" |
| 20 #include "ppapi/host/host_message_context.h" | 20 #include "ppapi/host/host_message_context.h" |
| 21 #include "ppapi/host/resource_host.h" | 21 #include "ppapi/host/resource_host.h" |
| 22 #include "ppapi/shared_impl/file_io_state_manager.h" | 22 #include "ppapi/shared_impl/file_io_state_manager.h" |
| 23 #include "url/gurl.h" | 23 #include "url/gurl.h" |
| 24 #include "webkit/browser/fileapi/file_system_context.h" | 24 #include "webkit/browser/fileapi/file_system_context.h" |
| 25 | 25 |
| 26 namespace ppapi { |
| 27 struct FileGrowth; |
| 28 } |
| 29 |
| 26 namespace content { | 30 namespace content { |
| 27 class PepperFileSystemBrowserHost; | 31 class PepperFileSystemBrowserHost; |
| 28 | 32 |
| 29 class PepperFileIOHost : public ppapi::host::ResourceHost, | 33 class PepperFileIOHost : public ppapi::host::ResourceHost, |
| 30 public base::SupportsWeakPtr<PepperFileIOHost> { | 34 public base::SupportsWeakPtr<PepperFileIOHost> { |
| 31 public: | 35 public: |
| 32 typedef base::Callback<void (base::File::Error)> | 36 typedef base::Callback<void (base::File::Error)> |
| 33 NotifyCloseFileCallback; | 37 NotifyCloseFileCallback; |
| 34 | 38 |
| 35 PepperFileIOHost(BrowserPpapiHostImpl* host, | 39 PepperFileIOHost(BrowserPpapiHostImpl* host, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 51 private: | 55 private: |
| 52 int32_t OnHostMsgOpen(ppapi::host::HostMessageContext* context, | 56 int32_t OnHostMsgOpen(ppapi::host::HostMessageContext* context, |
| 53 PP_Resource file_ref_resource, | 57 PP_Resource file_ref_resource, |
| 54 int32_t open_flags); | 58 int32_t open_flags); |
| 55 int32_t OnHostMsgTouch(ppapi::host::HostMessageContext* context, | 59 int32_t OnHostMsgTouch(ppapi::host::HostMessageContext* context, |
| 56 PP_Time last_access_time, | 60 PP_Time last_access_time, |
| 57 PP_Time last_modified_time); | 61 PP_Time last_modified_time); |
| 58 int32_t OnHostMsgSetLength(ppapi::host::HostMessageContext* context, | 62 int32_t OnHostMsgSetLength(ppapi::host::HostMessageContext* context, |
| 59 int64_t length); | 63 int64_t length); |
| 60 int32_t OnHostMsgClose(ppapi::host::HostMessageContext* context, | 64 int32_t OnHostMsgClose(ppapi::host::HostMessageContext* context, |
| 61 int64_t max_written_offset); | 65 const ppapi::FileGrowth& file_growth); |
| 62 int32_t OnHostMsgFlush(ppapi::host::HostMessageContext* context); | 66 int32_t OnHostMsgFlush(ppapi::host::HostMessageContext* context); |
| 63 int32_t OnHostMsgRequestOSFileHandle( | 67 int32_t OnHostMsgRequestOSFileHandle( |
| 64 ppapi::host::HostMessageContext* context); | 68 ppapi::host::HostMessageContext* context); |
| 65 | 69 |
| 66 void GotPluginAllowedToCallRequestOSFileHandle( | 70 void GotPluginAllowedToCallRequestOSFileHandle( |
| 67 ppapi::host::ReplyMessageContext reply_context, | 71 ppapi::host::ReplyMessageContext reply_context, |
| 68 bool plugin_allowed); | 72 bool plugin_allowed); |
| 69 | 73 |
| 70 // Callback handlers. These mostly convert the File::Error to the | 74 // Callback handlers. These mostly convert the File::Error to the |
| 71 // PP_Error code and send back the reply. Note that the argument | 75 // PP_Error code and send back the reply. Note that the argument |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 scoped_refptr<base::MessageLoopProxy> file_message_loop_; | 141 scoped_refptr<base::MessageLoopProxy> file_message_loop_; |
| 138 | 142 |
| 139 base::WeakPtrFactory<PepperFileIOHost> weak_factory_; | 143 base::WeakPtrFactory<PepperFileIOHost> weak_factory_; |
| 140 | 144 |
| 141 DISALLOW_COPY_AND_ASSIGN(PepperFileIOHost); | 145 DISALLOW_COPY_AND_ASSIGN(PepperFileIOHost); |
| 142 }; | 146 }; |
| 143 | 147 |
| 144 } // namespace content | 148 } // namespace content |
| 145 | 149 |
| 146 #endif // CONTENT_RENDERER_PEPPER_PEPPER_FILE_IO_HOST_H_ | 150 #endif // CONTENT_RENDERER_PEPPER_PEPPER_FILE_IO_HOST_H_ |
| OLD | NEW |