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

Unified Diff: webkit/fileapi/external_mount_points.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, 9 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 | « webkit/fileapi/external_mount_points.h ('k') | webkit/fileapi/file_system_context.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/fileapi/external_mount_points.cc
diff --git a/webkit/fileapi/external_mount_points.cc b/webkit/fileapi/external_mount_points.cc
index 58a8883acf53fb1348434519186a3d1d81c5a9c6..13a10865ad909cd421dd9678318570b776f995ba 100644
--- a/webkit/fileapi/external_mount_points.cc
+++ b/webkit/fileapi/external_mount_points.cc
@@ -129,7 +129,8 @@ bool ExternalMountPoints::RegisterRemoteFileSystem(
bool ExternalMountPoints::HandlesFileSystemMountType(
FileSystemType type) const {
- return type == kFileSystemTypeExternal;
+ return type == kFileSystemTypeExternal ||
+ type == kFileSystemTypeExternalFullPath;
}
bool ExternalMountPoints::RevokeFileSystem(const std::string& mount_name) {
@@ -203,26 +204,40 @@ FileSystemURL ExternalMountPoints::CrackURL(const GURL& url) const {
FileSystemURL filesystem_url = FileSystemURL(url);
if (!filesystem_url.is_valid())
return FileSystemURL();
- return CreateCrackedFileSystemURL(filesystem_url.origin(),
- filesystem_url.mount_type(),
- filesystem_url.path());
+ return CrackFileSystemURL(filesystem_url);
}
-FileSystemURL ExternalMountPoints::CreateCrackedFileSystemURL(
- const GURL& origin,
- FileSystemType type,
- const base::FilePath& path) const {
- if (!HandlesFileSystemMountType(type))
+FileSystemURL ExternalMountPoints::CrackFileSystemURL(
+ const FileSystemURL& url) const {
+ if (!HandlesFileSystemMountType(url.type()))
return FileSystemURL();
+ base::FilePath virtual_path = url.path();
+ if (url.type() == kFileSystemTypeExternalFullPath) {
+ if (!GetVirtualPath(url.path(), &virtual_path))
+ return FileSystemURL();
+ }
+
std::string mount_name;
FileSystemType cracked_type;
base::FilePath cracked_path;
- if (!CrackVirtualPath(path, &mount_name, &cracked_type, &cracked_path))
+
+ if (!CrackVirtualPath(virtual_path, &mount_name, &cracked_type,
+ &cracked_path)) {
return FileSystemURL();
+ }
+
+ return FileSystemURL(
+ url.origin(), url.mount_type(), url.virtual_path(),
+ !url.filesystem_id().empty() ? url.filesystem_id() : mount_name,
+ cracked_type, cracked_path, mount_name);
+}
- return FileSystemURL(origin, type, path,
- mount_name, cracked_type, cracked_path);
+FileSystemURL ExternalMountPoints::CreateCrackedFileSystemURL(
+ const GURL& origin,
+ FileSystemType type,
+ const base::FilePath& path) const {
+ return CrackFileSystemURL(FileSystemURL(origin, type, path));
}
RemoteFileSystemProxyInterface* ExternalMountPoints::GetRemoteFileSystemProxy(
@@ -245,13 +260,13 @@ void ExternalMountPoints::AddMountPointInfosTo(
}
bool ExternalMountPoints::GetVirtualPath(const base::FilePath& path_in,
- base::FilePath* virtual_path) {
+ base::FilePath* virtual_path) const {
DCHECK(virtual_path);
base::AutoLock locker(lock_);
base::FilePath path = NormalizeFilePath(path_in);
- std::map<base::FilePath, std::string>::reverse_iterator iter(
+ std::map<base::FilePath, std::string>::const_reverse_iterator iter(
path_to_name_map_.upper_bound(path));
if (iter == path_to_name_map_.rend())
return false;
« no previous file with comments | « webkit/fileapi/external_mount_points.h ('k') | webkit/fileapi/file_system_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698