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

Unified Diff: webkit/fileapi/isolated_context.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/isolated_context.h ('k') | webkit/fileapi/isolated_context_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/fileapi/isolated_context.cc
diff --git a/webkit/fileapi/isolated_context.cc b/webkit/fileapi/isolated_context.cc
index 1433e7240b2dcdcc6010b760f2586dbe46a70cd4..fe1aec0ce3000ff97c1cb103bd9726b8d7dfbf3c 100644
--- a/webkit/fileapi/isolated_context.cc
+++ b/webkit/fileapi/isolated_context.cc
@@ -12,6 +12,7 @@
#include "base/string_number_conversions.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
+#include "webkit/fileapi/file_system_url.h"
namespace fileapi {
@@ -225,6 +226,10 @@ std::string IsolatedContext::RegisterFileSystemForPath(
return filesystem_id;
}
+bool IsolatedContext::HandlesFileSystemMountType(FileSystemType type) const {
+ return type == kFileSystemTypeIsolated;
+}
+
bool IsolatedContext::RevokeFileSystem(const std::string& filesystem_id) {
base::AutoLock locker(lock_);
return UnregisterFileSystem(filesystem_id);
@@ -292,6 +297,32 @@ bool IsolatedContext::CrackVirtualPath(const FilePath& virtual_path,
return true;
}
+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());
+}
+
+FileSystemURL IsolatedContext::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);
+}
+
void IsolatedContext::RevokeFileSystemByPath(const FilePath& path_in) {
base::AutoLock locker(lock_);
FilePath path(path_in.NormalizePathSeparators());
« no previous file with comments | « webkit/fileapi/isolated_context.h ('k') | webkit/fileapi/isolated_context_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698