Index: webkit/fileapi/external_mount_points.cc |
diff --git a/webkit/fileapi/external_mount_points.cc b/webkit/fileapi/external_mount_points.cc |
index 9abba4218cfe17fb4bcf2609a2ea7e4ca6690cba..126c93145f7ce5f9d2ceda1f702e3b07192ef532 100644 |
--- a/webkit/fileapi/external_mount_points.cc |
+++ b/webkit/fileapi/external_mount_points.cc |
@@ -8,6 +8,7 @@ |
#include "base/lazy_instance.h" |
#include "base/path_service.h" |
#include "base/stl_util.h" |
+#include "webkit/fileapi/file_system_url.h" |
#include "webkit/fileapi/remote_file_system_proxy.h" |
namespace { |
@@ -154,6 +155,11 @@ bool ExternalMountPoints::RegisterRemoteFileSystem( |
return true; |
} |
+bool ExternalMountPoints::HandlesFileSystemMountType( |
+ FileSystemType type) const { |
+ return type == kFileSystemTypeExternal; |
+} |
+ |
bool ExternalMountPoints::RevokeFileSystem(const std::string& mount_name) { |
base::AutoLock locker(lock_); |
NameToInstance::iterator found = instance_map_.find(mount_name); |
@@ -221,6 +227,32 @@ bool ExternalMountPoints::CrackVirtualPath(const FilePath& virtual_path, |
return true; |
} |
+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()); |
+} |
+ |
+FileSystemURL ExternalMountPoints::CreateCrackedFileSystemURL( |
+ const GURL& origin, |
+ FileSystemType type, |
+ const FilePath& path) const { |
+ if (!HandlesFileSystemMountType(type)) |
+ return FileSystemURL(); |
+ |
+ std::string mount_name; |
+ FileSystemType cracked_type; |
+ 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); |
+} |
+ |
RemoteFileSystemProxyInterface* ExternalMountPoints::GetRemoteFileSystemProxy( |
const std::string& mount_name) const { |
base::AutoLock locker(lock_); |