summaryrefslogtreecommitdiffstats
path: root/webkit/fileapi
diff options
context:
space:
mode:
authorkinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-10 06:00:20 +0000
committerkinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-10 06:00:20 +0000
commit1dd862554bb698ac52a92539bf8b676ac664dff0 (patch)
tree2601a86da291e02c8683d261c7a57d2cb7c3473c /webkit/fileapi
parentc902ec2881db8f25be8ad211581a0b5e17100c04 (diff)
downloadchromium_src-1dd862554bb698ac52a92539bf8b676ac664dff0.zip
chromium_src-1dd862554bb698ac52a92539bf8b676ac664dff0.tar.gz
chromium_src-1dd862554bb698ac52a92539bf8b676ac664dff0.tar.bz2
Cleanup: Add fileapi::GetIsolatedFileSystemRootURIString
to hide the details how we create a root URI string for IsolatedFileSystems from each extension code. BUG=none TEST=existing tests Review URL: https://codereview.chromium.org/11833002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176036 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/fileapi')
-rw-r--r--webkit/fileapi/file_system_util.cc16
-rw-r--r--webkit/fileapi/file_system_util.h8
2 files changed, 24 insertions, 0 deletions
diff --git a/webkit/fileapi/file_system_util.cc b/webkit/fileapi/file_system_util.cc
index 43033b6..aebdd60 100644
--- a/webkit/fileapi/file_system_util.cc
+++ b/webkit/fileapi/file_system_util.cc
@@ -273,4 +273,20 @@ bool CrackIsolatedFileSystemName(const std::string& filesystem_name,
return true;
}
+std::string GetIsolatedFileSystemRootURIString(
+ const GURL& origin_url,
+ const std::string& filesystem_id,
+ const std::string& optional_root_name) {
+ std::string root = GetFileSystemRootURI(origin_url,
+ kFileSystemTypeIsolated).spec();
+ root.append(filesystem_id);
+ root.append("/");
+ if (!optional_root_name.empty()) {
+ DCHECK(!FilePath::FromUTF8Unsafe(optional_root_name).ReferencesParent());
+ root.append(optional_root_name);
+ root.append("/");
+ }
+ return root;
+}
+
} // namespace fileapi
diff --git a/webkit/fileapi/file_system_util.h b/webkit/fileapi/file_system_util.h
index 74091c4..b8bc41f 100644
--- a/webkit/fileapi/file_system_util.h
+++ b/webkit/fileapi/file_system_util.h
@@ -123,6 +123,14 @@ WEBKIT_STORAGE_EXPORT bool CrackIsolatedFileSystemName(
const std::string& filesystem_name,
std::string* filesystem_id);
+// Returns the root URI for an isolated filesystem for origin |origin_url|
+// and |filesystem_id|. If the |optional_root_name| is given the resulting
+// root URI will point to the subfolder within the isolated filesystem.
+WEBKIT_STORAGE_EXPORT std::string GetIsolatedFileSystemRootURIString(
+ const GURL& origin_url,
+ const std::string& filesystem_id,
+ const std::string& optional_root_name);
+
} // namespace fileapi
#endif // WEBKIT_FILEAPI_FILE_SYSTEM_UTIL_H_