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_CHILD_FILEAPI_FILE_SYSTEM_DISPATCHER_H_ | 5 #ifndef CONTENT_CHILD_FILEAPI_FILE_SYSTEM_DISPATCHER_H_ |
6 #define CONTENT_CHILD_FILEAPI_FILE_SYSTEM_DISPATCHER_H_ | 6 #define CONTENT_CHILD_FILEAPI_FILE_SYSTEM_DISPATCHER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
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/process/process.h" | 14 #include "base/process/process.h" |
15 #include "ipc/ipc_listener.h" | 15 #include "ipc/ipc_listener.h" |
16 #include "ipc/ipc_platform_file.h" | 16 #include "ipc/ipc_platform_file.h" |
17 #include "webkit/common/fileapi/file_system_types.h" | 17 #include "webkit/common/fileapi/file_system_types.h" |
18 #include "webkit/common/quota/quota_types.h" | 18 #include "webkit/common/quota/quota_types.h" |
19 | 19 |
20 namespace base { | 20 namespace base { |
21 class FilePath; | 21 class FilePath; |
22 struct PlatformFileInfo; | |
23 } | 22 } |
24 | 23 |
25 namespace fileapi { | 24 namespace fileapi { |
26 struct DirectoryEntry; | 25 struct DirectoryEntry; |
27 struct FileSystemInfo; | 26 struct FileSystemInfo; |
28 } | 27 } |
29 | 28 |
30 class GURL; | 29 class GURL; |
31 | 30 |
32 namespace content { | 31 namespace content { |
33 | 32 |
34 // Dispatches and sends file system related messages sent to/from a child | 33 // Dispatches and sends file system related messages sent to/from a child |
35 // process from/to the main browser process. There is one instance | 34 // process from/to the main browser process. There is one instance |
36 // per child process. Messages are dispatched on the main child thread. | 35 // per child process. Messages are dispatched on the main child thread. |
37 class FileSystemDispatcher : public IPC::Listener { | 36 class FileSystemDispatcher : public IPC::Listener { |
38 public: | 37 public: |
39 typedef base::Callback<void(base::PlatformFileError error)> StatusCallback; | 38 typedef base::Callback<void(base::File::Error error)> StatusCallback; |
40 typedef base::Callback<void( | 39 typedef base::Callback<void( |
41 const base::PlatformFileInfo& file_info)> MetadataCallback; | 40 const base::File::Info& file_info)> MetadataCallback; |
42 typedef base::Callback<void( | 41 typedef base::Callback<void( |
43 const base::PlatformFileInfo& file_info, | 42 const base::File::Info& file_info, |
44 const base::FilePath& platform_path, | 43 const base::FilePath& platform_path, |
45 int request_id)> CreateSnapshotFileCallback; | 44 int request_id)> CreateSnapshotFileCallback; |
46 typedef base::Callback<void( | 45 typedef base::Callback<void( |
47 const std::vector<fileapi::DirectoryEntry>& entries, | 46 const std::vector<fileapi::DirectoryEntry>& entries, |
48 bool has_more)> ReadDirectoryCallback; | 47 bool has_more)> ReadDirectoryCallback; |
49 typedef base::Callback<void( | 48 typedef base::Callback<void( |
50 const std::string& name, | 49 const std::string& name, |
51 const GURL& root)> OpenFileSystemCallback; | 50 const GURL& root)> OpenFileSystemCallback; |
52 typedef base::Callback<void( | 51 typedef base::Callback<void( |
53 const fileapi::FileSystemInfo& info, | 52 const fileapi::FileSystemInfo& info, |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 // Message handlers. | 131 // Message handlers. |
133 void OnDidOpenFileSystem(int request_id, | 132 void OnDidOpenFileSystem(int request_id, |
134 const std::string& name, | 133 const std::string& name, |
135 const GURL& root); | 134 const GURL& root); |
136 void OnDidResolveURL(int request_id, | 135 void OnDidResolveURL(int request_id, |
137 const fileapi::FileSystemInfo& info, | 136 const fileapi::FileSystemInfo& info, |
138 const base::FilePath& file_path, | 137 const base::FilePath& file_path, |
139 bool is_directory); | 138 bool is_directory); |
140 void OnDidSucceed(int request_id); | 139 void OnDidSucceed(int request_id); |
141 void OnDidReadMetadata(int request_id, | 140 void OnDidReadMetadata(int request_id, |
142 const base::PlatformFileInfo& file_info); | 141 const base::File::Info& file_info); |
143 void OnDidCreateSnapshotFile(int request_id, | 142 void OnDidCreateSnapshotFile(int request_id, |
144 const base::PlatformFileInfo& file_info, | 143 const base::File::Info& file_info, |
145 const base::FilePath& platform_path); | 144 const base::FilePath& platform_path); |
146 void OnDidReadDirectory(int request_id, | 145 void OnDidReadDirectory(int request_id, |
147 const std::vector<fileapi::DirectoryEntry>& entries, | 146 const std::vector<fileapi::DirectoryEntry>& entries, |
148 bool has_more); | 147 bool has_more); |
149 void OnDidFail(int request_id, base::PlatformFileError error_code); | 148 void OnDidFail(int request_id, base::File::Error error_code); |
150 void OnDidWrite(int request_id, int64 bytes, bool complete); | 149 void OnDidWrite(int request_id, int64 bytes, bool complete); |
151 void OnDidOpenFile( | 150 void OnDidOpenFile( |
152 int request_id, | 151 int request_id, |
153 IPC::PlatformFileForTransit file, | 152 IPC::PlatformFileForTransit file, |
154 int file_open_id, | 153 int file_open_id, |
155 quota::QuotaLimitType quota_policy); | 154 quota::QuotaLimitType quota_policy); |
156 | 155 |
157 IDMap<CallbackDispatcher, IDMapOwnPointer> dispatchers_; | 156 IDMap<CallbackDispatcher, IDMapOwnPointer> dispatchers_; |
158 | 157 |
159 DISALLOW_COPY_AND_ASSIGN(FileSystemDispatcher); | 158 DISALLOW_COPY_AND_ASSIGN(FileSystemDispatcher); |
160 }; | 159 }; |
161 | 160 |
162 } // namespace content | 161 } // namespace content |
163 | 162 |
164 #endif // CONTENT_CHILD_FILEAPI_FILE_SYSTEM_DISPATCHER_H_ | 163 #endif // CONTENT_CHILD_FILEAPI_FILE_SYSTEM_DISPATCHER_H_ |
OLD | NEW |