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/files/file_proxy.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.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 "storage/browser/fileapi/file_system_context.h" |
25 | 25 |
26 namespace ppapi { | 26 namespace ppapi { |
27 struct FileGrowth; | 27 struct FileGrowth; |
28 } | 28 } |
29 | 29 |
30 namespace content { | 30 namespace content { |
31 class PepperFileSystemBrowserHost; | 31 class PepperFileSystemBrowserHost; |
32 | 32 |
33 class PepperFileIOHost : public ppapi::host::ResourceHost, | 33 class PepperFileIOHost : public ppapi::host::ResourceHost, |
34 public base::SupportsWeakPtr<PepperFileIOHost> { | 34 public base::SupportsWeakPtr<PepperFileIOHost> { |
35 public: | 35 public: |
36 typedef base::Callback<void(base::File::Error)> NotifyCloseFileCallback; | 36 typedef base::Callback<void(base::File::Error)> NotifyCloseFileCallback; |
37 | 37 |
38 PepperFileIOHost(BrowserPpapiHostImpl* host, | 38 PepperFileIOHost(BrowserPpapiHostImpl* host, |
39 PP_Instance instance, | 39 PP_Instance instance, |
40 PP_Resource resource); | 40 PP_Resource resource); |
41 virtual ~PepperFileIOHost(); | 41 virtual ~PepperFileIOHost(); |
42 | 42 |
43 // ppapi::host::ResourceHost override. | 43 // ppapi::host::ResourceHost override. |
44 virtual int32_t OnResourceMessageReceived( | 44 virtual int32_t OnResourceMessageReceived( |
45 const IPC::Message& msg, | 45 const IPC::Message& msg, |
46 ppapi::host::HostMessageContext* context) OVERRIDE; | 46 ppapi::host::HostMessageContext* context) OVERRIDE; |
47 | 47 |
48 struct UIThreadStuff { | 48 struct UIThreadStuff { |
49 UIThreadStuff(); | 49 UIThreadStuff(); |
50 ~UIThreadStuff(); | 50 ~UIThreadStuff(); |
51 base::ProcessId resolved_render_process_id; | 51 base::ProcessId resolved_render_process_id; |
52 scoped_refptr<fileapi::FileSystemContext> file_system_context; | 52 scoped_refptr<storage::FileSystemContext> file_system_context; |
53 }; | 53 }; |
54 | 54 |
55 private: | 55 private: |
56 int32_t OnHostMsgOpen(ppapi::host::HostMessageContext* context, | 56 int32_t OnHostMsgOpen(ppapi::host::HostMessageContext* context, |
57 PP_Resource file_ref_resource, | 57 PP_Resource file_ref_resource, |
58 int32_t open_flags); | 58 int32_t open_flags); |
59 int32_t OnHostMsgTouch(ppapi::host::HostMessageContext* context, | 59 int32_t OnHostMsgTouch(ppapi::host::HostMessageContext* context, |
60 PP_Time last_access_time, | 60 PP_Time last_access_time, |
61 PP_Time last_modified_time); | 61 PP_Time last_modified_time); |
62 int32_t OnHostMsgSetLength(ppapi::host::HostMessageContext* context, | 62 int32_t OnHostMsgSetLength(ppapi::host::HostMessageContext* context, |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 base::FileProxy file_; | 119 base::FileProxy file_; |
120 int32_t open_flags_; | 120 int32_t open_flags_; |
121 | 121 |
122 // The file system type specified in the Open() call. This will be | 122 // The file system type specified in the Open() call. This will be |
123 // PP_FILESYSTEMTYPE_INVALID before open was called. This value does not | 123 // PP_FILESYSTEMTYPE_INVALID before open was called. This value does not |
124 // indicate that the open command actually succeeded. | 124 // indicate that the open command actually succeeded. |
125 PP_FileSystemType file_system_type_; | 125 PP_FileSystemType file_system_type_; |
126 base::WeakPtr<PepperFileSystemBrowserHost> file_system_host_; | 126 base::WeakPtr<PepperFileSystemBrowserHost> file_system_host_; |
127 | 127 |
128 // Valid only for PP_FILESYSTEMTYPE_LOCAL{PERSISTENT,TEMPORARY}. | 128 // Valid only for PP_FILESYSTEMTYPE_LOCAL{PERSISTENT,TEMPORARY}. |
129 scoped_refptr<fileapi::FileSystemContext> file_system_context_; | 129 scoped_refptr<storage::FileSystemContext> file_system_context_; |
130 fileapi::FileSystemURL file_system_url_; | 130 storage::FileSystemURL file_system_url_; |
131 base::Closure on_close_callback_; | 131 base::Closure on_close_callback_; |
132 int64_t max_written_offset_; | 132 int64_t max_written_offset_; |
133 bool check_quota_; | 133 bool check_quota_; |
134 | 134 |
135 ppapi::FileIOStateManager state_manager_; | 135 ppapi::FileIOStateManager state_manager_; |
136 | 136 |
137 DISALLOW_COPY_AND_ASSIGN(PepperFileIOHost); | 137 DISALLOW_COPY_AND_ASSIGN(PepperFileIOHost); |
138 }; | 138 }; |
139 | 139 |
140 } // namespace content | 140 } // namespace content |
141 | 141 |
142 #endif // CONTENT_RENDERER_PEPPER_PEPPER_FILE_IO_HOST_H_ | 142 #endif // CONTENT_RENDERER_PEPPER_PEPPER_FILE_IO_HOST_H_ |
OLD | NEW |