summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorkinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-16 14:19:27 +0000
committerkinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-16 14:19:27 +0000
commitd2691960115fcc0333fda4fa390bba77cd54dee4 (patch)
tree6de6f151ef69cf6d256c78e2130ec160fff13ac4 /content
parent015eb6cca97452167afb969f6ca7965601dd72ac (diff)
downloadchromium_src-d2691960115fcc0333fda4fa390bba77cd54dee4.zip
chromium_src-d2691960115fcc0333fda4fa390bba77cd54dee4.tar.gz
chromium_src-d2691960115fcc0333fda4fa390bba77cd54dee4.tar.bz2
Cleanup: Deprecate FileSystemCallbackDispatcher
Replace all FileSystemCallbackDispatcher* with our usual base::Callback. BUG=157537 TEST=existing tests R=michaeln@chromium.org, tzik@chromium.org, yzshen@chromium.org Review URL: https://codereview.chromium.org/14796018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@200531 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/common/fileapi/file_system_dispatcher.cc212
-rw-r--r--content/common/fileapi/file_system_dispatcher.h61
-rw-r--r--content/common/fileapi/webfilesystem_callback_adapters.cc (renamed from content/common/fileapi/webfilesystem_callback_dispatcher.cc)51
-rw-r--r--content/common/fileapi/webfilesystem_callback_adapters.h45
-rw-r--r--content/common/fileapi/webfilesystem_callback_dispatcher.h48
-rw-r--r--content/common/fileapi/webfilesystem_impl.cc57
-rw-r--r--content/common/fileapi/webfilewriter_impl.cc60
-rw-r--r--content/content_common.gypi6
-rw-r--r--content/content_renderer.gypi2
-rw-r--r--content/renderer/pepper/null_file_system_callback_dispatcher.cc59
-rw-r--r--content/renderer/pepper/null_file_system_callback_dispatcher.h55
-rw-r--r--content/renderer/pepper/pepper_file_io_host.cc37
-rw-r--r--content/renderer/pepper/pepper_file_system_host.cc50
-rw-r--r--content/renderer/pepper/pepper_file_system_host.h8
-rw-r--r--content/renderer/pepper/pepper_plugin_delegate_impl.cc135
-rw-r--r--content/renderer/pepper/pepper_plugin_delegate_impl.h19
-rw-r--r--content/renderer/render_view_impl.cc8
-rw-r--r--content/worker/websharedworkerclient_proxy.cc6
18 files changed, 424 insertions, 495 deletions
diff --git a/content/common/fileapi/file_system_dispatcher.cc b/content/common/fileapi/file_system_dispatcher.cc
index c9726dc..9f725a6 100644
--- a/content/common/fileapi/file_system_dispatcher.cc
+++ b/content/common/fileapi/file_system_dispatcher.cc
@@ -4,21 +4,133 @@
#include "content/common/fileapi/file_system_dispatcher.h"
+#include "base/callback.h"
+#include "base/file_util.h"
#include "base/process.h"
#include "content/common/child_thread.h"
#include "content/common/fileapi/file_system_messages.h"
namespace content {
+class FileSystemDispatcher::CallbackDispatcher {
+ public:
+ typedef CallbackDispatcher self;
+ typedef FileSystemDispatcher::StatusCallback StatusCallback;
+ typedef FileSystemDispatcher::MetadataCallback MetadataCallback;
+ typedef FileSystemDispatcher::ReadDirectoryCallback ReadDirectoryCallback;
+ typedef FileSystemDispatcher::OpenFileSystemCallback OpenFileSystemCallback;
+ typedef FileSystemDispatcher::WriteCallback WriteCallback;
+ typedef FileSystemDispatcher::OpenFileCallback OpenFileCallback;
+
+ static CallbackDispatcher* Create(const StatusCallback& callback) {
+ CallbackDispatcher* dispatcher = new CallbackDispatcher;
+ dispatcher->status_callback_ = callback;
+ dispatcher->error_callback_ = callback;
+ return dispatcher;
+ }
+ static CallbackDispatcher* Create(const MetadataCallback& callback,
+ const StatusCallback& error_callback) {
+ CallbackDispatcher* dispatcher = new CallbackDispatcher;
+ dispatcher->metadata_callback_ = callback;
+ dispatcher->error_callback_ = error_callback;
+ return dispatcher;
+ }
+ static CallbackDispatcher* Create(const ReadDirectoryCallback& callback,
+ const StatusCallback& error_callback) {
+ CallbackDispatcher* dispatcher = new CallbackDispatcher;
+ dispatcher->directory_callback_ = callback;
+ dispatcher->error_callback_ = error_callback;
+ return dispatcher;
+ }
+ static CallbackDispatcher* Create(const OpenFileSystemCallback& callback,
+ const StatusCallback& error_callback) {
+ CallbackDispatcher* dispatcher = new CallbackDispatcher;
+ dispatcher->filesystem_callback_ = callback;
+ dispatcher->error_callback_ = error_callback;
+ return dispatcher;
+ }
+ static CallbackDispatcher* Create(const WriteCallback& callback,
+ const StatusCallback& error_callback) {
+ CallbackDispatcher* dispatcher = new CallbackDispatcher;
+ dispatcher->write_callback_ = callback;
+ dispatcher->error_callback_ = error_callback;
+ return dispatcher;
+ }
+ static CallbackDispatcher* Create(const OpenFileCallback& callback,
+ const StatusCallback& error_callback) {
+ CallbackDispatcher* dispatcher = new CallbackDispatcher;
+ dispatcher->open_callback_ = callback;
+ dispatcher->error_callback_ = error_callback;
+ return dispatcher;
+ }
+
+ ~CallbackDispatcher() {}
+
+ void DidSucceed() {
+ status_callback_.Run(base::PLATFORM_FILE_OK);
+ }
+
+ void DidFail(base::PlatformFileError error_code) {
+ error_callback_.Run(error_code);
+ }
+
+ void DidReadMetadata(
+ const base::PlatformFileInfo& file_info,
+ const base::FilePath& platform_path) {
+ metadata_callback_.Run(file_info, platform_path);
+ }
+
+ void DidCreateSnapshotFile(
+ const base::PlatformFileInfo& file_info,
+ const base::FilePath& platform_path) {
+ metadata_callback_.Run(file_info, platform_path);
+ }
+
+ void DidReadDirectory(
+ const std::vector<base::FileUtilProxy::Entry>& entries,
+ bool has_more) {
+ directory_callback_.Run(entries, has_more);
+ }
+
+ void DidOpenFileSystem(const std::string& name,
+ const GURL& root) {
+ filesystem_callback_.Run(name, root);
+ }
+
+ void DidWrite(int64 bytes, bool complete) {
+ write_callback_.Run(bytes, complete);
+ }
+
+ void DidOpenFile(base::PlatformFile file,
+ int file_open_id,
+ quota::QuotaLimitType quota_policy) {
+ open_callback_.Run(file, file_open_id, quota_policy);
+ }
+
+ private:
+ CallbackDispatcher() {}
+
+ StatusCallback status_callback_;
+ MetadataCallback metadata_callback_;
+ ReadDirectoryCallback directory_callback_;
+ OpenFileSystemCallback filesystem_callback_;
+ WriteCallback write_callback_;
+ OpenFileCallback open_callback_;
+
+ StatusCallback error_callback_;
+
+ DISALLOW_COPY_AND_ASSIGN(CallbackDispatcher);
+};
+
FileSystemDispatcher::FileSystemDispatcher() {
}
FileSystemDispatcher::~FileSystemDispatcher() {
// Make sure we fire all the remaining callbacks.
- for (IDMap<fileapi::FileSystemCallbackDispatcher, IDMapOwnPointer>::iterator
+ for (IDMap<CallbackDispatcher, IDMapOwnPointer>::iterator
iter(&dispatchers_); !iter.IsAtEnd(); iter.Advance()) {
int request_id = iter.GetCurrentKey();
- fileapi::FileSystemCallbackDispatcher* dispatcher = iter.GetCurrentValue();
+ CallbackDispatcher* dispatcher = iter.GetCurrentValue();
DCHECK(dispatcher);
dispatcher->DidFail(base::PLATFORM_FILE_ERROR_ABORT);
dispatchers_.Remove(request_id);
@@ -45,8 +157,10 @@ bool FileSystemDispatcher::OnMessageReceived(const IPC::Message& msg) {
bool FileSystemDispatcher::OpenFileSystem(
const GURL& origin_url, fileapi::FileSystemType type,
long long size, bool create,
- fileapi::FileSystemCallbackDispatcher* dispatcher) {
- int request_id = dispatchers_.Add(dispatcher);
+ const OpenFileSystemCallback& success_callback,
+ const StatusCallback& error_callback) {
+ int request_id = dispatchers_.Add(
+ CallbackDispatcher::Create(success_callback, error_callback));
if (!ChildThread::current()->Send(new FileSystemHostMsg_Open(
request_id, origin_url, type, size, create))) {
dispatchers_.Remove(request_id); // destroys |dispatcher|
@@ -59,8 +173,8 @@ bool FileSystemDispatcher::OpenFileSystem(
bool FileSystemDispatcher::DeleteFileSystem(
const GURL& origin_url,
fileapi::FileSystemType type,
- fileapi::FileSystemCallbackDispatcher* dispatcher) {
- int request_id = dispatchers_.Add(dispatcher);
+ const StatusCallback& callback) {
+ int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback));
if (!ChildThread::current()->Send(new FileSystemHostMsg_DeleteFileSystem(
request_id, origin_url, type))) {
dispatchers_.Remove(request_id);
@@ -72,8 +186,8 @@ bool FileSystemDispatcher::DeleteFileSystem(
bool FileSystemDispatcher::Move(
const GURL& src_path,
const GURL& dest_path,
- fileapi::FileSystemCallbackDispatcher* dispatcher) {
- int request_id = dispatchers_.Add(dispatcher);
+ const StatusCallback& callback) {
+ int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback));
if (!ChildThread::current()->Send(new FileSystemHostMsg_Move(
request_id, src_path, dest_path))) {
dispatchers_.Remove(request_id); // destroys |dispatcher|
@@ -86,8 +200,8 @@ bool FileSystemDispatcher::Move(
bool FileSystemDispatcher::Copy(
const GURL& src_path,
const GURL& dest_path,
- fileapi::FileSystemCallbackDispatcher* dispatcher) {
- int request_id = dispatchers_.Add(dispatcher);
+ const StatusCallback& callback) {
+ int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback));
if (!ChildThread::current()->Send(new FileSystemHostMsg_Copy(
request_id, src_path, dest_path))) {
dispatchers_.Remove(request_id); // destroys |dispatcher|
@@ -100,8 +214,8 @@ bool FileSystemDispatcher::Copy(
bool FileSystemDispatcher::Remove(
const GURL& path,
bool recursive,
- fileapi::FileSystemCallbackDispatcher* dispatcher) {
- int request_id = dispatchers_.Add(dispatcher);
+ const StatusCallback& callback) {
+ int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback));
if (!ChildThread::current()->Send(
new FileSystemMsg_Remove(request_id, path, recursive))) {
dispatchers_.Remove(request_id); // destroys |dispatcher|
@@ -113,8 +227,10 @@ bool FileSystemDispatcher::Remove(
bool FileSystemDispatcher::ReadMetadata(
const GURL& path,
- fileapi::FileSystemCallbackDispatcher* dispatcher) {
- int request_id = dispatchers_.Add(dispatcher);
+ const MetadataCallback& success_callback,
+ const StatusCallback& error_callback) {
+ int request_id = dispatchers_.Add(
+ CallbackDispatcher::Create(success_callback, error_callback));
if (!ChildThread::current()->Send(
new FileSystemHostMsg_ReadMetadata(request_id, path))) {
dispatchers_.Remove(request_id); // destroys |dispatcher|
@@ -129,8 +245,8 @@ bool FileSystemDispatcher::Create(
bool exclusive,
bool is_directory,
bool recursive,
- fileapi::FileSystemCallbackDispatcher* dispatcher) {
- int request_id = dispatchers_.Add(dispatcher);
+ const StatusCallback& callback) {
+ int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback));
if (!ChildThread::current()->Send(new FileSystemHostMsg_Create(
request_id, path, exclusive, is_directory, recursive))) {
dispatchers_.Remove(request_id); // destroys |dispatcher|
@@ -143,8 +259,8 @@ bool FileSystemDispatcher::Create(
bool FileSystemDispatcher::Exists(
const GURL& path,
bool is_directory,
- fileapi::FileSystemCallbackDispatcher* dispatcher) {
- int request_id = dispatchers_.Add(dispatcher);
+ const StatusCallback& callback) {
+ int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback));
if (!ChildThread::current()->Send(
new FileSystemHostMsg_Exists(request_id, path, is_directory))) {
dispatchers_.Remove(request_id); // destroys |dispatcher|
@@ -156,8 +272,10 @@ bool FileSystemDispatcher::Exists(
bool FileSystemDispatcher::ReadDirectory(
const GURL& path,
- fileapi::FileSystemCallbackDispatcher* dispatcher) {
- int request_id = dispatchers_.Add(dispatcher);
+ const ReadDirectoryCallback& success_callback,
+ const StatusCallback& error_callback) {
+ int request_id = dispatchers_.Add(
+ CallbackDispatcher::Create(success_callback, error_callback));
if (!ChildThread::current()->Send(
new FileSystemHostMsg_ReadDirectory(request_id, path))) {
dispatchers_.Remove(request_id); // destroys |dispatcher|
@@ -171,8 +289,8 @@ bool FileSystemDispatcher::Truncate(
const GURL& path,
int64 offset,
int* request_id_out,
- fileapi::FileSystemCallbackDispatcher* dispatcher) {
- int request_id = dispatchers_.Add(dispatcher);
+ const StatusCallback& callback) {
+ int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback));
if (!ChildThread::current()->Send(
new FileSystemHostMsg_Truncate(request_id, path, offset))) {
dispatchers_.Remove(request_id); // destroys |dispatcher|
@@ -189,8 +307,10 @@ bool FileSystemDispatcher::Write(
const GURL& blob_url,
int64 offset,
int* request_id_out,
- fileapi::FileSystemCallbackDispatcher* dispatcher) {
- int request_id = dispatchers_.Add(dispatcher);
+ const WriteCallback& success_callback,
+ const StatusCallback& error_callback) {
+ int request_id = dispatchers_.Add(
+ CallbackDispatcher::Create(success_callback, error_callback));
if (!ChildThread::current()->Send(
new FileSystemHostMsg_Write(request_id, path, blob_url, offset))) {
dispatchers_.Remove(request_id); // destroys |dispatcher|
@@ -204,8 +324,8 @@ bool FileSystemDispatcher::Write(
bool FileSystemDispatcher::Cancel(
int request_id_to_cancel,
- fileapi::FileSystemCallbackDispatcher* dispatcher) {
- int request_id = dispatchers_.Add(dispatcher);
+ const StatusCallback& callback) {
+ int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback));
if (!ChildThread::current()->Send(new FileSystemHostMsg_CancelWrite(
request_id, request_id_to_cancel))) {
dispatchers_.Remove(request_id); // destroys |dispatcher|
@@ -219,8 +339,8 @@ bool FileSystemDispatcher::TouchFile(
const GURL& path,
const base::Time& last_access_time,
const base::Time& last_modified_time,
- fileapi::FileSystemCallbackDispatcher* dispatcher) {
- int request_id = dispatchers_.Add(dispatcher);
+ const StatusCallback& callback) {
+ int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback));
if (!ChildThread::current()->Send(
new FileSystemHostMsg_TouchFile(
request_id, path, last_access_time, last_modified_time))) {
@@ -234,8 +354,10 @@ bool FileSystemDispatcher::TouchFile(
bool FileSystemDispatcher::OpenFile(
const GURL& file_path,
int file_flags,
- fileapi::FileSystemCallbackDispatcher* dispatcher) {
- int request_id = dispatchers_.Add(dispatcher);
+ const OpenFileCallback& success_callback,
+ const StatusCallback& error_callback) {
+ int request_id = dispatchers_.Add(
+ CallbackDispatcher::Create(success_callback, error_callback));
if (!ChildThread::current()->Send(
new FileSystemHostMsg_OpenFile(
request_id, file_path, file_flags))) {
@@ -253,8 +375,10 @@ bool FileSystemDispatcher::NotifyCloseFile(int file_open_id) {
bool FileSystemDispatcher::CreateSnapshotFile(
const GURL& file_path,
- fileapi::FileSystemCallbackDispatcher* dispatcher) {
- int request_id = dispatchers_.Add(dispatcher);
+ const CreateSnapshotFileCallback& success_callback,
+ const StatusCallback& error_callback) {
+ int request_id = dispatchers_.Add(
+ CallbackDispatcher::Create(success_callback, error_callback));
if (!ChildThread::current()->Send(
new FileSystemHostMsg_CreateSnapshotFile(
request_id, file_path))) {
@@ -268,16 +392,14 @@ void FileSystemDispatcher::OnDidOpenFileSystem(int request_id,
const std::string& name,
const GURL& root) {
DCHECK(root.is_valid());
- fileapi::FileSystemCallbackDispatcher* dispatcher =
- dispatchers_.Lookup(request_id);
+ CallbackDispatcher* dispatcher = dispatchers_.Lookup(request_id);
DCHECK(dispatcher);
dispatcher->DidOpenFileSystem(name, root);
dispatchers_.Remove(request_id);
}
void FileSystemDispatcher::OnDidSucceed(int request_id) {
- fileapi::FileSystemCallbackDispatcher* dispatcher =
- dispatchers_.Lookup(request_id);
+ CallbackDispatcher* dispatcher = dispatchers_.Lookup(request_id);
DCHECK(dispatcher);
dispatcher->DidSucceed();
dispatchers_.Remove(request_id);
@@ -286,8 +408,7 @@ void FileSystemDispatcher::OnDidSucceed(int request_id) {
void FileSystemDispatcher::OnDidReadMetadata(
int request_id, const base::PlatformFileInfo& file_info,
const base::FilePath& platform_path) {
- fileapi::FileSystemCallbackDispatcher* dispatcher =
- dispatchers_.Lookup(request_id);
+ CallbackDispatcher* dispatcher = dispatchers_.Lookup(request_id);
DCHECK(dispatcher);
dispatcher->DidReadMetadata(file_info, platform_path);
dispatchers_.Remove(request_id);
@@ -296,8 +417,7 @@ void FileSystemDispatcher::OnDidReadMetadata(
void FileSystemDispatcher::OnDidCreateSnapshotFile(
int request_id, const base::PlatformFileInfo& file_info,
const base::FilePath& platform_path) {
- fileapi::FileSystemCallbackDispatcher* dispatcher =
- dispatchers_.Lookup(request_id);
+ CallbackDispatcher* dispatcher = dispatchers_.Lookup(request_id);
DCHECK(dispatcher);
dispatcher->DidCreateSnapshotFile(file_info, platform_path);
dispatchers_.Remove(request_id);
@@ -309,8 +429,7 @@ void FileSystemDispatcher::OnDidReadDirectory(
int request_id,
const std::vector<base::FileUtilProxy::Entry>& entries,
bool has_more) {
- fileapi::FileSystemCallbackDispatcher* dispatcher =
- dispatchers_.Lookup(request_id);
+ CallbackDispatcher* dispatcher = dispatchers_.Lookup(request_id);
DCHECK(dispatcher);
dispatcher->DidReadDirectory(entries, has_more);
dispatchers_.Remove(request_id);
@@ -318,8 +437,7 @@ void FileSystemDispatcher::OnDidReadDirectory(
void FileSystemDispatcher::OnDidFail(
int request_id, base::PlatformFileError error_code) {
- fileapi::FileSystemCallbackDispatcher* dispatcher =
- dispatchers_.Lookup(request_id);
+ CallbackDispatcher* dispatcher = dispatchers_.Lookup(request_id);
DCHECK(dispatcher);
dispatcher->DidFail(error_code);
dispatchers_.Remove(request_id);
@@ -327,8 +445,7 @@ void FileSystemDispatcher::OnDidFail(
void FileSystemDispatcher::OnDidWrite(
int request_id, int64 bytes, bool complete) {
- fileapi::FileSystemCallbackDispatcher* dispatcher =
- dispatchers_.Lookup(request_id);
+ CallbackDispatcher* dispatcher = dispatchers_.Lookup(request_id);
DCHECK(dispatcher);
dispatcher->DidWrite(bytes, complete);
if (complete)
@@ -340,8 +457,7 @@ void FileSystemDispatcher::OnDidOpenFile(
IPC::PlatformFileForTransit file,
int file_open_id,
quota::QuotaLimitType quota_policy) {
- fileapi::FileSystemCallbackDispatcher* dispatcher =
- dispatchers_.Lookup(request_id);
+ CallbackDispatcher* dispatcher = dispatchers_.Lookup(request_id);
DCHECK(dispatcher);
dispatcher->DidOpenFile(IPC::PlatformFileForTransitToPlatformFile(file),
file_open_id,
diff --git a/content/common/fileapi/file_system_dispatcher.h b/content/common/fileapi/file_system_dispatcher.h
index f38cd0d..4d01c6e 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);
};
diff --git a/content/common/fileapi/webfilesystem_callback_dispatcher.cc b/content/common/fileapi/webfilesystem_callback_adapters.cc
index 24926c6..228371a 100644
--- a/content/common/fileapi/webfilesystem_callback_dispatcher.cc
+++ b/content/common/fileapi/webfilesystem_callback_adapters.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "content/common/fileapi/webfilesystem_callback_dispatcher.h"
+#include "content/common/fileapi/webfilesystem_callback_adapters.h"
#include <string>
#include <vector>
@@ -12,7 +12,6 @@
#include "base/utf_string_conversions.h"
#include "googleurl/src/gurl.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebFileInfo.h"
-#include "third_party/WebKit/Source/Platform/chromium/public/WebFileSystem.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebString.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemCallbacks.h"
#include "webkit/base/file_path_string_conversions.h"
@@ -27,58 +26,52 @@ using WebKit::WebVector;
namespace content {
-WebFileSystemCallbackDispatcher::WebFileSystemCallbackDispatcher(
- WebFileSystemCallbacks* callbacks)
- : callbacks_(callbacks) {
- DCHECK(callbacks_);
+void FileStatusCallbackAdapter(
+ WebKit::WebFileSystemCallbacks* callbacks,
+ base::PlatformFileError error) {
+ if (error == base::PLATFORM_FILE_OK)
+ callbacks->didSucceed();
+ else
+ callbacks->didFail(::fileapi::PlatformFileErrorToWebFileError(error));
}
-void WebFileSystemCallbackDispatcher::DidSucceed() {
- callbacks_->didSucceed();
-}
-
-void WebFileSystemCallbackDispatcher::DidReadMetadata(
+void ReadMetadataCallbackAdapter(
+ WebKit::WebFileSystemCallbacks* callbacks,
const base::PlatformFileInfo& file_info,
const base::FilePath& platform_path) {
WebFileInfo web_file_info;
webkit_glue::PlatformFileInfoToWebFileInfo(file_info, &web_file_info);
web_file_info.platformPath = webkit_base::FilePathToWebString(platform_path);
- callbacks_->didReadMetadata(web_file_info);
+ callbacks->didReadMetadata(web_file_info);
}
-void WebFileSystemCallbackDispatcher::DidCreateSnapshotFile(
+void CreateSnapshotFileCallbackAdapter(
+ WebKit::WebFileSystemCallbacks* callbacks,
const base::PlatformFileInfo& file_info,
const base::FilePath& platform_path) {
WebFileInfo web_file_info;
webkit_glue::PlatformFileInfoToWebFileInfo(file_info, &web_file_info);
web_file_info.platformPath = webkit_base::FilePathToWebString(platform_path);
- callbacks_->didCreateSnapshotFile(web_file_info);
+ callbacks->didCreateSnapshotFile(web_file_info);
}
-void WebFileSystemCallbackDispatcher::DidReadDirectory(
- const std::vector<base::FileUtilProxy::Entry>& entries, bool has_more) {
+void ReadDirectoryCallbackAdapater(
+ WebKit::WebFileSystemCallbacks* callbacks,
+ const std::vector<base::FileUtilProxy::Entry>& entries,
+ bool has_more) {
WebVector<WebFileSystemEntry> file_system_entries(entries.size());
for (size_t i = 0; i < entries.size(); i++) {
file_system_entries[i].name =
webkit_base::FilePathStringToWebString(entries[i].name);
file_system_entries[i].isDirectory = entries[i].is_directory;
}
- callbacks_->didReadDirectory(file_system_entries, has_more);
+ callbacks->didReadDirectory(file_system_entries, has_more);
}
-void WebFileSystemCallbackDispatcher::DidOpenFileSystem(
+void OpenFileSystemCallbackAdapter(
+ WebKit::WebFileSystemCallbacks* callbacks,
const std::string& name, const GURL& root) {
- callbacks_->didOpenFileSystem(UTF8ToUTF16(name), root);
-}
-
-void WebFileSystemCallbackDispatcher::DidFail(
- base::PlatformFileError error_code) {
- callbacks_->didFail(
- fileapi::PlatformFileErrorToWebFileError(error_code));
-}
-
-void WebFileSystemCallbackDispatcher::DidWrite(int64 bytes, bool complete) {
- NOTREACHED();
+ callbacks->didOpenFileSystem(UTF8ToUTF16(name), root);
}
} // namespace content
diff --git a/content/common/fileapi/webfilesystem_callback_adapters.h b/content/common/fileapi/webfilesystem_callback_adapters.h
new file mode 100644
index 0000000..8f2c699
--- /dev/null
+++ b/content/common/fileapi/webfilesystem_callback_adapters.h
@@ -0,0 +1,45 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_COMMON_FILEAPI_WEBFILESYSTEM_CALLBACK_ADAPTERS_H_
+#define CONTENT_COMMON_FILEAPI_WEBFILESYSTEM_CALLBACK_ADAPTERS_H_
+
+#include "base/basictypes.h"
+#include "base/files/file_util_proxy.h"
+#include "base/platform_file.h"
+
+class GURL;
+
+namespace WebKit {
+class WebFileSystemCallbacks;
+}
+
+namespace content {
+
+void FileStatusCallbackAdapter(
+ WebKit::WebFileSystemCallbacks* callbacks,
+ base::PlatformFileError error);
+
+void ReadMetadataCallbackAdapter(
+ WebKit::WebFileSystemCallbacks* callbacks,
+ const base::PlatformFileInfo& file_info,
+ const base::FilePath& platform_path);
+
+void CreateSnapshotFileCallbackAdapter(
+ WebKit::WebFileSystemCallbacks* callbacks,
+ const base::PlatformFileInfo& file_info,
+ const base::FilePath& platform_path);
+
+void ReadDirectoryCallbackAdapater(
+ WebKit::WebFileSystemCallbacks* callbacks,
+ const std::vector<base::FileUtilProxy::Entry>& entries,
+ bool has_more);
+
+void OpenFileSystemCallbackAdapter(
+ WebKit::WebFileSystemCallbacks* callbacks,
+ const std::string& name, const GURL& root);
+
+} // namespace content
+
+#endif // CONTENT_COMMON_FILEAPI_WEBFILESYSTEM_CALLBACK_ADAPTERS_H_
diff --git a/content/common/fileapi/webfilesystem_callback_dispatcher.h b/content/common/fileapi/webfilesystem_callback_dispatcher.h
deleted file mode 100644
index ce2178b..0000000
--- a/content/common/fileapi/webfilesystem_callback_dispatcher.h
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CONTENT_COMMON_FILEAPI_WEBFILESYSTEM_CALLBACK_DISPATCHER_H_
-#define CONTENT_COMMON_FILEAPI_WEBFILESYSTEM_CALLBACK_DISPATCHER_H_
-
-#include "base/basictypes.h"
-#include "base/platform_file.h"
-#include "webkit/fileapi/file_system_callback_dispatcher.h"
-
-class GURL;
-
-namespace WebKit {
-class WebFileSystemCallbacks;
-}
-
-namespace content {
-
-class WebFileSystemCallbackDispatcher
- : public fileapi::FileSystemCallbackDispatcher {
- public:
- explicit WebFileSystemCallbackDispatcher(
- WebKit::WebFileSystemCallbacks* callbacks);
-
- // FileSystemCallbackDispatcher implementation
- virtual void DidSucceed() OVERRIDE;
- virtual void DidReadMetadata(
- const base::PlatformFileInfo& file_info,
- const base::FilePath& platform_path) OVERRIDE;
- virtual void DidCreateSnapshotFile(
- const base::PlatformFileInfo& file_info,
- const base::FilePath& platform_path) OVERRIDE;
- virtual void DidReadDirectory(
- const std::vector<base::FileUtilProxy::Entry>& entries,
- bool has_more) OVERRIDE;
- virtual void DidOpenFileSystem(const std::string&,
- const GURL&) OVERRIDE;
- virtual void DidFail(base::PlatformFileError) OVERRIDE;
- virtual void DidWrite(int64 bytes, bool complete) OVERRIDE;
-
- private:
- WebKit::WebFileSystemCallbacks* callbacks_;
-};
-
-} // namespace content
-
-#endif // CONTENT_COMMON_FILEAPI_WEBFILESYSTEM_CALLBACK_DISPATCHER_H_
diff --git a/content/common/fileapi/webfilesystem_impl.cc b/content/common/fileapi/webfilesystem_impl.cc
index 0fcd7a3..479484b 100644
--- a/content/common/fileapi/webfilesystem_impl.cc
+++ b/content/common/fileapi/webfilesystem_impl.cc
@@ -4,9 +4,10 @@
#include "content/common/fileapi/webfilesystem_impl.h"
+#include "base/bind.h"
#include "content/common/child_thread.h"
#include "content/common/fileapi/file_system_dispatcher.h"
-#include "content/common/fileapi/webfilesystem_callback_dispatcher.h"
+#include "content/common/fileapi/webfilesystem_callback_adapters.h"
#include "content/common/fileapi/webfilewriter_impl.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebFileInfo.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebString.h"
@@ -33,7 +34,7 @@ void WebFileSystemImpl::move(const WebURL& src_path,
ChildThread::current()->file_system_dispatcher();
dispatcher->Move(GURL(src_path),
GURL(dest_path),
- new WebFileSystemCallbackDispatcher(callbacks));
+ base::Bind(&FileStatusCallbackAdapter, callbacks));
}
void WebFileSystemImpl::copy(const WebURL& src_path,
@@ -43,33 +44,37 @@ void WebFileSystemImpl::copy(const WebURL& src_path,
ChildThread::current()->file_system_dispatcher();
dispatcher->Copy(GURL(src_path),
GURL(dest_path),
- new WebFileSystemCallbackDispatcher(callbacks));
+ base::Bind(&FileStatusCallbackAdapter, callbacks));
}
void WebFileSystemImpl::remove(const WebURL& path,
WebFileSystemCallbacks* callbacks) {
FileSystemDispatcher* dispatcher =
ChildThread::current()->file_system_dispatcher();
- dispatcher->Remove(GURL(path),
- false /* recursive */,
- new WebFileSystemCallbackDispatcher(callbacks));
+ dispatcher->Remove(
+ GURL(path),
+ false /* recursive */,
+ base::Bind(&FileStatusCallbackAdapter, callbacks));
}
void WebFileSystemImpl::removeRecursively(const WebURL& path,
WebFileSystemCallbacks* callbacks) {
FileSystemDispatcher* dispatcher =
ChildThread::current()->file_system_dispatcher();
- dispatcher->Remove(GURL(path),
- true /* recursive */,
- new WebFileSystemCallbackDispatcher(callbacks));
+ dispatcher->Remove(
+ GURL(path),
+ true /* recursive */,
+ base::Bind(&FileStatusCallbackAdapter, callbacks));
}
void WebFileSystemImpl::readMetadata(const WebURL& path,
WebFileSystemCallbacks* callbacks) {
FileSystemDispatcher* dispatcher =
ChildThread::current()->file_system_dispatcher();
- dispatcher->ReadMetadata(GURL(path),
- new WebFileSystemCallbackDispatcher(callbacks));
+ dispatcher->ReadMetadata(
+ GURL(path),
+ base::Bind(&ReadMetadataCallbackAdapter, callbacks),
+ base::Bind(&FileStatusCallbackAdapter, callbacks));
}
void WebFileSystemImpl::createFile(const WebURL& path,
@@ -77,8 +82,9 @@ void WebFileSystemImpl::createFile(const WebURL& path,
WebFileSystemCallbacks* callbacks) {
FileSystemDispatcher* dispatcher =
ChildThread::current()->file_system_dispatcher();
- dispatcher->Create(GURL(path), exclusive, false,
- false, new WebFileSystemCallbackDispatcher(callbacks));
+ dispatcher->Create(
+ GURL(path), exclusive, false /* directory */, false /* recursive */,
+ base::Bind(&FileStatusCallbackAdapter, callbacks));
}
void WebFileSystemImpl::createDirectory(const WebURL& path,
@@ -86,32 +92,37 @@ void WebFileSystemImpl::createDirectory(const WebURL& path,
WebFileSystemCallbacks* callbacks) {
FileSystemDispatcher* dispatcher =
ChildThread::current()->file_system_dispatcher();
- dispatcher->Create(GURL(path), exclusive, true,
- false, new WebFileSystemCallbackDispatcher(callbacks));
+ dispatcher->Create(
+ GURL(path), exclusive, true /* directory */, false /* recursive */,
+ base::Bind(&FileStatusCallbackAdapter, callbacks));
}
void WebFileSystemImpl::fileExists(const WebURL& path,
WebFileSystemCallbacks* callbacks) {
FileSystemDispatcher* dispatcher =
ChildThread::current()->file_system_dispatcher();
- dispatcher->Exists(GURL(path), false,
- new WebFileSystemCallbackDispatcher(callbacks));
+ dispatcher->Exists(
+ GURL(path), false /* directory */,
+ base::Bind(&FileStatusCallbackAdapter, callbacks));
}
void WebFileSystemImpl::directoryExists(const WebURL& path,
WebFileSystemCallbacks* callbacks) {
FileSystemDispatcher* dispatcher =
ChildThread::current()->file_system_dispatcher();
- dispatcher->Exists(GURL(path), true,
- new WebFileSystemCallbackDispatcher(callbacks));
+ dispatcher->Exists(
+ GURL(path), true /* directory */,
+ base::Bind(&FileStatusCallbackAdapter, callbacks));
}
void WebFileSystemImpl::readDirectory(const WebURL& path,
WebFileSystemCallbacks* callbacks) {
FileSystemDispatcher* dispatcher =
ChildThread::current()->file_system_dispatcher();
- dispatcher->ReadDirectory(GURL(path),
- new WebFileSystemCallbackDispatcher(callbacks));
+ dispatcher->ReadDirectory(
+ GURL(path),
+ base::Bind(&ReadDirectoryCallbackAdapater, callbacks),
+ base::Bind(&FileStatusCallbackAdapter, callbacks));
}
WebKit::WebFileWriter* WebFileSystemImpl::createFileWriter(
@@ -125,7 +136,9 @@ void WebFileSystemImpl::createSnapshotFileAndReadMetadata(
FileSystemDispatcher* dispatcher =
ChildThread::current()->file_system_dispatcher();
dispatcher->CreateSnapshotFile(
- GURL(path), new WebFileSystemCallbackDispatcher(callbacks));
+ GURL(path),
+ base::Bind(&CreateSnapshotFileCallbackAdapter, callbacks),
+ base::Bind(&FileStatusCallbackAdapter, callbacks));
}
} // namespace content
diff --git a/content/common/fileapi/webfilewriter_impl.cc b/content/common/fileapi/webfilewriter_impl.cc
index ac685e1..fed77f5 100644
--- a/content/common/fileapi/webfilewriter_impl.cc
+++ b/content/common/fileapi/webfilewriter_impl.cc
@@ -4,60 +4,19 @@
#include "content/common/fileapi/webfilewriter_impl.h"
+#include "base/bind.h"
#include "content/common/child_thread.h"
#include "content/common/fileapi/file_system_dispatcher.h"
namespace content {
+
namespace {
inline FileSystemDispatcher* GetFileSystemDispatcher() {
return ChildThread::current()->file_system_dispatcher();
}
-}
-
-class WebFileWriterImpl::CallbackDispatcher
- : public fileapi::FileSystemCallbackDispatcher {
- public:
- explicit CallbackDispatcher(
- const base::WeakPtr<WebFileWriterImpl>& writer) : writer_(writer) {
- }
- virtual ~CallbackDispatcher() {
- }
- virtual void DidReadMetadata(
- const base::PlatformFileInfo&,
- const base::FilePath&) OVERRIDE {
- NOTREACHED();
- }
- virtual void DidCreateSnapshotFile(
- const base::PlatformFileInfo&,
- const base::FilePath&) OVERRIDE {
- NOTREACHED();
- }
- virtual void DidReadDirectory(
- const std::vector<base::FileUtilProxy::Entry>& entries,
- bool has_more) OVERRIDE {
- NOTREACHED();
- }
- virtual void DidOpenFileSystem(const std::string& name,
- const GURL& root) OVERRIDE {
- NOTREACHED();
- }
- virtual void DidSucceed() OVERRIDE {
- if (writer_)
- writer_->DidSucceed();
- }
- virtual void DidFail(base::PlatformFileError error_code) OVERRIDE {
- if (writer_)
- writer_->DidFail(error_code);
- }
- virtual void DidWrite(int64 bytes, bool complete) OVERRIDE {
- if (writer_)
- writer_->DidWrite(bytes, complete);
- }
- private:
- base::WeakPtr<WebFileWriterImpl> writer_;
-};
+} // namespace
WebFileWriterImpl::WebFileWriterImpl(
const GURL& path, WebKit::WebFileWriterClient* client)
@@ -70,20 +29,23 @@ WebFileWriterImpl::~WebFileWriterImpl() {
void WebFileWriterImpl::DoTruncate(const GURL& path, int64 offset) {
// The FileSystemDispatcher takes ownership of the CallbackDispatcher.
- GetFileSystemDispatcher()->Truncate(path, offset, &request_id_,
- new CallbackDispatcher(AsWeakPtr()));
+ GetFileSystemDispatcher()->Truncate(
+ path, offset, &request_id_,
+ base::Bind(&WebFileWriterImpl::DidFinish, AsWeakPtr()));
}
void WebFileWriterImpl::DoWrite(
const GURL& path, const GURL& blob_url, int64 offset) {
GetFileSystemDispatcher()->Write(
path, blob_url, offset, &request_id_,
- new CallbackDispatcher(AsWeakPtr()));
+ base::Bind(&WebFileWriterImpl::DidWrite, AsWeakPtr()),
+ base::Bind(&WebFileWriterImpl::DidFinish, AsWeakPtr()));
}
void WebFileWriterImpl::DoCancel() {
- GetFileSystemDispatcher()->Cancel(request_id_,
- new CallbackDispatcher(AsWeakPtr()));
+ GetFileSystemDispatcher()->Cancel(
+ request_id_,
+ base::Bind(&WebFileWriterImpl::DidFinish, AsWeakPtr()));
}
} // namespace content
diff --git a/content/content_common.gypi b/content/content_common.gypi
index d08f75e..cab1c9d 100644
--- a/content/content_common.gypi
+++ b/content/content_common.gypi
@@ -167,19 +167,19 @@
'common/drag_messages.h',
'common/drag_traits.h',
'common/edit_command.h',
+ 'common/file_utilities_messages.h',
'common/fileapi/file_system_dispatcher.cc',
'common/fileapi/file_system_dispatcher.h',
'common/fileapi/file_system_messages.h',
'common/fileapi/webblob_messages.h',
'common/fileapi/webblobregistry_impl.cc',
'common/fileapi/webblobregistry_impl.h',
- 'common/fileapi/webfilesystem_callback_dispatcher.cc',
- 'common/fileapi/webfilesystem_callback_dispatcher.h',
+ 'common/fileapi/webfilesystem_callback_adapters.cc',
+ 'common/fileapi/webfilesystem_callback_adapters.h',
'common/fileapi/webfilesystem_impl.cc',
'common/fileapi/webfilesystem_impl.h',
'common/fileapi/webfilewriter_impl.cc',
'common/fileapi/webfilewriter_impl.h',
- 'common/file_utilities_messages.h',
'common/find_match_rect_android.cc',
'common/find_match_rect_android.h',
'common/font_cache_dispatcher_win.cc',
diff --git a/content/content_renderer.gypi b/content/content_renderer.gypi
index fe7c6a0..b3ee0bf 100644
--- a/content/content_renderer.gypi
+++ b/content/content_renderer.gypi
@@ -180,8 +180,6 @@
'renderer/password_form_conversion_utils.cc',
'renderer/pepper/content_renderer_pepper_host_factory.cc',
'renderer/pepper/content_renderer_pepper_host_factory.h',
- 'renderer/pepper/null_file_system_callback_dispatcher.cc',
- 'renderer/pepper/null_file_system_callback_dispatcher.h',
'renderer/pepper/pepper_audio_input_host.cc',
'renderer/pepper/pepper_audio_input_host.h',
'renderer/pepper/pepper_broker_impl.cc',
diff --git a/content/renderer/pepper/null_file_system_callback_dispatcher.cc b/content/renderer/pepper/null_file_system_callback_dispatcher.cc
deleted file mode 100644
index 0c8d6a3..0000000
--- a/content/renderer/pepper/null_file_system_callback_dispatcher.cc
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "content/renderer/pepper/null_file_system_callback_dispatcher.h"
-
-#include "base/files/file_path.h"
-#include "base/files/file_util_proxy.h"
-#include "base/logging.h"
-#include "googleurl/src/gurl.h"
-
-namespace content {
-
-void NullFileSystemCallbackDispatcher::DidSucceed() {
- NOTREACHED();
-}
-
-void NullFileSystemCallbackDispatcher::DidReadMetadata(
- const base::PlatformFileInfo& /* file_info */,
- const base::FilePath& /* platform_path */) {
- NOTREACHED();
-}
-
-void NullFileSystemCallbackDispatcher::DidCreateSnapshotFile(
- const base::PlatformFileInfo& /* file_info */,
- const base::FilePath& /* platform_path */) {
- NOTREACHED();
-}
-
-void NullFileSystemCallbackDispatcher::DidReadDirectory(
- const std::vector<base::FileUtilProxy::Entry>& /* entries */,
- bool /* has_more */) {
- NOTREACHED();
-}
-
-void NullFileSystemCallbackDispatcher::DidOpenFileSystem(
- const std::string& /* name */,
- const GURL& /* root */) {
- NOTREACHED();
-}
-
-void NullFileSystemCallbackDispatcher::DidWrite(int64 /* bytes */,
- bool /* complete */) {
- NOTREACHED();
-}
-
-void NullFileSystemCallbackDispatcher::DidOpenFile(
- base::PlatformFile /* file */,
- int /* file_open_id */,
- quota::QuotaLimitType /* quota_policy */) {
- NOTREACHED();
-}
-
-void NullFileSystemCallbackDispatcher::DidFail(
- base::PlatformFileError /* platform_error */) {
- NOTREACHED();
-}
-
-} // namespace content
diff --git a/content/renderer/pepper/null_file_system_callback_dispatcher.h b/content/renderer/pepper/null_file_system_callback_dispatcher.h
deleted file mode 100644
index 1031948..0000000
--- a/content/renderer/pepper/null_file_system_callback_dispatcher.h
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CONTENT_RENDERER_PEPPER_NULL_FILE_SYSTEM_CALLBACK_DISPATCHER_H_
-#define CONTENT_RENDERER_PEPPER_NULL_FILE_SYSTEM_CALLBACK_DISPATCHER_H_
-
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/platform_file.h"
-#include "webkit/fileapi/file_system_callback_dispatcher.h"
-#include "webkit/quota/quota_types.h"
-
-class GURL;
-
-namespace base {
-class FilePath;
-class FileUtilProxy;
-struct PlatformFileInfo;
-} // namespace base
-
-namespace content {
-
-class NullFileSystemCallbackDispatcher
- : public fileapi::FileSystemCallbackDispatcher {
- public:
- NullFileSystemCallbackDispatcher() {}
-
- virtual ~NullFileSystemCallbackDispatcher(){}
-
- virtual void DidSucceed() OVERRIDE;
- virtual void DidReadMetadata(const base::PlatformFileInfo& file_info,
- const base::FilePath& platform_path) OVERRIDE;
- virtual void DidCreateSnapshotFile(
- const base::PlatformFileInfo& file_info,
- const base::FilePath& platform_path) OVERRIDE;
- virtual void DidReadDirectory(
- const std::vector<base::FileUtilProxy::Entry>& entries,
- bool has_more) OVERRIDE;
- virtual void DidOpenFileSystem(const std::string& name,
- const GURL& root) OVERRIDE;
- virtual void DidWrite(int64 bytes, bool complete) OVERRIDE;
- virtual void DidOpenFile(base::PlatformFile file,
- int file_open_id,
- quota::QuotaLimitType quota_policy) OVERRIDE;
- virtual void DidFail(base::PlatformFileError platform_error) OVERRIDE;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(NullFileSystemCallbackDispatcher);
-};
-
-} // namespace content
-
-#endif // CONTENT_RENDERER_PEPPER_NULL_FILE_SYSTEM_CALLBACK_DISPATCHER_H_
diff --git a/content/renderer/pepper/pepper_file_io_host.cc b/content/renderer/pepper/pepper_file_io_host.cc
index 48dd502..d92dd69 100644
--- a/content/renderer/pepper/pepper_file_io_host.cc
+++ b/content/renderer/pepper/pepper_file_io_host.cc
@@ -11,7 +11,6 @@
#include "base/files/file_util_proxy.h"
#include "content/public/common/content_client.h"
#include "content/public/renderer/content_renderer_client.h"
-#include "content/renderer/pepper/null_file_system_callback_dispatcher.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/host/dispatch_host_message.h"
#include "ppapi/host/ppapi_host.h"
@@ -19,7 +18,6 @@
#include "ppapi/shared_impl/file_type_conversion.h"
#include "ppapi/shared_impl/time_conversion.h"
#include "ppapi/thunk/enter.h"
-#include "webkit/plugins/ppapi/file_callbacks.h"
#include "webkit/plugins/ppapi/host_globals.h"
#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
#include "webkit/plugins/ppapi/ppb_file_ref_impl.h"
@@ -47,27 +45,6 @@ static const int32_t kMaxReadSize = 32 * 1024 * 1024; // 32MB
typedef base::Callback<void (base::PlatformFileError)> PlatformGeneralCallback;
-class PlatformGeneralCallbackTranslator
- : public NullFileSystemCallbackDispatcher {
- public:
- explicit PlatformGeneralCallbackTranslator(
- const PlatformGeneralCallback& callback)
- : callback_(callback) {}
-
- virtual ~PlatformGeneralCallbackTranslator() {}
-
- virtual void DidSucceed() OVERRIDE {
- callback_.Run(base::PLATFORM_FILE_OK);
- }
-
- virtual void DidFail(base::PlatformFileError platform_error) OVERRIDE {
- callback_.Run(platform_error);
- }
-
- private:
- PlatformGeneralCallback callback_;
-};
-
int32_t ErrorOrByteNumber(int32_t pp_error, int32_t byte_number) {
// On the plugin side, some callbacks expect a parameter that means different
// things depending on whether is negative or not. We translate for those
@@ -222,10 +199,9 @@ int32_t PepperFileIOHost::OnHostMsgTouch(
file_system_url_,
PPTimeToTime(last_access_time),
PPTimeToTime(last_modified_time),
- new PlatformGeneralCallbackTranslator(
- base::Bind(&PepperFileIOHost::ExecutePlatformGeneralCallback,
- weak_factory_.GetWeakPtr(),
- context->MakeReplyMessageContext()))))
+ base::Bind(&PepperFileIOHost::ExecutePlatformGeneralCallback,
+ weak_factory_.GetWeakPtr(),
+ context->MakeReplyMessageContext())))
return PP_ERROR_FAILED;
state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_EXCLUSIVE);
return PP_OK_COMPLETIONPENDING;
@@ -327,10 +303,9 @@ int32_t PepperFileIOHost::OnHostMsgSetLength(
if (file_system_type_ != PP_FILESYSTEMTYPE_EXTERNAL) {
if (!plugin_delegate_->SetLength(
file_system_url_, length,
- new PlatformGeneralCallbackTranslator(
- base::Bind(&PepperFileIOHost::ExecutePlatformGeneralCallback,
- weak_factory_.GetWeakPtr(),
- context->MakeReplyMessageContext()))))
+ base::Bind(&PepperFileIOHost::ExecutePlatformGeneralCallback,
+ weak_factory_.GetWeakPtr(),
+ context->MakeReplyMessageContext())))
return PP_ERROR_FAILED;
} else {
// TODO(nhiroki): fix a failure of FileIO.SetLength for an external
diff --git a/content/renderer/pepper/pepper_file_system_host.cc b/content/renderer/pepper/pepper_file_system_host.cc
index 13bff9a..ac36cd0 100644
--- a/content/renderer/pepper/pepper_file_system_host.cc
+++ b/content/renderer/pepper/pepper_file_system_host.cc
@@ -10,7 +10,6 @@
#include "content/common/fileapi/file_system_dispatcher.h"
#include "content/public/renderer/render_view.h"
#include "content/public/renderer/renderer_ppapi_host.h"
-#include "content/renderer/pepper/null_file_system_callback_dispatcher.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/host/dispatch_host_message.h"
#include "ppapi/host/ppapi_host.h"
@@ -28,31 +27,6 @@ namespace content {
namespace {
-class PlatformCallbackAdaptor : public NullFileSystemCallbackDispatcher {
- public:
- explicit PlatformCallbackAdaptor(
- const base::WeakPtr<PepperFileSystemHost>& weak_host)
- : weak_host_(weak_host) {}
-
- virtual ~PlatformCallbackAdaptor() {}
-
- virtual void DidOpenFileSystem(const std::string& /* unused */,
- const GURL& root) OVERRIDE {
- if (weak_host_)
- weak_host_->OpenFileSystemReply(PP_OK, root);
- }
-
- virtual void DidFail(base::PlatformFileError platform_error) OVERRIDE {
- if (weak_host_) {
- weak_host_->OpenFileSystemReply(
- ppapi::PlatformFileErrorToPepperError(platform_error), GURL());
- }
- }
-
- private:
- base::WeakPtr<PepperFileSystemHost> weak_host_;
-};
-
bool LooksLikeAGuid(const std::string& fsid) {
const size_t kExpectedFsIdSize = 32;
if (fsid.size() != kExpectedFsIdSize)
@@ -97,13 +71,22 @@ int32_t PepperFileSystemHost::OnResourceMessageReceived(
return PP_ERROR_FAILED;
}
-void PepperFileSystemHost::OpenFileSystemReply(int32_t pp_error,
- const GURL& root) {
- opened_ = (pp_error == PP_OK);
+void PepperFileSystemHost::DidOpenFileSystem(
+ const std::string& /* name_unused */,
+ const GURL& root) {
+ opened_ = true;
root_url_ = root;
+ reply_context_.params.set_result(PP_OK);
+ host()->SendReply(reply_context_, PpapiPluginMsg_FileSystem_OpenReply());
+ reply_context_ = ppapi::host::ReplyMessageContext();
+}
+
+void PepperFileSystemHost::DidFailOpenFileSystem(
+ base::PlatformFileError error) {
+ int32 pp_error = ppapi::PlatformFileErrorToPepperError(error);
+ opened_ = (pp_error == PP_OK);
reply_context_.params.set_result(pp_error);
- host()->SendReply(reply_context_,
- PpapiPluginMsg_FileSystem_OpenReply());
+ host()->SendReply(reply_context_, PpapiPluginMsg_FileSystem_OpenReply());
reply_context_ = ppapi::host::ReplyMessageContext();
}
@@ -142,7 +125,10 @@ int32_t PepperFileSystemHost::OnHostMsgOpen(
GURL(plugin_instance->container()->element().document().url()).
GetOrigin(),
file_system_type, expected_size, true /* create */,
- new PlatformCallbackAdaptor(weak_factory_.GetWeakPtr()))) {
+ base::Bind(&PepperFileSystemHost::DidOpenFileSystem,
+ weak_factory_.GetWeakPtr()),
+ base::Bind(&PepperFileSystemHost::DidFailOpenFileSystem,
+ weak_factory_.GetWeakPtr()))) {
return PP_ERROR_FAILED;
}
diff --git a/content/renderer/pepper/pepper_file_system_host.h b/content/renderer/pepper/pepper_file_system_host.h
index 90ba4e0..6a9101a 100644
--- a/content/renderer/pepper/pepper_file_system_host.h
+++ b/content/renderer/pepper/pepper_file_system_host.h
@@ -36,11 +36,11 @@ class PepperFileSystemHost :
bool IsOpened() const { return opened_; }
GURL GetRootUrl() const { return root_url_; }
- // It's public only to allow PlatformCallbackAdaptor to access.
- void OpenFileSystemReply(int32_t pp_error,
- const GURL& root);
-
private:
+ // Callback for OpenFileSystem.
+ void DidOpenFileSystem(const std::string& name_unused, const GURL& root);
+ void DidFailOpenFileSystem(base::PlatformFileError error);
+
int32_t OnHostMsgOpen(ppapi::host::HostMessageContext* context,
int64_t expected_size);
int32_t OnHostMsgInitIsolatedFileSystem(
diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.cc b/content/renderer/pepper/pepper_plugin_delegate_impl.cc
index a3625b8..c38968f 100644
--- a/content/renderer/pepper/pepper_plugin_delegate_impl.cc
+++ b/content/renderer/pepper/pepper_plugin_delegate_impl.cc
@@ -90,7 +90,6 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
#include "ui/gfx/size.h"
-#include "webkit/fileapi/file_system_callback_dispatcher.h"
#include "webkit/plugins/npapi/webplugin.h"
#include "webkit/plugins/ppapi/plugin_module.h"
#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
@@ -268,70 +267,34 @@ void DoNotifyCloseFile(int file_open_id, base::PlatformFileError /* unused */) {
file_open_id);
}
-class AsyncOpenFileSystemURLCallbackTranslator
- : public fileapi::FileSystemCallbackDispatcher {
- public:
- AsyncOpenFileSystemURLCallbackTranslator(
- const webkit::ppapi::PluginDelegate::AsyncOpenFileSystemURLCallback&
- callback)
- : callback_(callback) {
- }
-
- virtual ~AsyncOpenFileSystemURLCallbackTranslator() {}
-
- virtual void DidSucceed() OVERRIDE {
- NOTREACHED();
- }
- virtual void DidReadMetadata(
- const base::PlatformFileInfo& file_info,
- const base::FilePath& platform_path) OVERRIDE {
- NOTREACHED();
- }
- virtual void DidCreateSnapshotFile(
- const base::PlatformFileInfo& file_info,
- const base::FilePath& platform_path) OVERRIDE {
- NOTREACHED();
- }
- virtual void DidReadDirectory(
- const std::vector<base::FileUtilProxy::Entry>& entries,
- bool has_more) OVERRIDE {
- NOTREACHED();
- }
- virtual void DidOpenFileSystem(const std::string& name,
- const GURL& root) OVERRIDE {
- NOTREACHED();
- }
-
- virtual void DidFail(base::PlatformFileError error_code) OVERRIDE {
- base::PlatformFile invalid_file = base::kInvalidPlatformFileValue;
- callback_.Run(error_code,
- base::PassPlatformFile(&invalid_file),
- quota::kQuotaLimitTypeUnknown,
- webkit::ppapi::PluginDelegate::NotifyCloseFileCallback());
- }
-
- virtual void DidWrite(int64 bytes, bool complete) OVERRIDE {
- NOTREACHED();
- }
-
- virtual void DidOpenFile(base::PlatformFile file,
- int file_open_id,
- quota::QuotaLimitType quota_policy) OVERRIDE {
- callback_.Run(base::PLATFORM_FILE_OK,
- base::PassPlatformFile(&file),
- quota_policy,
- base::Bind(&DoNotifyCloseFile, file_open_id));
- // Make sure we won't leak file handle if the requester has died.
- if (file != base::kInvalidPlatformFileValue) {
- base::FileUtilProxy::Close(
- RenderThreadImpl::current()->GetFileThreadMessageLoopProxy(), file,
- base::Bind(&DoNotifyCloseFile, file_open_id));
- }
+void DidOpenFileSystemURL(
+ const webkit::ppapi::PluginDelegate::AsyncOpenFileSystemURLCallback&
+ callback,
+ base::PlatformFile file,
+ int file_open_id,
+ quota::QuotaLimitType quota_policy) {
+ callback.Run(base::PLATFORM_FILE_OK,
+ base::PassPlatformFile(&file),
+ quota_policy,
+ base::Bind(&DoNotifyCloseFile, file_open_id));
+ // Make sure we won't leak file handle if the requester has died.
+ if (file != base::kInvalidPlatformFileValue) {
+ base::FileUtilProxy::Close(
+ RenderThreadImpl::current()->GetFileThreadMessageLoopProxy(), file,
+ base::Bind(&DoNotifyCloseFile, file_open_id));
}
+}
- private:
- webkit::ppapi::PluginDelegate::AsyncOpenFileSystemURLCallback callback_;
-};
+void DidFailOpenFileSystemURL(
+ const webkit::ppapi::PluginDelegate::AsyncOpenFileSystemURLCallback&
+ callback,
+ base::PlatformFileError error_code) {
+ base::PlatformFile invalid_file = base::kInvalidPlatformFileValue;
+ callback.Run(error_code,
+ base::PassPlatformFile(&invalid_file),
+ quota::kQuotaLimitTypeUnknown,
+ webkit::ppapi::PluginDelegate::NotifyCloseFileCallback());
+}
void CreateHostForInProcessModule(RenderViewImpl* render_view,
webkit::ppapi::PluginModule* module,
@@ -1060,73 +1023,78 @@ GURL PepperPluginDelegateImpl::GetFileSystemRootUrl(
bool PepperPluginDelegateImpl::MakeDirectory(
const GURL& path,
bool recursive,
- fileapi::FileSystemCallbackDispatcher* dispatcher) {
+ const StatusCallback& callback) {
FileSystemDispatcher* file_system_dispatcher =
ChildThread::current()->file_system_dispatcher();
return file_system_dispatcher->Create(
- path, false, true, recursive, dispatcher);
+ path, false, true, recursive, callback);
}
bool PepperPluginDelegateImpl::Query(
const GURL& path,
- fileapi::FileSystemCallbackDispatcher* dispatcher) {
+ const MetadataCallback& success_callback,
+ const StatusCallback& error_callback) {
FileSystemDispatcher* file_system_dispatcher =
ChildThread::current()->file_system_dispatcher();
- return file_system_dispatcher->ReadMetadata(path, dispatcher);
+ return file_system_dispatcher->ReadMetadata(
+ path, success_callback, error_callback);
}
bool PepperPluginDelegateImpl::ReadDirectoryEntries(
const GURL& path,
- fileapi::FileSystemCallbackDispatcher* dispatcher) {
+ const ReadDirectoryCallback& success_callback,
+ const StatusCallback& error_callback) {
FileSystemDispatcher* file_system_dispatcher =
ChildThread::current()->file_system_dispatcher();
- return file_system_dispatcher->ReadDirectory(path, dispatcher);
+ return file_system_dispatcher->ReadDirectory(
+ path, success_callback, error_callback);
}
bool PepperPluginDelegateImpl::Touch(
const GURL& path,
const base::Time& last_access_time,
const base::Time& last_modified_time,
- fileapi::FileSystemCallbackDispatcher* dispatcher) {
+ const StatusCallback& callback) {
FileSystemDispatcher* file_system_dispatcher =
ChildThread::current()->file_system_dispatcher();
return file_system_dispatcher->TouchFile(path, last_access_time,
- last_modified_time, dispatcher);
+ last_modified_time, callback);
}
bool PepperPluginDelegateImpl::SetLength(
const GURL& path,
int64_t length,
- fileapi::FileSystemCallbackDispatcher* dispatcher) {
+ const StatusCallback& callback) {
FileSystemDispatcher* file_system_dispatcher =
ChildThread::current()->file_system_dispatcher();
- return file_system_dispatcher->Truncate(path, length, NULL, dispatcher);
+ return file_system_dispatcher->Truncate(path, length, NULL, callback);
}
bool PepperPluginDelegateImpl::Delete(
const GURL& path,
- fileapi::FileSystemCallbackDispatcher* dispatcher) {
+ const StatusCallback& callback) {
FileSystemDispatcher* file_system_dispatcher =
ChildThread::current()->file_system_dispatcher();
- return file_system_dispatcher->Remove(path, false /* recursive */,
- dispatcher);
+ return file_system_dispatcher->Remove(path, false /* recursive */, callback);
}
bool PepperPluginDelegateImpl::Rename(
const GURL& file_path,
const GURL& new_file_path,
- fileapi::FileSystemCallbackDispatcher* dispatcher) {
+ const StatusCallback& callback) {
FileSystemDispatcher* file_system_dispatcher =
ChildThread::current()->file_system_dispatcher();
- return file_system_dispatcher->Move(file_path, new_file_path, dispatcher);
+ return file_system_dispatcher->Move(file_path, new_file_path, callback);
}
bool PepperPluginDelegateImpl::ReadDirectory(
const GURL& directory_path,
- fileapi::FileSystemCallbackDispatcher* dispatcher) {
+ const ReadDirectoryCallback& success_callback,
+ const StatusCallback& error_callback) {
FileSystemDispatcher* file_system_dispatcher =
ChildThread::current()->file_system_dispatcher();
- return file_system_dispatcher->ReadDirectory(directory_path, dispatcher);
+ return file_system_dispatcher->ReadDirectory(
+ directory_path, success_callback, error_callback);
}
void PepperPluginDelegateImpl::QueryAvailableSpace(
@@ -1151,9 +1119,10 @@ bool PepperPluginDelegateImpl::AsyncOpenFileSystemURL(
FileSystemDispatcher* file_system_dispatcher =
ChildThread::current()->file_system_dispatcher();
- return file_system_dispatcher->OpenFile(path, flags,
- new AsyncOpenFileSystemURLCallbackTranslator(
- callback));
+ return file_system_dispatcher->OpenFile(
+ path, flags,
+ base::Bind(&DidOpenFileSystemURL, callback),
+ base::Bind(&DidFailOpenFileSystemURL, callback));
}
void PepperPluginDelegateImpl::SyncGetFileSystemPlatformPath(
diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.h b/content/renderer/pepper/pepper_plugin_delegate_impl.h
index c694d54..40dabee 100644
--- a/content/renderer/pepper/pepper_plugin_delegate_impl.h
+++ b/content/renderer/pepper/pepper_plugin_delegate_impl.h
@@ -215,32 +215,35 @@ class PepperPluginDelegateImpl
virtual bool MakeDirectory(
const GURL& path,
bool recursive,
- fileapi::FileSystemCallbackDispatcher* dispatcher) OVERRIDE;
+ const StatusCallback& callback) OVERRIDE;
virtual bool Query(
const GURL& path,
- fileapi::FileSystemCallbackDispatcher* dispatcher) OVERRIDE;
+ const MetadataCallback& success_callback,
+ const StatusCallback& error_callback) OVERRIDE;
virtual bool ReadDirectoryEntries(
const GURL& path,
- fileapi::FileSystemCallbackDispatcher* dispatcher) OVERRIDE;
+ const ReadDirectoryCallback& success_callback,
+ const StatusCallback& error_callback) OVERRIDE;
virtual bool Touch(
const GURL& path,
const base::Time& last_access_time,
const base::Time& last_modified_time,
- fileapi::FileSystemCallbackDispatcher* dispatcher) OVERRIDE;
+ const StatusCallback& callback) OVERRIDE;
virtual bool SetLength(
const GURL& path,
int64_t length,
- fileapi::FileSystemCallbackDispatcher* dispatcher) OVERRIDE;
+ const StatusCallback& callback) OVERRIDE;
virtual bool Delete(
const GURL& path,
- fileapi::FileSystemCallbackDispatcher* dispatcher) OVERRIDE;
+ const StatusCallback& callback) OVERRIDE;
virtual bool Rename(
const GURL& file_path,
const GURL& new_file_path,
- fileapi::FileSystemCallbackDispatcher* dispatcher) OVERRIDE;
+ const StatusCallback& callback) OVERRIDE;
virtual bool ReadDirectory(
const GURL& directory_path,
- fileapi::FileSystemCallbackDispatcher* dispatcher) OVERRIDE;
+ const ReadDirectoryCallback& success_callback,
+ const StatusCallback& error_callback) OVERRIDE;
virtual void QueryAvailableSpace(
const GURL& origin,
quota::StorageType type,
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index 89dc702..079a5cf7 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -33,7 +33,7 @@
#include "content/common/database_messages.h"
#include "content/common/drag_messages.h"
#include "content/common/fileapi/file_system_dispatcher.h"
-#include "content/common/fileapi/webfilesystem_callback_dispatcher.h"
+#include "content/common/fileapi/webfilesystem_callback_adapters.h"
#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
#include "content/common/input_messages.h"
#include "content/common/java_bridge_messages.h"
@@ -4232,7 +4232,9 @@ void RenderViewImpl::openFileSystem(
ChildThread::current()->file_system_dispatcher()->OpenFileSystem(
GURL(origin.toString()), static_cast<fileapi::FileSystemType>(type),
- size, create, new WebFileSystemCallbackDispatcher(callbacks));
+ size, create,
+ base::Bind(&OpenFileSystemCallbackAdapter, callbacks),
+ base::Bind(&FileStatusCallbackAdapter, callbacks));
}
void RenderViewImpl::deleteFileSystem(
@@ -4251,7 +4253,7 @@ void RenderViewImpl::deleteFileSystem(
ChildThread::current()->file_system_dispatcher()->DeleteFileSystem(
GURL(origin.toString()),
static_cast<fileapi::FileSystemType>(type),
- new WebFileSystemCallbackDispatcher(callbacks));
+ base::Bind(&FileStatusCallbackAdapter, callbacks));
}
void RenderViewImpl::queryStorageUsageAndQuota(
diff --git a/content/worker/websharedworkerclient_proxy.cc b/content/worker/websharedworkerclient_proxy.cc
index 4db74b8..d079171 100644
--- a/content/worker/websharedworkerclient_proxy.cc
+++ b/content/worker/websharedworkerclient_proxy.cc
@@ -8,7 +8,7 @@
#include "base/command_line.h"
#include "base/message_loop.h"
#include "content/common/fileapi/file_system_dispatcher.h"
-#include "content/common/fileapi/webfilesystem_callback_dispatcher.h"
+#include "content/common/fileapi/webfilesystem_callback_adapters.h"
#include "content/common/quota_dispatcher.h"
#include "content/common/webmessageportchannel_impl.h"
#include "content/common/worker_messages.h"
@@ -168,7 +168,9 @@ void WebSharedWorkerClientProxy::openFileSystem(
WebKit::WebFileSystemCallbacks* callbacks) {
ChildThread::current()->file_system_dispatcher()->OpenFileSystem(
stub_->url().GetOrigin(), static_cast<fileapi::FileSystemType>(type),
- size, create, new WebFileSystemCallbackDispatcher(callbacks));
+ size, create,
+ base::Bind(&OpenFileSystemCallbackAdapter, callbacks),
+ base::Bind(&FileStatusCallbackAdapter, callbacks));
}
bool WebSharedWorkerClientProxy::allowIndexedDB(const WebKit::WebString& name) {