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