Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(672)

Unified Diff: content/child/fileapi/file_system_dispatcher.cc

Issue 23856002: SyncFS: Support resolveLocalFileSystemURL on SyncFileSystem (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/child/fileapi/file_system_dispatcher.h ('k') | content/child/fileapi/webfilesystem_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/fileapi/file_system_dispatcher.cc
diff --git a/content/child/fileapi/file_system_dispatcher.cc b/content/child/fileapi/file_system_dispatcher.cc
index c564f8d5706572b7458aeed24c6534ecd1c2c6b6..fa73ad118df969488f51a39c903962bbb64f21e2 100644
--- a/content/child/fileapi/file_system_dispatcher.cc
+++ b/content/child/fileapi/file_system_dispatcher.cc
@@ -10,6 +10,7 @@
#include "base/process/process.h"
#include "content/child/child_thread.h"
#include "content/common/fileapi/file_system_messages.h"
+#include "webkit/common/fileapi/file_system_info.h"
namespace content {
@@ -20,6 +21,7 @@ class FileSystemDispatcher::CallbackDispatcher {
typedef FileSystemDispatcher::MetadataCallback MetadataCallback;
typedef FileSystemDispatcher::ReadDirectoryCallback ReadDirectoryCallback;
typedef FileSystemDispatcher::OpenFileSystemCallback OpenFileSystemCallback;
+ typedef FileSystemDispatcher::ResolveURLCallback ResolveURLCallback;
typedef FileSystemDispatcher::WriteCallback WriteCallback;
typedef FileSystemDispatcher::OpenFileCallback OpenFileCallback;
@@ -57,6 +59,13 @@ class FileSystemDispatcher::CallbackDispatcher {
dispatcher->error_callback_ = error_callback;
return dispatcher;
}
+ static CallbackDispatcher* Create(const ResolveURLCallback& callback,
+ const StatusCallback& error_callback) {
+ CallbackDispatcher* dispatcher = new CallbackDispatcher;
+ dispatcher->resolve_callback_ = callback;
+ dispatcher->error_callback_ = error_callback;
+ return dispatcher;
+ }
static CallbackDispatcher* Create(const WriteCallback& callback,
const StatusCallback& error_callback) {
CallbackDispatcher* dispatcher = new CallbackDispatcher;
@@ -105,6 +114,12 @@ class FileSystemDispatcher::CallbackDispatcher {
filesystem_callback_.Run(name, root);
}
+ void DidResolveURL(const fileapi::FileSystemInfo& info,
+ const base::FilePath& file_path,
+ bool is_directory) {
+ resolve_callback_.Run(info, file_path, is_directory);
+ }
+
void DidWrite(int64 bytes, bool complete) {
write_callback_.Run(bytes, complete);
}
@@ -123,6 +138,7 @@ class FileSystemDispatcher::CallbackDispatcher {
CreateSnapshotFileCallback snapshot_callback_;
ReadDirectoryCallback directory_callback_;
OpenFileSystemCallback filesystem_callback_;
+ ResolveURLCallback resolve_callback_;
WriteCallback write_callback_;
OpenFileCallback open_callback_;
@@ -150,6 +166,7 @@ bool FileSystemDispatcher::OnMessageReceived(const IPC::Message& msg) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(FileSystemDispatcher, msg)
IPC_MESSAGE_HANDLER(FileSystemMsg_DidOpenFileSystem, OnDidOpenFileSystem)
+ IPC_MESSAGE_HANDLER(FileSystemMsg_DidResolveURL, OnDidResolveURL)
IPC_MESSAGE_HANDLER(FileSystemMsg_DidSucceed, OnDidSucceed)
IPC_MESSAGE_HANDLER(FileSystemMsg_DidReadDirectory, OnDidReadDirectory)
IPC_MESSAGE_HANDLER(FileSystemMsg_DidReadMetadata, OnDidReadMetadata)
@@ -174,6 +191,16 @@ void FileSystemDispatcher::OpenFileSystem(
request_id, origin_url, type, size, create));
}
+void FileSystemDispatcher::ResolveURL(
+ const GURL& filesystem_url,
+ const ResolveURLCallback& success_callback,
+ const StatusCallback& error_callback) {
+ int request_id = dispatchers_.Add(
+ CallbackDispatcher::Create(success_callback, error_callback));
+ ChildThread::current()->Send(new FileSystemHostMsg_ResolveURL(
+ request_id, filesystem_url));
+}
+
void FileSystemDispatcher::DeleteFileSystem(
const GURL& origin_url,
fileapi::FileSystemType type,
@@ -362,6 +389,17 @@ void FileSystemDispatcher::OnDidOpenFileSystem(int request_id,
dispatchers_.Remove(request_id);
}
+void FileSystemDispatcher::OnDidResolveURL(int request_id,
+ const fileapi::FileSystemInfo& info,
+ const base::FilePath& file_path,
+ bool is_directory) {
+ DCHECK(info.root_url.is_valid());
+ CallbackDispatcher* dispatcher = dispatchers_.Lookup(request_id);
+ DCHECK(dispatcher);
+ dispatcher->DidResolveURL(info, file_path, is_directory);
+ dispatchers_.Remove(request_id);
+}
+
void FileSystemDispatcher::OnDidSucceed(int request_id) {
CallbackDispatcher* dispatcher = dispatchers_.Lookup(request_id);
DCHECK(dispatcher);
« no previous file with comments | « content/child/fileapi/file_system_dispatcher.h ('k') | content/child/fileapi/webfilesystem_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698