Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(333)

Side by Side Diff: content/child/fileapi/file_system_dispatcher.h

Issue 23856002: SyncFS: Support resolveLocalFileSystemURL on SyncFileSystem (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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; 22 struct PlatformFileInfo;
23 } 23 }
24 24
25 namespace fileapi { 25 namespace fileapi {
26 struct DirectoryEntry; 26 struct DirectoryEntry;
27 struct FileSystemInfo;
27 } 28 }
28 29
29 class GURL; 30 class GURL;
30 31
31 namespace content { 32 namespace content {
32 33
33 // Dispatches and sends file system related messages sent to/from a child 34 // Dispatches and sends file system related messages sent to/from a child
34 // process from/to the main browser process. There is one instance 35 // process from/to the main browser process. There is one instance
35 // per child process. Messages are dispatched on the main child thread. 36 // per child process. Messages are dispatched on the main child thread.
36 class FileSystemDispatcher : public IPC::Listener { 37 class FileSystemDispatcher : public IPC::Listener {
37 public: 38 public:
38 typedef base::Callback<void(base::PlatformFileError error)> StatusCallback; 39 typedef base::Callback<void(base::PlatformFileError error)> StatusCallback;
39 typedef base::Callback<void( 40 typedef base::Callback<void(
40 const base::PlatformFileInfo& file_info)> MetadataCallback; 41 const base::PlatformFileInfo& file_info)> MetadataCallback;
41 typedef base::Callback<void( 42 typedef base::Callback<void(
42 const base::PlatformFileInfo& file_info, 43 const base::PlatformFileInfo& file_info,
43 const base::FilePath& platform_path, 44 const base::FilePath& platform_path,
44 int request_id)> CreateSnapshotFileCallback; 45 int request_id)> CreateSnapshotFileCallback;
45 typedef base::Callback<void( 46 typedef base::Callback<void(
46 const std::vector<fileapi::DirectoryEntry>& entries, 47 const std::vector<fileapi::DirectoryEntry>& entries,
47 bool has_more)> ReadDirectoryCallback; 48 bool has_more)> ReadDirectoryCallback;
48 typedef base::Callback<void( 49 typedef base::Callback<void(
49 const std::string& name, 50 const std::string& name,
50 const GURL& root)> OpenFileSystemCallback; 51 const GURL& root)> OpenFileSystemCallback;
51 typedef base::Callback<void( 52 typedef base::Callback<void(
53 const fileapi::FileSystemInfo& info,
54 const base::FilePath& file_path,
55 bool is_directory)> ResolveURLCallback;
56 typedef base::Callback<void(
52 int64 bytes, 57 int64 bytes,
53 bool complete)> WriteCallback; 58 bool complete)> WriteCallback;
54 typedef base::Callback<void( 59 typedef base::Callback<void(
55 base::PlatformFile file, 60 base::PlatformFile file,
56 int file_open_id, 61 int file_open_id,
57 quota::QuotaLimitType quota_policy)> OpenFileCallback; 62 quota::QuotaLimitType quota_policy)> OpenFileCallback;
58 63
59 FileSystemDispatcher(); 64 FileSystemDispatcher();
60 virtual ~FileSystemDispatcher(); 65 virtual ~FileSystemDispatcher();
61 66
62 // IPC::Listener implementation. 67 // IPC::Listener implementation.
63 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; 68 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
64 69
65 void OpenFileSystem(const GURL& origin_url, 70 void OpenFileSystem(const GURL& origin_url,
66 fileapi::FileSystemType type, 71 fileapi::FileSystemType type,
67 long long size, 72 long long size,
68 bool create, 73 bool create,
69 const OpenFileSystemCallback& success_callback, 74 const OpenFileSystemCallback& success_callback,
70 const StatusCallback& error_callback); 75 const StatusCallback& error_callback);
76 void ResolveURL(const GURL& filesystem_url,
77 const ResolveURLCallback& success_callback,
78 const StatusCallback& error_callback);
71 void DeleteFileSystem(const GURL& origin_url, 79 void DeleteFileSystem(const GURL& origin_url,
72 fileapi::FileSystemType type, 80 fileapi::FileSystemType type,
73 const StatusCallback& callback); 81 const StatusCallback& callback);
74 void Move(const GURL& src_path, 82 void Move(const GURL& src_path,
75 const GURL& dest_path, 83 const GURL& dest_path,
76 const StatusCallback& callback); 84 const StatusCallback& callback);
77 void Copy(const GURL& src_path, 85 void Copy(const GURL& src_path,
78 const GURL& dest_path, 86 const GURL& dest_path,
79 const StatusCallback& callback); 87 const StatusCallback& callback);
80 void Remove(const GURL& path, 88 void Remove(const GURL& path,
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 const CreateSnapshotFileCallback& success_callback, 145 const CreateSnapshotFileCallback& success_callback,
138 const StatusCallback& error_callback); 146 const StatusCallback& error_callback);
139 147
140 private: 148 private:
141 class CallbackDispatcher; 149 class CallbackDispatcher;
142 150
143 // Message handlers. 151 // Message handlers.
144 void OnDidOpenFileSystem(int request_id, 152 void OnDidOpenFileSystem(int request_id,
145 const std::string& name, 153 const std::string& name,
146 const GURL& root); 154 const GURL& root);
155 void OnDidResolveURL(int request_id,
156 const fileapi::FileSystemInfo& info,
157 const base::FilePath& file_path,
158 bool is_directory);
147 void OnDidSucceed(int request_id); 159 void OnDidSucceed(int request_id);
148 void OnDidReadMetadata(int request_id, 160 void OnDidReadMetadata(int request_id,
149 const base::PlatformFileInfo& file_info); 161 const base::PlatformFileInfo& file_info);
150 void OnDidCreateSnapshotFile(int request_id, 162 void OnDidCreateSnapshotFile(int request_id,
151 const base::PlatformFileInfo& file_info, 163 const base::PlatformFileInfo& file_info,
152 const base::FilePath& platform_path); 164 const base::FilePath& platform_path);
153 void OnDidReadDirectory(int request_id, 165 void OnDidReadDirectory(int request_id,
154 const std::vector<fileapi::DirectoryEntry>& entries, 166 const std::vector<fileapi::DirectoryEntry>& entries,
155 bool has_more); 167 bool has_more);
156 void OnDidFail(int request_id, base::PlatformFileError error_code); 168 void OnDidFail(int request_id, base::PlatformFileError error_code);
157 void OnDidWrite(int request_id, int64 bytes, bool complete); 169 void OnDidWrite(int request_id, int64 bytes, bool complete);
158 void OnDidOpenFile( 170 void OnDidOpenFile(
159 int request_id, 171 int request_id,
160 IPC::PlatformFileForTransit file, 172 IPC::PlatformFileForTransit file,
161 int file_open_id, 173 int file_open_id,
162 quota::QuotaLimitType quota_policy); 174 quota::QuotaLimitType quota_policy);
163 175
164 IDMap<CallbackDispatcher, IDMapOwnPointer> dispatchers_; 176 IDMap<CallbackDispatcher, IDMapOwnPointer> dispatchers_;
165 177
166 DISALLOW_COPY_AND_ASSIGN(FileSystemDispatcher); 178 DISALLOW_COPY_AND_ASSIGN(FileSystemDispatcher);
167 }; 179 };
168 180
169 } // namespace content 181 } // namespace content
170 182
171 #endif // CONTENT_CHILD_FILEAPI_FILE_SYSTEM_DISPATCHER_H_ 183 #endif // CONTENT_CHILD_FILEAPI_FILE_SYSTEM_DISPATCHER_H_
OLDNEW
« no previous file with comments | « content/browser/fileapi/fileapi_message_filter.cc ('k') | content/child/fileapi/file_system_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698