| 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/files/file_proxy.h" |
| 13 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 14 #include "base/platform_file.h" | 15 #include "base/platform_file.h" |
| 15 #include "content/browser/renderer_host/pepper/browser_ppapi_host_impl.h" | 16 #include "content/browser/renderer_host/pepper/browser_ppapi_host_impl.h" |
| 16 #include "ipc/ipc_listener.h" | 17 #include "ipc/ipc_listener.h" |
| 17 #include "ipc/ipc_platform_file.h" | 18 #include "ipc/ipc_platform_file.h" |
| 18 #include "ppapi/c/pp_file_info.h" | 19 #include "ppapi/c/pp_file_info.h" |
| 19 #include "ppapi/c/pp_time.h" | 20 #include "ppapi/c/pp_time.h" |
| 20 #include "ppapi/host/host_message_context.h" | 21 #include "ppapi/host/host_message_context.h" |
| 21 #include "ppapi/host/resource_host.h" | 22 #include "ppapi/host/resource_host.h" |
| 22 #include "ppapi/shared_impl/file_io_state_manager.h" | 23 #include "ppapi/shared_impl/file_io_state_manager.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 // necessary information to reply. | 78 // necessary information to reply. |
| 78 void ExecutePlatformGeneralCallback( | 79 void ExecutePlatformGeneralCallback( |
| 79 ppapi::host::ReplyMessageContext reply_context, | 80 ppapi::host::ReplyMessageContext reply_context, |
| 80 base::File::Error error_code); | 81 base::File::Error error_code); |
| 81 void ExecutePlatformOpenFileCallback( | 82 void ExecutePlatformOpenFileCallback( |
| 82 ppapi::host::ReplyMessageContext reply_context, | 83 ppapi::host::ReplyMessageContext reply_context, |
| 83 base::File::Error error_code, | 84 base::File::Error error_code, |
| 84 base::PassPlatformFile file, | 85 base::PassPlatformFile file, |
| 85 bool unused_created); | 86 bool unused_created); |
| 86 | 87 |
| 88 void OnOpenProxyCallback(ppapi::host::ReplyMessageContext reply_context, |
| 89 base::File::Error error_code); |
| 90 |
| 87 void GotUIThreadStuffForInternalFileSystems( | 91 void GotUIThreadStuffForInternalFileSystems( |
| 88 ppapi::host::ReplyMessageContext reply_context, | 92 ppapi::host::ReplyMessageContext reply_context, |
| 89 int platform_file_flags, | 93 int platform_file_flags, |
| 90 UIThreadStuff ui_thread_stuff); | 94 UIThreadStuff ui_thread_stuff); |
| 91 void DidOpenInternalFile(ppapi::host::ReplyMessageContext reply_context, | 95 void DidOpenInternalFile(ppapi::host::ReplyMessageContext reply_context, |
| 92 base::File::Error result, | 96 base::File::Error result, |
| 93 base::PlatformFile file, | 97 base::PlatformFile file, |
| 94 const base::Closure& on_close_callback); | 98 const base::Closure& on_close_callback); |
| 95 void GotResolvedRenderProcessId( | 99 void GotResolvedRenderProcessId( |
| 96 ppapi::host::ReplyMessageContext reply_context, | 100 ppapi::host::ReplyMessageContext reply_context, |
| 97 base::FilePath path, | 101 base::FilePath path, |
| 98 int platform_file_flags, | 102 int file_flags, |
| 99 base::ProcessId resolved_render_process_id); | 103 base::ProcessId resolved_render_process_id); |
| 100 | 104 |
| 101 void DidOpenQuotaFile(ppapi::host::ReplyMessageContext reply_context, | 105 void DidOpenQuotaFile(ppapi::host::ReplyMessageContext reply_context, |
| 102 base::PlatformFile file, | 106 base::PlatformFile file, |
| 103 int64_t max_written_offset); | 107 int64_t max_written_offset); |
| 104 bool CallSetLength(ppapi::host::ReplyMessageContext reply_context, | 108 bool CallSetLength(ppapi::host::ReplyMessageContext reply_context, |
| 105 int64_t length); | 109 int64_t length); |
| 106 | 110 |
| 107 void DidCloseFile(base::File::Error error); | 111 void DidCloseFile(base::File::Error error); |
| 108 | 112 |
| 109 void SendOpenErrorReply(ppapi::host::ReplyMessageContext reply_context); | 113 void SendOpenErrorReply(ppapi::host::ReplyMessageContext reply_context); |
| 110 | 114 |
| 111 // Adds file_ to |reply_context| with the specified |open_flags|. | 115 // Adds file_ to |reply_context| with the specified |open_flags|. |
| 112 bool AddFileToReplyContext( | 116 bool AddFileToReplyContext( |
| 113 int32_t open_flags, | 117 int32_t open_flags, |
| 114 ppapi::host::ReplyMessageContext* reply_context) const; | 118 ppapi::host::ReplyMessageContext* reply_context) const; |
| 115 | 119 |
| 116 BrowserPpapiHostImpl* browser_ppapi_host_; | 120 BrowserPpapiHostImpl* browser_ppapi_host_; |
| 117 | 121 |
| 118 RenderProcessHost* render_process_host_; | 122 RenderProcessHost* render_process_host_; |
| 119 int render_process_id_; | 123 int render_process_id_; |
| 120 base::ProcessId resolved_render_process_id_; | 124 base::ProcessId resolved_render_process_id_; |
| 121 | 125 |
| 122 base::PlatformFile file_; | 126 base::FileProxy file_; |
| 123 int32_t open_flags_; | 127 int32_t open_flags_; |
| 124 | 128 |
| 125 // The file system type specified in the Open() call. This will be | 129 // The file system type specified in the Open() call. This will be |
| 126 // PP_FILESYSTEMTYPE_INVALID before open was called. This value does not | 130 // PP_FILESYSTEMTYPE_INVALID before open was called. This value does not |
| 127 // indicate that the open command actually succeeded. | 131 // indicate that the open command actually succeeded. |
| 128 PP_FileSystemType file_system_type_; | 132 PP_FileSystemType file_system_type_; |
| 129 base::WeakPtr<PepperFileSystemBrowserHost> file_system_host_; | 133 base::WeakPtr<PepperFileSystemBrowserHost> file_system_host_; |
| 130 | 134 |
| 131 // Valid only for PP_FILESYSTEMTYPE_LOCAL{PERSISTENT,TEMPORARY}. | 135 // Valid only for PP_FILESYSTEMTYPE_LOCAL{PERSISTENT,TEMPORARY}. |
| 132 scoped_refptr<fileapi::FileSystemContext> file_system_context_; | 136 scoped_refptr<fileapi::FileSystemContext> file_system_context_; |
| 133 fileapi::FileSystemURL file_system_url_; | 137 fileapi::FileSystemURL file_system_url_; |
| 134 base::Closure on_close_callback_; | 138 base::Closure on_close_callback_; |
| 135 int64_t max_written_offset_; | 139 int64_t max_written_offset_; |
| 136 bool check_quota_; | 140 bool check_quota_; |
| 137 | 141 |
| 138 ppapi::FileIOStateManager state_manager_; | 142 ppapi::FileIOStateManager state_manager_; |
| 139 | 143 |
| 140 scoped_refptr<base::MessageLoopProxy> file_message_loop_; | |
| 141 | |
| 142 base::WeakPtrFactory<PepperFileIOHost> weak_factory_; | 144 base::WeakPtrFactory<PepperFileIOHost> weak_factory_; |
| 143 | 145 |
| 144 DISALLOW_COPY_AND_ASSIGN(PepperFileIOHost); | 146 DISALLOW_COPY_AND_ASSIGN(PepperFileIOHost); |
| 145 }; | 147 }; |
| 146 | 148 |
| 147 } // namespace content | 149 } // namespace content |
| 148 | 150 |
| 149 #endif // CONTENT_RENDERER_PEPPER_PEPPER_FILE_IO_HOST_H_ | 151 #endif // CONTENT_RENDERER_PEPPER_PEPPER_FILE_IO_HOST_H_ |
| OLD | NEW |