| 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/thunk/ppb_file_ref_api.h" | 22 #include "ppapi/thunk/ppb_file_ref_api.h" |
| 23 #include "url/gurl.h" | 23 #include "url/gurl.h" |
| 24 #include "webkit/common/quota/quota_types.h" | 24 #include "webkit/common/quota/quota_types.h" |
| 25 | 25 |
| 26 using ppapi::host::ReplyMessageContext; | 26 using ppapi::host::ReplyMessageContext; |
| 27 | 27 |
| 28 namespace content { | 28 namespace content { |
| 29 class PepperPluginInstanceImpl; |
| 29 class QuotaFileIO; | 30 class QuotaFileIO; |
| 30 | 31 |
| 31 class PepperFileIOHost : public ppapi::host::ResourceHost, | 32 class PepperFileIOHost : public ppapi::host::ResourceHost, |
| 32 public base::SupportsWeakPtr<PepperFileIOHost>, | 33 public base::SupportsWeakPtr<PepperFileIOHost>, |
| 33 public IPC::Listener { | 34 public IPC::Listener { |
| 34 public: | 35 public: |
| 35 typedef base::Callback<void (base::PlatformFileError)> | 36 typedef base::Callback<void (base::PlatformFileError)> |
| 36 NotifyCloseFileCallback; | 37 NotifyCloseFileCallback; |
| 37 | 38 |
| 38 PepperFileIOHost(RendererPpapiHost* host, | 39 PepperFileIOHost(RendererPpapiHost* host, |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 base::PlatformFileError error_code, | 99 base::PlatformFileError error_code, |
| 99 const base::PlatformFileInfo& file_info); | 100 const base::PlatformFileInfo& file_info); |
| 100 void ExecutePlatformReadCallback(ReplyMessageContext reply_context, | 101 void ExecutePlatformReadCallback(ReplyMessageContext reply_context, |
| 101 base::PlatformFileError error_code, | 102 base::PlatformFileError error_code, |
| 102 const char* data, int bytes_read); | 103 const char* data, int bytes_read); |
| 103 void ExecutePlatformWriteCallback(ReplyMessageContext reply_context, | 104 void ExecutePlatformWriteCallback(ReplyMessageContext reply_context, |
| 104 base::PlatformFileError error_code, | 105 base::PlatformFileError error_code, |
| 105 int bytes_written); | 106 int bytes_written); |
| 106 | 107 |
| 107 RendererPpapiHost* renderer_ppapi_host_; | 108 RendererPpapiHost* renderer_ppapi_host_; |
| 108 | 109 PepperPluginInstanceImpl* plugin_instance_; |
| 109 base::PlatformFile file_; | 110 base::PlatformFile file_; |
| 110 | 111 |
| 111 // The file system type specified in the Open() call. This will be | 112 // The file system type specified in the Open() call. This will be |
| 112 // PP_FILESYSTEMTYPE_INVALID before open was called. This value does not | 113 // PP_FILESYSTEMTYPE_INVALID before open was called. This value does not |
| 113 // indicate that the open command actually succeeded. | 114 // indicate that the open command actually succeeded. |
| 114 PP_FileSystemType file_system_type_; | 115 PP_FileSystemType file_system_type_; |
| 115 | 116 |
| 116 // Valid only for PP_FILESYSTEMTYPE_LOCAL{PERSISTENT,TEMPORARY}. | 117 // Valid only for PP_FILESYSTEMTYPE_LOCAL{PERSISTENT,TEMPORARY}. |
| 117 GURL file_system_url_; | 118 GURL file_system_url_; |
| 118 | 119 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 140 IDMap<AsyncOpenFileCallback> pending_async_open_files_; | 141 IDMap<AsyncOpenFileCallback> pending_async_open_files_; |
| 141 | 142 |
| 142 base::WeakPtrFactory<PepperFileIOHost> weak_factory_; | 143 base::WeakPtrFactory<PepperFileIOHost> weak_factory_; |
| 143 | 144 |
| 144 DISALLOW_COPY_AND_ASSIGN(PepperFileIOHost); | 145 DISALLOW_COPY_AND_ASSIGN(PepperFileIOHost); |
| 145 }; | 146 }; |
| 146 | 147 |
| 147 } // namespace content | 148 } // namespace content |
| 148 | 149 |
| 149 #endif // CONTENT_RENDERER_PEPPER_PEPPER_FILE_IO_HOST_H_ | 150 #endif // CONTENT_RENDERER_PEPPER_PEPPER_FILE_IO_HOST_H_ |
| OLD | NEW |