| Index: content/common/fileapi/file_system_dispatcher.h
|
| diff --git a/content/common/fileapi/file_system_dispatcher.h b/content/common/fileapi/file_system_dispatcher.h
|
| index f38cd0d3db55fefb22d07c142a01f366eb36e7df..4d01c6ec7887f5814ba65d4337d864bde7762392 100644
|
| --- a/content/common/fileapi/file_system_dispatcher.h
|
| +++ b/content/common/fileapi/file_system_dispatcher.h
|
| @@ -9,12 +9,12 @@
|
| #include <vector>
|
|
|
| #include "base/basictypes.h"
|
| +#include "base/callback_forward.h"
|
| #include "base/files/file_util_proxy.h"
|
| #include "base/id_map.h"
|
| #include "base/process.h"
|
| #include "ipc/ipc_listener.h"
|
| #include "ipc/ipc_platform_file.h"
|
| -#include "webkit/fileapi/file_system_callback_dispatcher.h"
|
| #include "webkit/fileapi/file_system_types.h"
|
| #include "webkit/quota/quota_types.h"
|
|
|
| @@ -32,6 +32,25 @@ namespace content {
|
| // per child process. Messages are dispatched on the main child thread.
|
| class FileSystemDispatcher : public IPC::Listener {
|
| public:
|
| + typedef base::Callback<void(base::PlatformFileError error)> StatusCallback;
|
| + typedef base::Callback<void(
|
| + const base::PlatformFileInfo& file_info,
|
| + const base::FilePath& platform_path)> MetadataCallback;
|
| + typedef MetadataCallback CreateSnapshotFileCallback;
|
| + typedef base::Callback<void(
|
| + const std::vector<base::FileUtilProxy::Entry>& entries,
|
| + bool has_more)> ReadDirectoryCallback;
|
| + typedef base::Callback<void(
|
| + const std::string& name,
|
| + const GURL& root)> OpenFileSystemCallback;
|
| + typedef base::Callback<void(
|
| + int64 bytes,
|
| + bool complete)> WriteCallback;
|
| + typedef base::Callback<void(
|
| + base::PlatformFile file,
|
| + int file_open_id,
|
| + quota::QuotaLimitType quota_policy)> OpenFileCallback;
|
| +
|
| FileSystemDispatcher();
|
| virtual ~FileSystemDispatcher();
|
|
|
| @@ -42,60 +61,68 @@ class FileSystemDispatcher : public IPC::Listener {
|
| fileapi::FileSystemType type,
|
| long long size,
|
| bool create,
|
| - fileapi::FileSystemCallbackDispatcher* dispatcher);
|
| + const OpenFileSystemCallback& success_callback,
|
| + const StatusCallback& error_callback);
|
| bool DeleteFileSystem(const GURL& origin_url,
|
| fileapi::FileSystemType type,
|
| - fileapi::FileSystemCallbackDispatcher* dispatcher);
|
| + const StatusCallback& callback);
|
| bool Move(const GURL& src_path,
|
| const GURL& dest_path,
|
| - fileapi::FileSystemCallbackDispatcher* dispatcher);
|
| + const StatusCallback& callback);
|
| bool Copy(const GURL& src_path,
|
| const GURL& dest_path,
|
| - fileapi::FileSystemCallbackDispatcher* dispatcher);
|
| + const StatusCallback& callback);
|
| bool Remove(const GURL& path,
|
| bool recursive,
|
| - fileapi::FileSystemCallbackDispatcher* dispatcher);
|
| + const StatusCallback& callback);
|
| bool ReadMetadata(const GURL& path,
|
| - fileapi::FileSystemCallbackDispatcher* dispatcher);
|
| + const MetadataCallback& success_callback,
|
| + const StatusCallback& error_callback);
|
| bool Create(const GURL& path,
|
| bool exclusive,
|
| bool is_directory,
|
| bool recursive,
|
| - fileapi::FileSystemCallbackDispatcher* dispatcher);
|
| + const StatusCallback& callback);
|
| bool Exists(const GURL& path,
|
| bool for_directory,
|
| - fileapi::FileSystemCallbackDispatcher* dispatcher);
|
| + const StatusCallback& callback);
|
| bool ReadDirectory(const GURL& path,
|
| - fileapi::FileSystemCallbackDispatcher* dispatcher);
|
| + const ReadDirectoryCallback& success_callback,
|
| + const StatusCallback& error_callback);
|
| bool Truncate(const GURL& path,
|
| int64 offset,
|
| int* request_id_out,
|
| - fileapi::FileSystemCallbackDispatcher* dispatcher);
|
| + const StatusCallback& callback);
|
| bool Write(const GURL& path,
|
| const GURL& blob_url,
|
| int64 offset,
|
| int* request_id_out,
|
| - fileapi::FileSystemCallbackDispatcher* dispatcher);
|
| + const WriteCallback& success_callback,
|
| + const StatusCallback& error_callback);
|
| bool Cancel(int request_id_to_cancel,
|
| - fileapi::FileSystemCallbackDispatcher* dispatcher);
|
| + const StatusCallback& callback);
|
| bool TouchFile(const GURL& file_path,
|
| const base::Time& last_access_time,
|
| const base::Time& last_modified_time,
|
| - fileapi::FileSystemCallbackDispatcher* dispatcher);
|
| + const StatusCallback& callback);
|
|
|
| // This returns a raw open PlatformFile, unlike the above, which are
|
| // self-contained operations.
|
| bool OpenFile(const GURL& file_path,
|
| int file_flags, // passed to FileUtilProxy::CreateOrOpen
|
| - fileapi::FileSystemCallbackDispatcher* dispatcher);
|
| + const OpenFileCallback& success_callback,
|
| + const StatusCallback& error_callback);
|
| // This must be paired with OpenFile, and called after finished using the
|
| // raw PlatformFile returned from OpenFile.
|
| bool NotifyCloseFile(int file_open_id);
|
|
|
| bool CreateSnapshotFile(const GURL& file_path,
|
| - fileapi::FileSystemCallbackDispatcher* dispatcher);
|
| + const CreateSnapshotFileCallback& success_callback,
|
| + const StatusCallback& error_callback);
|
|
|
| private:
|
| + class CallbackDispatcher;
|
| +
|
| // Message handlers.
|
| void OnDidOpenFileSystem(int request_id,
|
| const std::string& name,
|
| @@ -119,7 +146,7 @@ class FileSystemDispatcher : public IPC::Listener {
|
| int file_open_id,
|
| quota::QuotaLimitType quota_policy);
|
|
|
| - IDMap<fileapi::FileSystemCallbackDispatcher, IDMapOwnPointer> dispatchers_;
|
| + IDMap<CallbackDispatcher, IDMapOwnPointer> dispatchers_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(FileSystemDispatcher);
|
| };
|
|
|