| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 const base::PlatformFileInfo& file_info, | 42 const base::PlatformFileInfo& 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<void( |
| 46 const std::vector<fileapi::DirectoryEntry>& entries, | 46 const std::vector<fileapi::DirectoryEntry>& entries, |
| 47 bool has_more)> ReadDirectoryCallback; | 47 bool has_more)> 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( |
| 52 const std::string& name, |
| 53 const GURL& root, |
| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 const CreateSnapshotFileCallback& success_callback, | 138 const CreateSnapshotFileCallback& success_callback, |
| 131 const StatusCallback& error_callback); | 139 const StatusCallback& error_callback); |
| 132 | 140 |
| 133 private: | 141 private: |
| 134 class CallbackDispatcher; | 142 class CallbackDispatcher; |
| 135 | 143 |
| 136 // Message handlers. | 144 // Message handlers. |
| 137 void OnDidOpenFileSystem(int request_id, | 145 void OnDidOpenFileSystem(int request_id, |
| 138 const std::string& name, | 146 const std::string& name, |
| 139 const GURL& root); | 147 const GURL& root); |
| 148 void OnDidResolveURL(int request_id, |
| 149 const std::string& name, |
| 150 const GURL& root, |
| 151 const base::FilePath& file_path, |
| 152 bool is_directory); |
| 140 void OnDidSucceed(int request_id); | 153 void OnDidSucceed(int request_id); |
| 141 void OnDidReadMetadata(int request_id, | 154 void OnDidReadMetadata(int request_id, |
| 142 const base::PlatformFileInfo& file_info); | 155 const base::PlatformFileInfo& file_info); |
| 143 void OnDidCreateSnapshotFile(int request_id, | 156 void OnDidCreateSnapshotFile(int request_id, |
| 144 const base::PlatformFileInfo& file_info, | 157 const base::PlatformFileInfo& file_info, |
| 145 const base::FilePath& platform_path); | 158 const base::FilePath& platform_path); |
| 146 void OnDidReadDirectory(int request_id, | 159 void OnDidReadDirectory(int request_id, |
| 147 const std::vector<fileapi::DirectoryEntry>& entries, | 160 const std::vector<fileapi::DirectoryEntry>& entries, |
| 148 bool has_more); | 161 bool has_more); |
| 149 void OnDidFail(int request_id, base::PlatformFileError error_code); | 162 void OnDidFail(int request_id, base::PlatformFileError error_code); |
| 150 void OnDidWrite(int request_id, int64 bytes, bool complete); | 163 void OnDidWrite(int request_id, int64 bytes, bool complete); |
| 151 void OnDidOpenFile( | 164 void OnDidOpenFile( |
| 152 int request_id, | 165 int request_id, |
| 153 IPC::PlatformFileForTransit file, | 166 IPC::PlatformFileForTransit file, |
| 154 int file_open_id, | 167 int file_open_id, |
| 155 quota::QuotaLimitType quota_policy); | 168 quota::QuotaLimitType quota_policy); |
| 156 | 169 |
| 157 IDMap<CallbackDispatcher, IDMapOwnPointer> dispatchers_; | 170 IDMap<CallbackDispatcher, IDMapOwnPointer> dispatchers_; |
| 158 | 171 |
| 159 DISALLOW_COPY_AND_ASSIGN(FileSystemDispatcher); | 172 DISALLOW_COPY_AND_ASSIGN(FileSystemDispatcher); |
| 160 }; | 173 }; |
| 161 | 174 |
| 162 } // namespace content | 175 } // namespace content |
| 163 | 176 |
| 164 #endif // CONTENT_CHILD_FILEAPI_FILE_SYSTEM_DISPATCHER_H_ | 177 #endif // CONTENT_CHILD_FILEAPI_FILE_SYSTEM_DISPATCHER_H_ |
| OLD | NEW |