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 |
(...skipping 22 matching lines...) Expand all Loading... |
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::PlatformFileError error)> StatusCallback; | 38 typedef base::Callback<void(base::PlatformFileError error)> StatusCallback; |
39 typedef base::Callback<void( | 39 typedef base::Callback<void( |
40 const base::PlatformFileInfo& file_info)> MetadataCallback; | 40 const base::PlatformFileInfo& file_info)> MetadataCallback; |
41 typedef base::Callback<void( | 41 typedef base::Callback<void( |
42 const base::PlatformFileInfo& file_info, | 42 const base::PlatformFileInfo& file_info, |
43 const base::FilePath& platform_path)> CreateSnapshotFileCallback; | 43 const base::FilePath& platform_path, |
| 44 int request_id)> CreateSnapshotFileCallback; |
44 typedef base::Callback<void( | 45 typedef base::Callback<void( |
45 const std::vector<fileapi::DirectoryEntry>& entries, | 46 const std::vector<fileapi::DirectoryEntry>& entries, |
46 bool has_more)> ReadDirectoryCallback; | 47 bool has_more)> ReadDirectoryCallback; |
47 typedef base::Callback<void( | 48 typedef base::Callback<void( |
48 const std::string& name, | 49 const std::string& name, |
49 const GURL& root)> OpenFileSystemCallback; | 50 const GURL& root)> OpenFileSystemCallback; |
50 typedef base::Callback<void( | 51 typedef base::Callback<void( |
51 int64 bytes, | 52 int64 bytes, |
52 bool complete)> WriteCallback; | 53 bool complete)> WriteCallback; |
53 typedef base::Callback<void( | 54 typedef base::Callback<void( |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 // This returns a raw open PlatformFile, unlike the above, which are | 116 // This returns a raw open PlatformFile, unlike the above, which are |
116 // self-contained operations. | 117 // self-contained operations. |
117 void OpenFile(const GURL& file_path, | 118 void OpenFile(const GURL& file_path, |
118 int file_flags, // passed to FileUtilProxy::CreateOrOpen | 119 int file_flags, // passed to FileUtilProxy::CreateOrOpen |
119 const OpenFileCallback& success_callback, | 120 const OpenFileCallback& success_callback, |
120 const StatusCallback& error_callback); | 121 const StatusCallback& error_callback); |
121 // This must be paired with OpenFile, and called after finished using the | 122 // This must be paired with OpenFile, and called after finished using the |
122 // raw PlatformFile returned from OpenFile. | 123 // raw PlatformFile returned from OpenFile. |
123 void NotifyCloseFile(int file_open_id); | 124 void NotifyCloseFile(int file_open_id); |
124 | 125 |
| 126 // The caller must send FileSystemHostMsg_DidReceiveSnapshot message |
| 127 // with |request_id| passed to |success_callback| after the snapshot file |
| 128 // is successfully received. |
125 void CreateSnapshotFile(const GURL& file_path, | 129 void CreateSnapshotFile(const GURL& file_path, |
126 const CreateSnapshotFileCallback& success_callback, | 130 const CreateSnapshotFileCallback& success_callback, |
127 const StatusCallback& error_callback); | 131 const StatusCallback& error_callback); |
128 | 132 |
129 private: | 133 private: |
130 class CallbackDispatcher; | 134 class CallbackDispatcher; |
131 | 135 |
132 // Message handlers. | 136 // Message handlers. |
133 void OnDidOpenFileSystem(int request_id, | 137 void OnDidOpenFileSystem(int request_id, |
134 const std::string& name, | 138 const std::string& name, |
(...skipping 16 matching lines...) Expand all Loading... |
151 quota::QuotaLimitType quota_policy); | 155 quota::QuotaLimitType quota_policy); |
152 | 156 |
153 IDMap<CallbackDispatcher, IDMapOwnPointer> dispatchers_; | 157 IDMap<CallbackDispatcher, IDMapOwnPointer> dispatchers_; |
154 | 158 |
155 DISALLOW_COPY_AND_ASSIGN(FileSystemDispatcher); | 159 DISALLOW_COPY_AND_ASSIGN(FileSystemDispatcher); |
156 }; | 160 }; |
157 | 161 |
158 } // namespace content | 162 } // namespace content |
159 | 163 |
160 #endif // CONTENT_CHILD_FILEAPI_FILE_SYSTEM_DISPATCHER_H_ | 164 #endif // CONTENT_CHILD_FILEAPI_FILE_SYSTEM_DISPATCHER_H_ |
OLD | NEW |