| Index: content/common/fileapi/webfilesystem_impl.cc
|
| diff --git a/content/common/fileapi/webfilesystem_impl.cc b/content/common/fileapi/webfilesystem_impl.cc
|
| index 0fcd7a3c2a5c5da78e8d819028a99337b298ccdc..49240ba0fd6cd450d436753e5ae608ba7641b7a4 100644
|
| --- a/content/common/fileapi/webfilesystem_impl.cc
|
| +++ b/content/common/fileapi/webfilesystem_impl.cc
|
| @@ -4,6 +4,7 @@
|
|
|
| #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"
|
| @@ -23,6 +24,8 @@ using WebKit::WebVector;
|
|
|
| namespace content {
|
|
|
| +typedef WebFileSystemCallbackDispatcher CallbackDispatcher;
|
| +
|
| WebFileSystemImpl::WebFileSystemImpl() {
|
| }
|
|
|
| @@ -33,7 +36,8 @@ 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(&CallbackDispatcher::DidFinish,
|
| + base::Owned(new CallbackDispatcher(callbacks))));
|
| }
|
|
|
| void WebFileSystemImpl::copy(const WebURL& src_path,
|
| @@ -43,33 +47,40 @@ 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(&CallbackDispatcher::DidFinish,
|
| + base::Owned(new CallbackDispatcher(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(&CallbackDispatcher::DidFinish,
|
| + base::Owned(new CallbackDispatcher(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(&CallbackDispatcher::DidFinish,
|
| + base::Owned(new CallbackDispatcher(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(&CallbackDispatcher::DidReadMetadata,
|
| + base::Owned(new CallbackDispatcher(callbacks))));
|
| }
|
|
|
| void WebFileSystemImpl::createFile(const WebURL& path,
|
| @@ -77,8 +88,10 @@ 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(&CallbackDispatcher::DidFinish,
|
| + base::Owned(new CallbackDispatcher(callbacks))));
|
| }
|
|
|
| void WebFileSystemImpl::createDirectory(const WebURL& path,
|
| @@ -86,32 +99,40 @@ 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(&CallbackDispatcher::DidFinish,
|
| + base::Owned(new CallbackDispatcher(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(&CallbackDispatcher::DidFinish,
|
| + base::Owned(new CallbackDispatcher(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(&CallbackDispatcher::DidFinish,
|
| + base::Owned(new CallbackDispatcher(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(&CallbackDispatcher::DidReadDirectory,
|
| + base::Owned(new CallbackDispatcher(callbacks))));
|
| }
|
|
|
| WebKit::WebFileWriter* WebFileSystemImpl::createFileWriter(
|
| @@ -125,7 +146,9 @@ void WebFileSystemImpl::createSnapshotFileAndReadMetadata(
|
| FileSystemDispatcher* dispatcher =
|
| ChildThread::current()->file_system_dispatcher();
|
| dispatcher->CreateSnapshotFile(
|
| - GURL(path), new WebFileSystemCallbackDispatcher(callbacks));
|
| + GURL(path),
|
| + base::Bind(&CallbackDispatcher::DidCreateSnapshotFile,
|
| + base::Owned(new CallbackDispatcher(callbacks))));
|
| }
|
|
|
| } // namespace content
|
|
|