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

Unified Diff: webkit/fileapi/file_system_context.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
Index: webkit/fileapi/file_system_context.cc
diff --git a/webkit/fileapi/file_system_context.cc b/webkit/fileapi/file_system_context.cc
index 017cf29f417ed78b3a73a84a6a864fdbf0f909b5..762f24cae9b000040f13ecb399721c795fc875a8 100644
--- a/webkit/fileapi/file_system_context.cc
+++ b/webkit/fileapi/file_system_context.cc
@@ -359,14 +359,58 @@ FileSystemURL FileSystemContext::CrackFileSystemURL(
url.type(),
url.path());
if (result.is_valid())
- return result;
+ break;
}
+ FileSystemType underlying_mount_type = GetUnderlyingMountType(result);
+ if (underlying_mount_type != fileapi::kFileSystemTypeUnknown) {
+ base::FilePath underlying_virtual_path;
+ if (GetVirtualPath(underlying_mount_type, result.path(),
+ &underlying_virtual_path)) {
+ // Note the recursion.
+ FileSystemURL underlying_url =
+ CreateCrackedFileSystemURL(result.origin(),
+ underlying_mount_type,
+ underlying_virtual_path);
+ if (underlying_url.is_valid()) {
+ result.SetUnderlyingURL(underlying_url);
+ }
+ }
+ }
return result;
}
+FileSystemType FileSystemContext::GetUnderlyingMountType(
+ const FileSystemURL& url) const {
+ if (external_provider() &&
+ url.is_valid() &&
+ url.type() == fileapi::kFileSystemTypeNativeLocal &&
+ url.mount_type() == fileapi::kFileSystemTypeIsolated) {
+ return kFileSystemTypeExternal;
+ }
+ return kFileSystemTypeUnknown;
+
+}
+
+bool FileSystemContext::GetVirtualPath(
+ FileSystemType mount_type,
+ const base::FilePath& full_path,
+ base::FilePath* virtual_path) const {
+ DCHECK(virtual_path);
+
+ for (size_t i = 0; i < url_crackers_.size(); ++i) {
+ if (!url_crackers_[i]->HandlesFileSystemMountType(mount_type))
+ continue;
+
+ if (url_crackers_[i]->GetVirtualPath(full_path, virtual_path))
+ return true;
+ }
+
+ return false;
+}
+
FileSystemFileUtil* FileSystemContext::GetFileUtil(
- FileSystemType type) const {
+ fileapi::FileSystemType type) const {
FileSystemMountPointProvider* mount_point_provider =
GetMountPointProvider(type);
if (!mount_point_provider)

Powered by Google App Engine
This is Rietveld 408576698