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

Unified Diff: content/browser/fileapi/fileapi_message_filter.cc

Issue 23856002: SyncFS: Support resolveLocalFileSystemURL on SyncFileSystem (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
Index: content/browser/fileapi/fileapi_message_filter.cc
diff --git a/content/browser/fileapi/fileapi_message_filter.cc b/content/browser/fileapi/fileapi_message_filter.cc
index b4b5aefc866fdaa0d599b4f093b8f8cf462f43fe..acf963faf29784489969a8ddec1e16600f2a798e 100644
--- a/content/browser/fileapi/fileapi_message_filter.cc
+++ b/content/browser/fileapi/fileapi_message_filter.cc
@@ -159,6 +159,7 @@ bool FileAPIMessageFilter::OnMessageReceived(
bool handled = true;
IPC_BEGIN_MESSAGE_MAP_EX(FileAPIMessageFilter, message, *message_was_ok)
IPC_MESSAGE_HANDLER(FileSystemHostMsg_Open, OnOpen)
+ IPC_MESSAGE_HANDLER(FileSystemHostMsg_ResolveURL, OnResolveURL)
IPC_MESSAGE_HANDLER(FileSystemHostMsg_DeleteFileSystem, OnDeleteFileSystem)
IPC_MESSAGE_HANDLER(FileSystemHostMsg_Move, OnMove)
IPC_MESSAGE_HANDLER(FileSystemHostMsg_Copy, OnCopy)
@@ -227,6 +228,21 @@ void FileAPIMessageFilter::OnOpen(
&FileAPIMessageFilter::DidOpenFileSystem, this, request_id));
}
+void FileAPIMessageFilter::OnResolveURL(
+ int request_id,
+ const GURL& filesystem_url) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ base::PlatformFileError error;
+ FileSystemURL url(context_->CrackURL(filesystem_url));
+ if (!HasPermissionsForFile(url, fileapi::kReadFilePermissions, &error)) {
+ Send(new FileSystemMsg_DidFail(request_id, error));
+ return;
+ }
+
+ context_->ResolveURL(filesystem_url, base::Bind(
+ &FileAPIMessageFilter::DidResolveURL, this, request_id));
+}
+
void FileAPIMessageFilter::OnDeleteFileSystem(
int request_id,
const GURL& origin_url,
@@ -791,6 +807,23 @@ void FileAPIMessageFilter::DidOpenFileSystem(int request_id,
// For OpenFileSystem we do not create a new operation, so no unregister here.
}
+void FileAPIMessageFilter::DidResolveURL(int request_id,
+ base::PlatformFileError result,
+ const std::string& name,
+ const GURL& root,
+ const base::FilePath& file_path,
+ bool is_directory) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ if (result == base::PLATFORM_FILE_OK) {
+ DCHECK(root.is_valid());
+ Send(new FileSystemMsg_DidResolveURL(
+ request_id, name, root, file_path, is_directory));
+ } else {
+ Send(new FileSystemMsg_DidFail(request_id, result));
+ }
+ // For ResolveURL we do not create a new operation, so no unregister here.
+}
+
void FileAPIMessageFilter::DidDeleteFileSystem(
int request_id,
base::PlatformFileError result) {

Powered by Google App Engine
This is Rietveld 408576698