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

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: add struct FileSystemInfo, and change file path manipulation 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 8025f40d73c978ea2ad4419104c2756d42279e50..f81340b459eed0bd1601fa39013e75bd1cf6d0da 100644
--- a/content/browser/fileapi/fileapi_message_filter.cc
+++ b/content/browser/fileapi/fileapi_message_filter.cc
@@ -38,6 +38,7 @@
#include "webkit/common/blob/blob_data.h"
#include "webkit/common/blob/shareable_file_reference.h"
#include "webkit/common/fileapi/directory_entry.h"
+#include "webkit/common/fileapi/file_system_info.h"
#include "webkit/common/fileapi/file_system_types.h"
#include "webkit/common/fileapi/file_system_util.h"
@@ -161,6 +162,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)
@@ -241,6 +243,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(url, base::Bind(
+ &FileAPIMessageFilter::DidResolveURL, this, request_id));
+}
+
void FileAPIMessageFilter::OnDeleteFileSystem(
int request_id,
const GURL& origin_url,
@@ -833,18 +850,35 @@ void FileAPIMessageFilter::DidWrite(int request_id,
void FileAPIMessageFilter::DidOpenFileSystem(int request_id,
base::PlatformFileError result,
- const std::string& name,
+ const std::string& filesystem_name,
const GURL& root) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
if (result == base::PLATFORM_FILE_OK) {
DCHECK(root.is_valid());
- Send(new FileSystemMsg_DidOpenFileSystem(request_id, name, root));
+ Send(new FileSystemMsg_DidOpenFileSystem(
+ request_id, filesystem_name, root));
} else {
Send(new FileSystemMsg_DidFail(request_id, result));
}
// For OpenFileSystem we do not create a new operation, so no unregister here.
}
+void FileAPIMessageFilter::DidResolveURL(int request_id,
+ base::PlatformFileError result,
+ const fileapi::FileSystemInfo& info,
+ const base::FilePath& file_path,
+ bool is_directory) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ if (result == base::PLATFORM_FILE_OK) {
+ DCHECK(info.root_url.is_valid());
+ Send(new FileSystemMsg_DidResolveURL(
+ request_id, info, 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