| Index: chrome/browser/file_system/file_system_dispatcher_host.cc
|
| diff --git a/chrome/browser/file_system/file_system_dispatcher_host.cc b/chrome/browser/file_system/file_system_dispatcher_host.cc
|
| index 12b4d19c474beed209d4feb6bbe61e94703a137e..1d793703b05a77b1473ae06ea90a56219a12af0d 100644
|
| --- a/chrome/browser/file_system/file_system_dispatcher_host.cc
|
| +++ b/chrome/browser/file_system/file_system_dispatcher_host.cc
|
| @@ -9,7 +9,6 @@
|
| #include "base/time.h"
|
| #include "chrome/browser/browser_process.h"
|
| #include "chrome/browser/browser_thread.h"
|
| -#include "chrome/browser/file_system/browser_file_system_callback_dispatcher.h"
|
| #include "chrome/browser/file_system/browser_file_system_context.h"
|
| #include "chrome/browser/host_content_settings_map.h"
|
| #include "chrome/browser/net/chrome_url_request_context.h"
|
| @@ -20,14 +19,67 @@
|
| #include "chrome/common/render_messages_params.h"
|
| #include "googleurl/src/gurl.h"
|
| #include "net/url_request/url_request_context.h"
|
| +#include "webkit/fileapi/file_system_callback_dispatcher.h"
|
| #include "webkit/fileapi/file_system_operation.h"
|
| #include "webkit/fileapi/file_system_path_manager.h"
|
| #include "webkit/fileapi/file_system_quota_manager.h"
|
| #include "webkit/fileapi/sandboxed_file_system_operation.h"
|
|
|
| +using fileapi::FileSystemCallbackDispatcher;
|
| using fileapi::FileSystemQuotaManager;
|
| using fileapi::SandboxedFileSystemOperation;
|
|
|
| +class BrowserFileSystemCallbackDispatcher
|
| + : public FileSystemCallbackDispatcher {
|
| + public:
|
| + BrowserFileSystemCallbackDispatcher(
|
| + FileSystemDispatcherHost* dispatcher_host, int request_id)
|
| + : dispatcher_host_(dispatcher_host),
|
| + request_id_(request_id) {
|
| + DCHECK(dispatcher_host_);
|
| + }
|
| +
|
| + virtual ~BrowserFileSystemCallbackDispatcher() {
|
| + dispatcher_host_->UnregisterOperation(request_id_);
|
| + }
|
| +
|
| + virtual void DidSucceed() {
|
| + dispatcher_host_->Send(new ViewMsg_FileSystem_DidSucceed(request_id_));
|
| + }
|
| +
|
| + virtual void DidReadMetadata(const base::PlatformFileInfo& info) {
|
| + dispatcher_host_->Send(new ViewMsg_FileSystem_DidReadMetadata(
|
| + request_id_, info));
|
| + }
|
| +
|
| + virtual void DidReadDirectory(
|
| + const std::vector<base::FileUtilProxy::Entry>& entries, bool has_more) {
|
| + dispatcher_host_->Send(new ViewMsg_FileSystem_DidReadDirectory(
|
| + request_id_, entries, has_more));
|
| + }
|
| +
|
| + virtual void DidOpenFileSystem(const std::string& name,
|
| + const FilePath& path) {
|
| + dispatcher_host_->Send(
|
| + new ViewMsg_OpenFileSystemRequest_Complete(
|
| + request_id_, !path.empty(), name, path));
|
| + }
|
| +
|
| + virtual void DidFail(base::PlatformFileError error_code) {
|
| + dispatcher_host_->Send(new ViewMsg_FileSystem_DidFail(
|
| + request_id_, error_code));
|
| + }
|
| +
|
| + virtual void DidWrite(int64 bytes, bool complete) {
|
| + dispatcher_host_->Send(new ViewMsg_FileSystem_DidWrite(
|
| + request_id_, bytes, complete));
|
| + }
|
| +
|
| + private:
|
| + scoped_refptr<FileSystemDispatcherHost> dispatcher_host_;
|
| + int request_id_;
|
| +};
|
| +
|
| FileSystemDispatcherHost::FileSystemDispatcherHost(
|
| IPC::Message::Sender* sender, Profile* profile)
|
| : message_sender_(sender),
|
| @@ -217,7 +269,7 @@ SandboxedFileSystemOperation* FileSystemDispatcherHost::GetNewOperation(
|
| return operation;
|
| }
|
|
|
| -void FileSystemDispatcherHost::RemoveCompletedOperation(int request_id) {
|
| +void FileSystemDispatcherHost::UnregisterOperation(int request_id) {
|
| DCHECK(operations_.Lookup(request_id));
|
| operations_.Remove(request_id);
|
| }
|
|
|