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

Unified Diff: webkit/chromeos/fileapi/cros_mount_point_provider.cc

Issue 12258021: Fix filesystem API file_handlers to work for drive on ChromeOS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 10 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: webkit/chromeos/fileapi/cros_mount_point_provider.cc
diff --git a/webkit/chromeos/fileapi/cros_mount_point_provider.cc b/webkit/chromeos/fileapi/cros_mount_point_provider.cc
index 7f130026618ac6c886c57b0d83791c0348e49d4d..c16a6f1b2bc407b56922e253954f55b20dc87bcd 100644
--- a/webkit/chromeos/fileapi/cros_mount_point_provider.cc
+++ b/webkit/chromeos/fileapi/cros_mount_point_provider.cc
@@ -30,6 +30,8 @@
#include "webkit/fileapi/local_file_system_operation.h"
#include "webkit/glue/webkit_glue.h"
+using fileapi::FileSystemURL;
+
namespace {
const char kChromeUIScheme[] = "chrome";
@@ -39,7 +41,7 @@ const char kChromeUIScheme[] = "chrome";
namespace chromeos {
// static
-bool CrosMountPointProvider::CanHandleURL(const fileapi::FileSystemURL& url) {
+bool CrosMountPointProvider::CanHandleURL(const FileSystemURL& url) {
if (!url.is_valid())
return false;
return url.type() == fileapi::kFileSystemTypeNativeLocal ||
@@ -73,7 +75,7 @@ void CrosMountPointProvider::ValidateFileSystemRoot(
}
base::FilePath CrosMountPointProvider::GetFileSystemRootPathOnFileThread(
- const fileapi::FileSystemURL& url,
+ const FileSystemURL& url,
bool create) {
DCHECK(fileapi::IsolatedContext::IsIsolatedType(url.mount_type()));
if (!url.is_valid())
@@ -227,20 +229,14 @@ fileapi::FilePermissionPolicy CrosMountPointProvider::GetPermissionPolicy(
}
fileapi::FileSystemOperation* CrosMountPointProvider::CreateFileSystemOperation(
- const fileapi::FileSystemURL& url,
+ const FileSystemURL& url,
fileapi::FileSystemContext* context,
base::PlatformFileError* error_code) const {
DCHECK(url.is_valid());
- if (url.type() == fileapi::kFileSystemTypeDrive) {
- fileapi::RemoteFileSystemProxyInterface* remote_proxy =
- GetRemoteProxy(url.filesystem_id());
- if (!remote_proxy) {
- *error_code = base::PLATFORM_FILE_ERROR_NOT_FOUND;
- return NULL;
- }
+ fileapi::RemoteFileSystemProxyInterface* remote_proxy = GetRemoteProxy(url);
+ if (remote_proxy)
return new chromeos::RemoteFileSystemOperation(remote_proxy);
- }
DCHECK(url.type() == fileapi::kFileSystemTypeNativeLocal ||
url.type() == fileapi::kFileSystemTypeRestrictedNativeLocal);
@@ -251,7 +247,7 @@ fileapi::FileSystemOperation* CrosMountPointProvider::CreateFileSystemOperation(
}
webkit_blob::FileStreamReader* CrosMountPointProvider::CreateFileStreamReader(
- const fileapi::FileSystemURL& url,
+ const FileSystemURL& url,
int64 offset,
const base::Time& expected_modification_time,
fileapi::FileSystemContext* context) const {
@@ -263,18 +259,14 @@ webkit_blob::FileStreamReader* CrosMountPointProvider::CreateFileStreamReader(
}
fileapi::FileStreamWriter* CrosMountPointProvider::CreateFileStreamWriter(
- const fileapi::FileSystemURL& url,
+ const FileSystemURL& url,
int64 offset,
fileapi::FileSystemContext* context) const {
DCHECK(url.is_valid());
- if (url.type() == fileapi::kFileSystemTypeDrive) {
- fileapi::RemoteFileSystemProxyInterface* remote_proxy =
- GetRemoteProxy(url.filesystem_id());
- if (!remote_proxy)
- return NULL;
+ fileapi::RemoteFileSystemProxyInterface* remote_proxy = GetRemoteProxy(url);
+ if (remote_proxy)
return new fileapi::RemoteFileStreamWriter(remote_proxy, url, offset);
- }
if (url.type() == fileapi::kFileSystemTypeRestrictedNativeLocal)
return NULL;
@@ -285,18 +277,18 @@ fileapi::FileStreamWriter* CrosMountPointProvider::CreateFileStreamWriter(
bool CrosMountPointProvider::GetVirtualPath(
const base::FilePath& filesystem_path,
- base::FilePath* virtual_path) {
+ base::FilePath* virtual_path) const {
return mount_points_->GetVirtualPath(filesystem_path, virtual_path) ||
system_mount_points_->GetVirtualPath(filesystem_path, virtual_path);
}
fileapi::RemoteFileSystemProxyInterface* CrosMountPointProvider::GetRemoteProxy(
- const std::string& mount_name) const {
+ const fileapi::FileSystemURL& url) const {
fileapi::RemoteFileSystemProxyInterface* proxy =
- mount_points_->GetRemoteFileSystemProxy(mount_name);
+ mount_points_->GetRemoteFileSystemProxyForPath(url.path());
if (proxy)
return proxy;
- return system_mount_points_->GetRemoteFileSystemProxy(mount_name);
+ return system_mount_points_->GetRemoteFileSystemProxyForPath(url.path());
}
} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698