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

Unified Diff: webkit/fileapi/external_mount_points.cc

Issue 11787028: New FileSystemURL cracking (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test on Win Created 7 years, 11 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/external_mount_points_unittest.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 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_);
« no previous file with comments | « webkit/fileapi/external_mount_points.h ('k') | webkit/fileapi/external_mount_points_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698