summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-24 01:37:13 +0000
committerkinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-24 01:37:13 +0000
commit906ae21c7b13534e3cfc62a4885da5c1be265d02 (patch)
treeebf9c1d26925db166d31a040c3fa6cbbdc27435a
parenta8c6061c967b3ecd36730b7108c5f56ae4ba0363 (diff)
downloadchromium_src-906ae21c7b13534e3cfc62a4885da5c1be265d02.zip
chromium_src-906ae21c7b13534e3cfc62a4885da5c1be265d02.tar.gz
chromium_src-906ae21c7b13534e3cfc62a4885da5c1be265d02.tar.bz2
Launch packaged app with files on Drive on Chrome OS.
BUG=156277 TEST=Install a packaged app associated to some file type, and execute the app for a file on "Google Drive" folder in Chrome OS file manager. Review URL: https://chromiumcodereview.appspot.com/12717014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@190144 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/chromeos/drive/drive_file_system_proxy.cc14
-rw-r--r--chrome/browser/chromeos/extensions/external_filesystem_apitest.cc9
-rw-r--r--chrome/browser/extensions/platform_app_launcher.cc50
-rw-r--r--chrome/test/data/chromeos/gdata/remote_file_system_apitest_root_feed.json4
-rw-r--r--content/browser/fileapi/browser_file_system_helper.cc2
-rw-r--r--webkit/fileapi/external_mount_points.cc58
-rw-r--r--webkit/fileapi/external_mount_points.h6
-rw-r--r--webkit/fileapi/file_system_context.cc31
-rw-r--r--webkit/fileapi/file_system_types.h6
-rw-r--r--webkit/fileapi/file_system_url.cc26
-rw-r--r--webkit/fileapi/file_system_url.h25
-rw-r--r--webkit/fileapi/file_system_util.cc2
-rw-r--r--webkit/fileapi/isolated_context.cc33
-rw-r--r--webkit/fileapi/isolated_context.h4
-rw-r--r--webkit/fileapi/mount_points.h8
15 files changed, 205 insertions, 73 deletions
diff --git a/chrome/browser/chromeos/drive/drive_file_system_proxy.cc b/chrome/browser/chromeos/drive/drive_file_system_proxy.cc
index b3286af..282315f 100644
--- a/chrome/browser/chromeos/drive/drive_file_system_proxy.cc
+++ b/chrome/browser/chromeos/drive/drive_file_system_proxy.cc
@@ -693,11 +693,17 @@ DriveFileSystemProxy::~DriveFileSystemProxy() {
bool DriveFileSystemProxy::ValidateUrl(
const FileSystemURL& url, base::FilePath* file_path) {
// what platform you're on.
- if (!url.is_valid() || url.type() != fileapi::kFileSystemTypeDrive) {
+ if (!url.is_valid() || url.type() != fileapi::kFileSystemTypeDrive)
return false;
- }
- *file_path = url.virtual_path();
- return true;
+
+ // |url.virtual_path()| cannot be used directly because in the case the url is
+ // isolated file system url, the virtual path will be formatted as
+ // <isolated_file_system_id>/<file_name> and thus unusable by drive file
+ // system.
+ // TODO(kinaba): fix other uses of virtual_path() as in
+ // https://codereview.chromium.org/12483010/
+ *file_path = util::ExtractDrivePath(url.path());
+ return !file_path->empty();
}
void DriveFileSystemProxy::CallDriveFileSystemMethodOnUIThread(
diff --git a/chrome/browser/chromeos/extensions/external_filesystem_apitest.cc b/chrome/browser/chromeos/extensions/external_filesystem_apitest.cc
index 18cfa91..0aeab14 100644
--- a/chrome/browser/chromeos/extensions/external_filesystem_apitest.cc
+++ b/chrome/browser/chromeos/extensions/external_filesystem_apitest.cc
@@ -514,4 +514,13 @@ IN_PROC_BROWSER_TEST_F(DriveFileSystemExtensionApiTest, Search) {
FLAGS_NONE)) << message_;
}
+IN_PROC_BROWSER_TEST_F(DriveFileSystemExtensionApiTest, AppFileHandler) {
+ fake_drive_service_->set_default_max_results(1);
+ EXPECT_TRUE(RunFileSystemExtensionApiTest(
+ "file_browser/handler_test_runner",
+ FILE_PATH_LITERAL("manifest_v2.json"),
+ "file_browser/app_file_handler",
+ FLAGS_USE_FILE_HANDLER)) << message_;
+}
+
} // namespace
diff --git a/chrome/browser/extensions/platform_app_launcher.cc b/chrome/browser/extensions/platform_app_launcher.cc
index 0d37609..b4064bf 100644
--- a/chrome/browser/extensions/platform_app_launcher.cc
+++ b/chrome/browser/extensions/platform_app_launcher.cc
@@ -32,6 +32,13 @@
#include "webkit/fileapi/file_system_types.h"
#include "webkit/fileapi/isolated_context.h"
+#if defined(OS_CHROMEOS)
+#include "chrome/browser/chromeos/drive/drive_file_error.h"
+#include "chrome/browser/chromeos/drive/drive_file_system_interface.h"
+#include "chrome/browser/chromeos/drive/drive_file_system_util.h"
+#include "chrome/browser/chromeos/drive/drive_system_service.h"
+#endif
+
using content::BrowserThread;
using extensions::app_file_handler_util::FileHandlerForId;
using extensions::app_file_handler_util::FileHandlerCanHandleFileWithMimeType;
@@ -108,6 +115,14 @@ class PlatformAppPathLauncher
}
DCHECK(file_path_.IsAbsolute());
+
+#if defined(OS_CHROMEOS)
+ if (drive::util::IsUnderDriveMountPoint(file_path_)) {
+ GetMimeTypeAndLaunchForDriveFile();
+ return;
+ }
+#endif
+
BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, base::Bind(
&PlatformAppPathLauncher::GetMimeTypeAndLaunch, this));
}
@@ -148,6 +163,38 @@ class PlatformAppPathLauncher
&PlatformAppPathLauncher::LaunchWithMimeType, this, mime_type));
}
+#if defined(OS_CHROMEOS)
+ void GetMimeTypeAndLaunchForDriveFile() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ drive::DriveSystemService* service =
+ drive::DriveSystemServiceFactory::FindForProfile(profile_);
+ if (!service) {
+ LaunchWithNoLaunchData();
+ return;
+ }
+
+ service->file_system()->GetFileByPath(
+ drive::util::ExtractDrivePath(file_path_),
+ base::Bind(&PlatformAppPathLauncher::OnGotDriveFile, this));
+ }
+
+ void OnGotDriveFile(drive::DriveFileError error,
+ const base::FilePath& file_path,
+ const std::string& mime_type,
+ drive::DriveFileType file_type) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ if (error != drive::DRIVE_FILE_OK || mime_type.empty() ||
+ file_type != drive::REGULAR_FILE) {
+ LaunchWithNoLaunchData();
+ return;
+ }
+
+ LaunchWithMimeType(mime_type);
+ }
+#endif // defined(OS_CHROMEOS)
+
void LaunchWithNoLaunchData() {
// This method is required as an entry point on the UI thread.
LaunchPlatformAppWithNoData(profile_, extension_);
@@ -223,7 +270,8 @@ class PlatformAppPathLauncher
fileapi::IsolatedContext::GetInstance();
DCHECK(isolated_context);
std::string filesystem_id = isolated_context->RegisterFileSystemForPath(
- fileapi::kFileSystemTypeNativeLocal, file_path_, &registered_name);
+ fileapi::kFileSystemTypeNativeForPlatformApp, file_path_,
+ &registered_name);
// Granting read file system permission as well to allow file-system
// read operations.
policy->GrantReadFileSystem(renderer_id, filesystem_id);
diff --git a/chrome/test/data/chromeos/gdata/remote_file_system_apitest_root_feed.json b/chrome/test/data/chromeos/gdata/remote_file_system_apitest_root_feed.json
index 807f8fc..3cfcf27 100644
--- a/chrome/test/data/chromeos/gdata/remote_file_system_apitest_root_feed.json
+++ b/chrome/test/data/chromeos/gdata/remote_file_system_apitest_root_feed.json
@@ -290,7 +290,7 @@
} ],
"content": {
"src": "https://xxx/content/file:1_file_resource_id",
- "type": "test/ro"
+ "type": "application/vnd.mozilla.xul+xml"
},
"docs$filename": {
"$t": "test_file.xul"
@@ -386,7 +386,7 @@
} ],
"content": {
"src": "https://xxx/content/file:2_file_resource_id/",
- "type": "test/rw"
+ "type": "image/tiff"
},
"docs$filename": {
"$t": "test_file.tiff"
diff --git a/content/browser/fileapi/browser_file_system_helper.cc b/content/browser/fileapi/browser_file_system_helper.cc
index 5db3ff9..710c3bd 100644
--- a/content/browser/fileapi/browser_file_system_helper.cc
+++ b/content/browser/fileapi/browser_file_system_helper.cc
@@ -108,7 +108,7 @@ bool CheckFileSystemPermissionsForProcess(
}
case fileapi::FILE_PERMISSION_USE_FILESYSTEM_PERMISSION: {
const bool success = policy->HasPermissionsForFileSystem(
- process_id, url.filesystem_id(), permissions);
+ process_id, url.mount_filesystem_id(), permissions);
if (!success)
*error = base::PLATFORM_FILE_ERROR_SECURITY;
return success;
diff --git a/webkit/fileapi/external_mount_points.cc b/webkit/fileapi/external_mount_points.cc
index 58a8883..b0c18de 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 == kFileSystemTypeNativeForPlatformApp;
}
bool ExternalMountPoints::RevokeFileSystem(const std::string& mount_name) {
@@ -203,26 +204,14 @@ 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))
- return FileSystemURL();
-
- std::string mount_name;
- FileSystemType cracked_type;
- base::FilePath cracked_path;
- if (!CrackVirtualPath(path, &mount_name, &cracked_type, &cracked_path))
- return FileSystemURL();
-
- return FileSystemURL(origin, type, path,
- mount_name, cracked_type, cracked_path);
+ return CrackFileSystemURL(FileSystemURL(origin, type, path));
}
RemoteFileSystemProxyInterface* ExternalMountPoints::GetRemoteFileSystemProxy(
@@ -245,13 +234,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;
@@ -274,6 +263,41 @@ ExternalMountPoints::~ExternalMountPoints() {
instance_map_.end());
}
+FileSystemURL ExternalMountPoints::CrackFileSystemURL(
+ const FileSystemURL& url) const {
+ if (!HandlesFileSystemMountType(url.type()))
+ return FileSystemURL();
+
+ base::FilePath virtual_path = url.path();
+ if (url.type() == kFileSystemTypeNativeForPlatformApp) {
+#if defined(OS_CHROMEOS)
+ // On Chrome OS, find a mount point and virtual path for the external fs.
+ if (!GetVirtualPath(url.path(), &virtual_path))
+ return FileSystemURL();
+#else
+ // On other OS, it is simply a native local path.
+ return FileSystemURL(
+ url.origin(), url.mount_type(), url.virtual_path(),
+ url.mount_filesystem_id(), kFileSystemTypeNativeLocal,
+ url.path(), url.filesystem_id());
+#endif
+ }
+
+ std::string mount_name;
+ FileSystemType cracked_type;
+ base::FilePath 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);
+}
+
bool ExternalMountPoints::ValidateNewMountPoint(const std::string& mount_name,
const base::FilePath& path) {
lock_.AssertAcquired();
diff --git a/webkit/fileapi/external_mount_points.h b/webkit/fileapi/external_mount_points.h
index a2660c2..c5d5a48 100644
--- a/webkit/fileapi/external_mount_points.h
+++ b/webkit/fileapi/external_mount_points.h
@@ -105,7 +105,7 @@ class WEBKIT_STORAGE_EXPORT ExternalMountPoints
//
// Returned virtual_path will have normalized path separators.
bool GetVirtualPath(const base::FilePath& absolute_path,
- base::FilePath* virtual_path);
+ base::FilePath* virtual_path) const;
// Returns the virtual root path that looks like /<mount_name>.
base::FilePath CreateVirtualRootPath(const std::string& mount_name) const;
@@ -125,6 +125,10 @@ class WEBKIT_STORAGE_EXPORT ExternalMountPoints
ExternalMountPoints();
virtual ~ExternalMountPoints();
+ // MountPoint overrides.
+ virtual FileSystemURL CrackFileSystemURL(
+ const FileSystemURL& url) const OVERRIDE;
+
// Performs sanity checks on the new mount point.
// Checks the following:
// - there is no registered mount point with mount_name
diff --git a/webkit/fileapi/file_system_context.cc b/webkit/fileapi/file_system_context.cc
index 017cf29..33825f6 100644
--- a/webkit/fileapi/file_system_context.cc
+++ b/webkit/fileapi/file_system_context.cc
@@ -150,6 +150,7 @@ FileSystemMountPointProvider* FileSystemContext::GetMountPointProvider(
case kFileSystemTypeDeviceMedia:
return isolated_provider_.get();
case kFileSystemTypeNativeLocal:
+ case kFileSystemTypeNativeForPlatformApp:
#if defined(OS_CHROMEOS)
return external_provider_.get();
#else
@@ -349,20 +350,24 @@ FileSystemURL FileSystemContext::CrackFileSystemURL(
// The returned value in case there is no crackers which can crack the url.
// This is valid situation for non isolated/external file systems.
- FileSystemURL result = url;
-
- for (size_t i = 0; i < url_crackers_.size(); ++i) {
- if (!url_crackers_[i]->HandlesFileSystemMountType(url.type()))
- continue;
-
- result = url_crackers_[i]->CreateCrackedFileSystemURL(url.origin(),
- url.type(),
- url.path());
- if (result.is_valid())
- return result;
+ FileSystemURL current = url;
+
+ // File system may be mounted multiple times (e.g., an isolated filesystem on
+ // top of an external filesystem). Hence cracking needs to be iterated.
+ for (;;) {
+ FileSystemURL cracked = current;
+ for (size_t i = 0; i < url_crackers_.size(); ++i) {
+ if (!url_crackers_[i]->HandlesFileSystemMountType(current.type()))
+ continue;
+ cracked = url_crackers_[i]->CrackFileSystemURL(current);
+ if (cracked.is_valid())
+ break;
+ }
+ if (cracked == current)
+ break;
+ current = cracked;
}
-
- return result;
+ return current;
}
FileSystemFileUtil* FileSystemContext::GetFileUtil(
diff --git a/webkit/fileapi/file_system_types.h b/webkit/fileapi/file_system_types.h
index ca09ee6..11b5fa3 100644
--- a/webkit/fileapi/file_system_types.h
+++ b/webkit/fileapi/file_system_types.h
@@ -76,6 +76,12 @@ enum FileSystemType {
// Indicates a Syncable sandboxed filesystem which can be backed by a
// cloud storage service.
kFileSystemTypeSyncable,
+
+ // Indicates an external filesystem accessible by file paths from platform
+ // Apps. As of writing, on non Chrome OS platform, this is merely a
+ // kFileSystemTypeNativeLocal. On Chrome OS, the path is parsed by
+ // the handlers of kFileSystemTypeExternal.
+ kFileSystemTypeNativeForPlatformApp,
};
} // namespace fileapi
diff --git a/webkit/fileapi/file_system_url.cc b/webkit/fileapi/file_system_url.cc
index d0f8a03..f636daf1 100644
--- a/webkit/fileapi/file_system_url.cc
+++ b/webkit/fileapi/file_system_url.cc
@@ -22,8 +22,8 @@ namespace {
FileSystemURL::FileSystemURL()
: is_valid_(false),
- type_(kFileSystemTypeUnknown),
- mount_type_(kFileSystemTypeUnknown) {
+ mount_type_(kFileSystemTypeUnknown),
+ type_(kFileSystemTypeUnknown) {
}
// static
@@ -99,8 +99,8 @@ bool FileSystemURL::ParseFileSystemSchemeURL(
}
FileSystemURL::FileSystemURL(const GURL& url)
- : type_(kFileSystemTypeUnknown),
- mount_type_(kFileSystemTypeUnknown) {
+ : mount_type_(kFileSystemTypeUnknown),
+ type_(kFileSystemTypeUnknown) {
is_valid_ = ParseFileSystemSchemeURL(url, &origin_, &type_, &path_);
virtual_path_ = path_;
mount_type_ = type_;
@@ -111,25 +111,27 @@ FileSystemURL::FileSystemURL(const GURL& origin,
const base::FilePath& path)
: is_valid_(true),
origin_(origin),
- type_(type),
mount_type_(type),
- path_(path.NormalizePathSeparators()),
- virtual_path_(path.NormalizePathSeparators()) {
+ virtual_path_(path.NormalizePathSeparators()),
+ type_(type),
+ path_(path.NormalizePathSeparators()) {
}
FileSystemURL::FileSystemURL(const GURL& origin,
FileSystemType mount_type,
const base::FilePath& virtual_path,
- const std::string& filesystem_id,
+ const std::string& mount_filesystem_id,
FileSystemType cracked_type,
- const base::FilePath& cracked_path)
+ const base::FilePath& cracked_path,
+ const std::string& filesystem_id)
: is_valid_(true),
origin_(origin),
- type_(cracked_type),
mount_type_(mount_type),
+ virtual_path_(virtual_path.NormalizePathSeparators()),
+ mount_filesystem_id_(mount_filesystem_id),
+ type_(cracked_type),
path_(cracked_path.NormalizePathSeparators()),
- filesystem_id_(filesystem_id),
- virtual_path_(virtual_path.NormalizePathSeparators()) {
+ filesystem_id_(filesystem_id) {
}
FileSystemURL::~FileSystemURL() {}
diff --git a/webkit/fileapi/file_system_url.h b/webkit/fileapi/file_system_url.h
index 29e6fee..5d72e90 100644
--- a/webkit/fileapi/file_system_url.h
+++ b/webkit/fileapi/file_system_url.h
@@ -61,7 +61,7 @@ namespace fileapi {
// Additionally, following accessors would return valid values:
// filesystem_id() returns 'mount_name'.
//
-// It is imposible to directly create a valid FileSystemURL instance (except by
+// It is impossible to directly create a valid FileSystemURL instance (except by
// using CreatedForTest methods, which should not be used in production code).
// To get a valid FileSystemURL, one of the following methods can be used:
// <Friend>::CrackURL, <Friend>::CreateCrackedFileSystemURL, where <Friend> is
@@ -112,6 +112,9 @@ class WEBKIT_STORAGE_EXPORT FileSystemURL {
// Returns the filesystem ID/mount name for isolated/external filesystem URLs.
// See the class comment for details.
const std::string& filesystem_id() const { return filesystem_id_; }
+ const std::string& mount_filesystem_id() const {
+ return mount_filesystem_id_;
+ }
FileSystemType mount_type() const { return mount_type_; }
@@ -139,21 +142,27 @@ class WEBKIT_STORAGE_EXPORT FileSystemURL {
FileSystemURL(const GURL& origin,
FileSystemType mount_type,
const base::FilePath& virtual_path,
- const std::string& filesystem_id,
+ const std::string& mount_filesystem_id,
FileSystemType cracked_type,
- const base::FilePath& cracked_path);
+ const base::FilePath& cracked_path,
+ const std::string& filesystem_id);
bool is_valid_;
+ // Values parsed from the original URL.
GURL origin_;
- FileSystemType type_;
FileSystemType mount_type_;
- base::FilePath path_;
-
- // Values specific to cracked URLs.
- std::string filesystem_id_;
base::FilePath virtual_path_;
+ // Values obtained by cracking URLs.
+ // |mount_filesystem_id_| is retrieved from the first round of cracking,
+ // and the rest of the fields are from recursive cracking. Permission
+ // checking on the top-level mount information should be done with the former,
+ // and the low-level file operation should be implemented with the latter.
+ std::string mount_filesystem_id_;
+ FileSystemType type_;
+ base::FilePath path_;
+ std::string filesystem_id_;
};
typedef std::set<FileSystemURL, FileSystemURL::Comparator> FileSystemURLSet;
diff --git a/webkit/fileapi/file_system_util.cc b/webkit/fileapi/file_system_util.cc
index 4368f2c..eba5803 100644
--- a/webkit/fileapi/file_system_util.cc
+++ b/webkit/fileapi/file_system_util.cc
@@ -239,6 +239,8 @@ std::string GetFileSystemTypeString(FileSystemType type) {
return "Drive";
case kFileSystemTypeSyncable:
return "Syncable";
+ case kFileSystemTypeNativeForPlatformApp:
+ return "NativeForPlatformApp";
case kFileSystemTypeUnknown:
return "Unknown";
}
diff --git a/webkit/fileapi/isolated_context.cc b/webkit/fileapi/isolated_context.cc
index 56ba1c0..79cdddd 100644
--- a/webkit/fileapi/isolated_context.cc
+++ b/webkit/fileapi/isolated_context.cc
@@ -301,26 +301,14 @@ FileSystemURL IsolatedContext::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 IsolatedContext::CreateCrackedFileSystemURL(
const GURL& origin,
FileSystemType type,
const base::FilePath& path) const {
- if (!HandlesFileSystemMountType(type))
- return FileSystemURL();
-
- std::string mount_name;
- FileSystemType cracked_type;
- base::FilePath cracked_path;
- if (!CrackVirtualPath(path, &mount_name, &cracked_type, &cracked_path))
- return FileSystemURL();
-
- return FileSystemURL(origin, type, path,
- mount_name, cracked_type, cracked_path);
+ return CrackFileSystemURL(FileSystemURL(origin, type, path));
}
void IsolatedContext::RevokeFileSystemByPath(const base::FilePath& path_in) {
@@ -390,6 +378,23 @@ IsolatedContext::~IsolatedContext() {
instance_map_.end());
}
+FileSystemURL IsolatedContext::CrackFileSystemURL(
+ const FileSystemURL& url) const {
+ if (!HandlesFileSystemMountType(url.type()))
+ return FileSystemURL();
+
+ std::string mount_name;
+ FileSystemType cracked_type;
+ base::FilePath cracked_path;
+ if (!CrackVirtualPath(url.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);
+}
+
bool IsolatedContext::UnregisterFileSystem(const std::string& filesystem_id) {
lock_.AssertAcquired();
IDToInstance::iterator found = instance_map_.find(filesystem_id);
diff --git a/webkit/fileapi/isolated_context.h b/webkit/fileapi/isolated_context.h
index 313ccc6..f78dc24 100644
--- a/webkit/fileapi/isolated_context.h
+++ b/webkit/fileapi/isolated_context.h
@@ -162,6 +162,10 @@ class WEBKIT_STORAGE_EXPORT IsolatedContext : public MountPoints {
IsolatedContext();
virtual ~IsolatedContext();
+ // MountPoints overrides.
+ virtual FileSystemURL CrackFileSystemURL(
+ const FileSystemURL& url) const OVERRIDE;
+
// Unregisters a file system of given |filesystem_id|. Must be called with
// lock_ held. Returns true if the file system is unregistered.
bool UnregisterFileSystem(const std::string& filesystem_id);
diff --git a/webkit/fileapi/mount_points.h b/webkit/fileapi/mount_points.h
index 7fcc231..d279ec9 100644
--- a/webkit/fileapi/mount_points.h
+++ b/webkit/fileapi/mount_points.h
@@ -88,6 +88,14 @@ class WEBKIT_STORAGE_EXPORT MountPoints {
FileSystemType* type,
base::FilePath* path) const = 0;
+ protected:
+ friend class FileSystemContext;
+
+ // Same as CrackURL and CreateCrackedFileSystemURL, but cracks the url already
+ // instantiated as the FileSystemURL class. This is internally used for nested
+ // URL cracking in FileSystemContext.
+ virtual FileSystemURL CrackFileSystemURL(const FileSystemURL& url) const = 0;
+
private:
DISALLOW_COPY_AND_ASSIGN(MountPoints);
};