| 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_COMMON_FILEAPI_FILE_SYSTEM_DISPATCHER_H_ | 5 #ifndef CONTENT_COMMON_FILEAPI_FILE_SYSTEM_DISPATCHER_H_ |
| 6 #define CONTENT_COMMON_FILEAPI_FILE_SYSTEM_DISPATCHER_H_ | 6 #define CONTENT_COMMON_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/files/file_util_proxy.h" | |
| 14 #include "base/id_map.h" | 13 #include "base/id_map.h" |
| 15 #include "base/process.h" | 14 #include "base/process.h" |
| 16 #include "ipc/ipc_listener.h" | 15 #include "ipc/ipc_listener.h" |
| 17 #include "ipc/ipc_platform_file.h" | 16 #include "ipc/ipc_platform_file.h" |
| 18 #include "webkit/fileapi/file_system_types.h" | 17 #include "webkit/fileapi/file_system_types.h" |
| 19 #include "webkit/quota/quota_types.h" | 18 #include "webkit/quota/quota_types.h" |
| 20 | 19 |
| 21 namespace base { | 20 namespace base { |
| 22 class FilePath; | 21 class FilePath; |
| 23 struct PlatformFileInfo; | 22 struct PlatformFileInfo; |
| 24 } | 23 } |
| 25 | 24 |
| 25 namespace fileapi { |
| 26 struct DirectoryEntry; |
| 27 } |
| 28 |
| 26 class GURL; | 29 class GURL; |
| 27 | 30 |
| 28 namespace content { | 31 namespace content { |
| 29 | 32 |
| 30 // 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 |
| 31 // process from/to the main browser process. There is one instance | 34 // process from/to the main browser process. There is one instance |
| 32 // per child process. Messages are dispatched on the main child thread. | 35 // per child process. Messages are dispatched on the main child thread. |
| 33 class FileSystemDispatcher : public IPC::Listener { | 36 class FileSystemDispatcher : public IPC::Listener { |
| 34 public: | 37 public: |
| 35 typedef base::Callback<void(base::PlatformFileError error)> StatusCallback; | 38 typedef base::Callback<void(base::PlatformFileError error)> StatusCallback; |
| 36 typedef base::Callback<void( | 39 typedef base::Callback<void( |
| 37 const base::PlatformFileInfo& file_info, | 40 const base::PlatformFileInfo& file_info, |
| 38 const base::FilePath& platform_path)> MetadataCallback; | 41 const base::FilePath& platform_path)> MetadataCallback; |
| 39 typedef MetadataCallback CreateSnapshotFileCallback; | 42 typedef MetadataCallback CreateSnapshotFileCallback; |
| 40 typedef base::Callback<void( | 43 typedef base::Callback<void( |
| 41 const std::vector<base::FileUtilProxy::Entry>& entries, | 44 const std::vector<fileapi::DirectoryEntry>& entries, |
| 42 bool has_more)> ReadDirectoryCallback; | 45 bool has_more)> ReadDirectoryCallback; |
| 43 typedef base::Callback<void( | 46 typedef base::Callback<void( |
| 44 const std::string& name, | 47 const std::string& name, |
| 45 const GURL& root)> OpenFileSystemCallback; | 48 const GURL& root)> OpenFileSystemCallback; |
| 46 typedef base::Callback<void( | 49 typedef base::Callback<void( |
| 47 int64 bytes, | 50 int64 bytes, |
| 48 bool complete)> WriteCallback; | 51 bool complete)> WriteCallback; |
| 49 typedef base::Callback<void( | 52 typedef base::Callback<void( |
| 50 base::PlatformFile file, | 53 base::PlatformFile file, |
| 51 int file_open_id, | 54 int file_open_id, |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 void OnDidOpenFileSystem(int request_id, | 130 void OnDidOpenFileSystem(int request_id, |
| 128 const std::string& name, | 131 const std::string& name, |
| 129 const GURL& root); | 132 const GURL& root); |
| 130 void OnDidSucceed(int request_id); | 133 void OnDidSucceed(int request_id); |
| 131 void OnDidReadMetadata(int request_id, | 134 void OnDidReadMetadata(int request_id, |
| 132 const base::PlatformFileInfo& file_info, | 135 const base::PlatformFileInfo& file_info, |
| 133 const base::FilePath& platform_path); | 136 const base::FilePath& platform_path); |
| 134 void OnDidCreateSnapshotFile(int request_id, | 137 void OnDidCreateSnapshotFile(int request_id, |
| 135 const base::PlatformFileInfo& file_info, | 138 const base::PlatformFileInfo& file_info, |
| 136 const base::FilePath& platform_path); | 139 const base::FilePath& platform_path); |
| 137 void OnDidReadDirectory( | 140 void OnDidReadDirectory(int request_id, |
| 138 int request_id, | 141 const std::vector<fileapi::DirectoryEntry>& entries, |
| 139 const std::vector<base::FileUtilProxy::Entry>& entries, | 142 bool has_more); |
| 140 bool has_more); | |
| 141 void OnDidFail(int request_id, base::PlatformFileError error_code); | 143 void OnDidFail(int request_id, base::PlatformFileError error_code); |
| 142 void OnDidWrite(int request_id, int64 bytes, bool complete); | 144 void OnDidWrite(int request_id, int64 bytes, bool complete); |
| 143 void OnDidOpenFile( | 145 void OnDidOpenFile( |
| 144 int request_id, | 146 int request_id, |
| 145 IPC::PlatformFileForTransit file, | 147 IPC::PlatformFileForTransit file, |
| 146 int file_open_id, | 148 int file_open_id, |
| 147 quota::QuotaLimitType quota_policy); | 149 quota::QuotaLimitType quota_policy); |
| 148 | 150 |
| 149 IDMap<CallbackDispatcher, IDMapOwnPointer> dispatchers_; | 151 IDMap<CallbackDispatcher, IDMapOwnPointer> dispatchers_; |
| 150 | 152 |
| 151 DISALLOW_COPY_AND_ASSIGN(FileSystemDispatcher); | 153 DISALLOW_COPY_AND_ASSIGN(FileSystemDispatcher); |
| 152 }; | 154 }; |
| 153 | 155 |
| 154 } // namespace content | 156 } // namespace content |
| 155 | 157 |
| 156 #endif // CONTENT_COMMON_FILEAPI_FILE_SYSTEM_DISPATCHER_H_ | 158 #endif // CONTENT_COMMON_FILEAPI_FILE_SYSTEM_DISPATCHER_H_ |
| OLD | NEW |