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

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

Issue 442383002: Move storage-related files from webkit/ to new top-level directory storage/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 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 "storage/common/fileapi/file_system_types.h"
18 #include "webkit/common/quota/quota_types.h" 18 #include "storage/common/quota/quota_types.h"
19 19
20 namespace base { 20 namespace base {
21 class FilePath; 21 class FilePath;
22 } 22 }
23 23
24 namespace fileapi { 24 namespace storage {
25 struct DirectoryEntry; 25 struct DirectoryEntry;
26 struct FileSystemInfo; 26 struct FileSystemInfo;
27 } 27 }
28 28
29 class GURL; 29 class GURL;
30 30
31 namespace content { 31 namespace content {
32 32
33 // 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
34 // process from/to the main browser process. There is one instance 34 // process from/to the main browser process. There is one instance
35 // per child process. Messages are dispatched on the main child thread. 35 // per child process. Messages are dispatched on the main child thread.
36 class FileSystemDispatcher : public IPC::Listener { 36 class FileSystemDispatcher : public IPC::Listener {
37 public: 37 public:
38 typedef base::Callback<void(base::File::Error error)> StatusCallback; 38 typedef base::Callback<void(base::File::Error error)> StatusCallback;
39 typedef base::Callback<void( 39 typedef base::Callback<void(
40 const base::File::Info& file_info)> MetadataCallback; 40 const base::File::Info& file_info)> MetadataCallback;
41 typedef base::Callback<void( 41 typedef base::Callback<void(
42 const base::File::Info& file_info, 42 const base::File::Info& file_info,
43 const base::FilePath& platform_path, 43 const base::FilePath& platform_path,
44 int request_id)> CreateSnapshotFileCallback; 44 int request_id)> CreateSnapshotFileCallback;
45 typedef base::Callback<void( 45 typedef base::Callback<
46 const std::vector<fileapi::DirectoryEntry>& entries, 46 void(const std::vector<storage::DirectoryEntry>& entries, bool has_more)>
47 bool has_more)> ReadDirectoryCallback; 47 ReadDirectoryCallback;
48 typedef base::Callback<void( 48 typedef base::Callback<void(
49 const std::string& name, 49 const std::string& name,
50 const GURL& root)> OpenFileSystemCallback; 50 const GURL& root)> OpenFileSystemCallback;
51 typedef base::Callback<void( 51 typedef base::Callback<void(const storage::FileSystemInfo& info,
52 const fileapi::FileSystemInfo& info, 52 const base::FilePath& file_path,
53 const base::FilePath& file_path, 53 bool is_directory)> ResolveURLCallback;
54 bool is_directory)> ResolveURLCallback;
55 typedef base::Callback<void( 54 typedef base::Callback<void(
56 int64 bytes, 55 int64 bytes,
57 bool complete)> WriteCallback; 56 bool complete)> WriteCallback;
58 typedef base::Callback<void( 57 typedef base::Callback<void(
59 base::PlatformFile file, 58 base::PlatformFile file,
60 int file_open_id, 59 int file_open_id,
61 quota::QuotaLimitType quota_policy)> OpenFileCallback; 60 quota::QuotaLimitType quota_policy)> OpenFileCallback;
62 61
63 FileSystemDispatcher(); 62 FileSystemDispatcher();
64 virtual ~FileSystemDispatcher(); 63 virtual ~FileSystemDispatcher();
65 64
66 // IPC::Listener implementation. 65 // IPC::Listener implementation.
67 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; 66 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
68 67
69 void OpenFileSystem(const GURL& origin_url, 68 void OpenFileSystem(const GURL& origin_url,
70 fileapi::FileSystemType type, 69 storage::FileSystemType type,
71 const OpenFileSystemCallback& success_callback, 70 const OpenFileSystemCallback& success_callback,
72 const StatusCallback& error_callback); 71 const StatusCallback& error_callback);
73 void ResolveURL(const GURL& filesystem_url, 72 void ResolveURL(const GURL& filesystem_url,
74 const ResolveURLCallback& success_callback, 73 const ResolveURLCallback& success_callback,
75 const StatusCallback& error_callback); 74 const StatusCallback& error_callback);
76 void DeleteFileSystem(const GURL& origin_url, 75 void DeleteFileSystem(const GURL& origin_url,
77 fileapi::FileSystemType type, 76 storage::FileSystemType type,
78 const StatusCallback& callback); 77 const StatusCallback& callback);
79 void Move(const GURL& src_path, 78 void Move(const GURL& src_path,
80 const GURL& dest_path, 79 const GURL& dest_path,
81 const StatusCallback& callback); 80 const StatusCallback& callback);
82 void Copy(const GURL& src_path, 81 void Copy(const GURL& src_path,
83 const GURL& dest_path, 82 const GURL& dest_path,
84 const StatusCallback& callback); 83 const StatusCallback& callback);
85 void Remove(const GURL& path, 84 void Remove(const GURL& path,
86 bool recursive, 85 bool recursive,
87 const StatusCallback& callback); 86 const StatusCallback& callback);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 const StatusCallback& error_callback); 125 const StatusCallback& error_callback);
127 126
128 private: 127 private:
129 class CallbackDispatcher; 128 class CallbackDispatcher;
130 129
131 // Message handlers. 130 // Message handlers.
132 void OnDidOpenFileSystem(int request_id, 131 void OnDidOpenFileSystem(int request_id,
133 const std::string& name, 132 const std::string& name,
134 const GURL& root); 133 const GURL& root);
135 void OnDidResolveURL(int request_id, 134 void OnDidResolveURL(int request_id,
136 const fileapi::FileSystemInfo& info, 135 const storage::FileSystemInfo& info,
137 const base::FilePath& file_path, 136 const base::FilePath& file_path,
138 bool is_directory); 137 bool is_directory);
139 void OnDidSucceed(int request_id); 138 void OnDidSucceed(int request_id);
140 void OnDidReadMetadata(int request_id, 139 void OnDidReadMetadata(int request_id,
141 const base::File::Info& file_info); 140 const base::File::Info& file_info);
142 void OnDidCreateSnapshotFile(int request_id, 141 void OnDidCreateSnapshotFile(int request_id,
143 const base::File::Info& file_info, 142 const base::File::Info& file_info,
144 const base::FilePath& platform_path); 143 const base::FilePath& platform_path);
145 void OnDidReadDirectory(int request_id, 144 void OnDidReadDirectory(int request_id,
146 const std::vector<fileapi::DirectoryEntry>& entries, 145 const std::vector<storage::DirectoryEntry>& entries,
147 bool has_more); 146 bool has_more);
148 void OnDidFail(int request_id, base::File::Error error_code); 147 void OnDidFail(int request_id, base::File::Error error_code);
149 void OnDidWrite(int request_id, int64 bytes, bool complete); 148 void OnDidWrite(int request_id, int64 bytes, bool complete);
150 149
151 IDMap<CallbackDispatcher, IDMapOwnPointer> dispatchers_; 150 IDMap<CallbackDispatcher, IDMapOwnPointer> dispatchers_;
152 151
153 DISALLOW_COPY_AND_ASSIGN(FileSystemDispatcher); 152 DISALLOW_COPY_AND_ASSIGN(FileSystemDispatcher);
154 }; 153 };
155 154
156 } // namespace content 155 } // namespace content
157 156
158 #endif // CONTENT_CHILD_FILEAPI_FILE_SYSTEM_DISPATCHER_H_ 157 #endif // CONTENT_CHILD_FILEAPI_FILE_SYSTEM_DISPATCHER_H_
OLDNEW
« no previous file with comments | « content/browser/storage_partition_impl_unittest.cc ('k') | content/child/fileapi/file_system_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698