diff options
author | mgiuca@chromium.org <mgiuca@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-27 12:53:40 +0000 |
---|---|---|
committer | mgiuca@chromium.org <mgiuca@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-27 12:53:40 +0000 |
commit | d9f0854c0d67f8700365558f18a988cd17bec713 (patch) | |
tree | 6695e66f716b63f703893a41178e8e42a6eb679c /webkit/browser | |
parent | b5070fa907919d92dc71bc197810f2305fe71b28 (diff) | |
download | chromium_src-d9f0854c0d67f8700365558f18a988cd17bec713.zip chromium_src-d9f0854c0d67f8700365558f18a988cd17bec713.tar.gz chromium_src-d9f0854c0d67f8700365558f18a988cd17bec713.tar.bz2 |
Moved ParseFileSystemSchemeURL from file_system_url to file_system_util.
This makes it available to renderer code (previously it was only
available to the browser), which will be required to receive file system
objects from Pepper plugins. The static method was not really related to
the FileSystemURL class, it's just used by FileSystemURL's
implementation (among other uses), so it did not belong there anyway.
BUG=345158
Review URL: https://codereview.chromium.org/176263003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@253759 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/browser')
-rw-r--r-- | webkit/browser/fileapi/file_system_url.cc | 63 | ||||
-rw-r--r-- | webkit/browser/fileapi/file_system_url.h | 6 |
2 files changed, 0 insertions, 69 deletions
diff --git a/webkit/browser/fileapi/file_system_url.cc b/webkit/browser/fileapi/file_system_url.cc index b045ed3..9d366b8 100644 --- a/webkit/browser/fileapi/file_system_url.cc +++ b/webkit/browser/fileapi/file_system_url.cc @@ -7,8 +7,6 @@ #include <sstream> #include "base/logging.h" -#include "base/strings/string_util.h" -#include "net/base/escape.h" #include "webkit/common/fileapi/file_system_types.h" #include "webkit/common/fileapi/file_system_util.h" @@ -36,67 +34,6 @@ FileSystemURL FileSystemURL::CreateForTest(const GURL& origin, return FileSystemURL(origin, mount_type, virtual_path); } -// static -bool FileSystemURL::ParseFileSystemSchemeURL( - const GURL& url, - GURL* origin_url, - FileSystemType* mount_type, - base::FilePath* virtual_path) { - GURL origin; - FileSystemType file_system_type = kFileSystemTypeUnknown; - - if (!url.is_valid() || !url.SchemeIsFileSystem()) - return false; - - const struct { - FileSystemType type; - const char* dir; - } kValidTypes[] = { - { kFileSystemTypePersistent, kPersistentDir }, - { kFileSystemTypeTemporary, kTemporaryDir }, - { kFileSystemTypeIsolated, kIsolatedDir }, - { kFileSystemTypeExternal, kExternalDir }, - { kFileSystemTypeTest, kTestDir }, - }; - - // A path of the inner_url contains only mount type part (e.g. "/temporary"). - DCHECK(url.inner_url()); - std::string inner_path = url.inner_url()->path(); - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kValidTypes); ++i) { - if (inner_path == kValidTypes[i].dir) { - file_system_type = kValidTypes[i].type; - break; - } - } - - if (file_system_type == kFileSystemTypeUnknown) - return false; - - std::string path = net::UnescapeURLComponent(url.path(), - net::UnescapeRule::SPACES | net::UnescapeRule::URL_SPECIAL_CHARS | - net::UnescapeRule::CONTROL_CHARS); - - // Ensure the path is relative. - while (!path.empty() && path[0] == '/') - path.erase(0, 1); - - base::FilePath converted_path = base::FilePath::FromUTF8Unsafe(path); - - // All parent references should have been resolved in the renderer. - if (converted_path.ReferencesParent()) - return false; - - if (origin_url) - *origin_url = url.GetOrigin(); - if (mount_type) - *mount_type = file_system_type; - if (virtual_path) - *virtual_path = converted_path.NormalizePathSeparators(). - StripTrailingSeparators(); - - return true; -} - FileSystemURL::FileSystemURL(const GURL& url) : mount_type_(kFileSystemTypeUnknown), type_(kFileSystemTypeUnknown), diff --git a/webkit/browser/fileapi/file_system_url.h b/webkit/browser/fileapi/file_system_url.h index c00231d..9011203 100644 --- a/webkit/browser/fileapi/file_system_url.h +++ b/webkit/browser/fileapi/file_system_url.h @@ -87,12 +87,6 @@ class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemURL { FileSystemType mount_type, const base::FilePath& virtual_path); - // Parses filesystem scheme |url| into uncracked FileSystemURL components. - static bool ParseFileSystemSchemeURL(const GURL& url, - GURL* origin, - FileSystemType* mount_type, - base::FilePath* virtual_path); - // Returns true if this instance represents a valid FileSystem URL. bool is_valid() const { return is_valid_; } |