diff options
author | calvinlo@chromium.org <calvinlo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-05 06:45:53 +0000 |
---|---|---|
committer | calvinlo@chromium.org <calvinlo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-05 06:45:53 +0000 |
commit | 3e4ec1b3cb82efd6e2ebf15c8d379e147f623a90 (patch) | |
tree | 1e329da92f01b28d2985d74fa53e767ba45e3f6e /webkit/fileapi/file_system_util.cc | |
parent | 99ef93de56bae720a4a7d188d7fc631088613b05 (diff) | |
download | chromium_src-3e4ec1b3cb82efd6e2ebf15c8d379e147f623a90.zip chromium_src-3e4ec1b3cb82efd6e2ebf15c8d379e147f623a90.tar.gz chromium_src-3e4ec1b3cb82efd6e2ebf15c8d379e147f623a90.tar.bz2 |
Convert public CrackFileSystem() from FileSystemUtil to private static helper function in FileSystemURL. Previous callers should use FileSystemURL constructor instead.
BUG=144088
Review URL: https://chromiumcodereview.appspot.com/10916049
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@154903 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/fileapi/file_system_util.cc')
-rw-r--r-- | webkit/fileapi/file_system_util.cc | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/webkit/fileapi/file_system_util.cc b/webkit/fileapi/file_system_util.cc index 55c98a6..4ae6217 100644 --- a/webkit/fileapi/file_system_util.cc +++ b/webkit/fileapi/file_system_util.cc @@ -12,7 +12,6 @@ #include "base/sys_string_conversions.h" #include "base/utf_string_conversions.h" #include "googleurl/src/gurl.h" -#include "net/base/escape.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" @@ -32,62 +31,6 @@ const char kIsolatedName[] = "Isolated"; const char kExternalName[] = "External"; const char kTestName[] = "Test"; -bool CrackFileSystemURL(const GURL& url, GURL* origin_url, FileSystemType* type, - FilePath* file_path) { - GURL origin; - FileSystemType file_system_type = kFileSystemTypeUnknown; - - if (!url.is_valid() || !url.SchemeIsFileSystem()) - return false; - DCHECK(url.inner_url()); - - std::string inner_path = url.inner_url()->path(); - - const struct { - FileSystemType type; - const char* dir; - } kValidTypes[] = { - { kFileSystemTypePersistent, kPersistentDir }, - { kFileSystemTypeTemporary, kTemporaryDir }, - { kFileSystemTypeIsolated, kIsolatedDir }, - { kFileSystemTypeExternal, kExternalDir }, - { kFileSystemTypeTest, kTestDir }, - }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kValidTypes); ++i) { - if (StartsWithASCII(inner_path, kValidTypes[i].dir, true)) { - 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); - - FilePath converted_path = 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 (type) - *type = file_system_type; - if (file_path) - *file_path = converted_path.NormalizePathSeparators(). - StripTrailingSeparators(); - - return true; -} - // TODO(ericu): Consider removing support for '\', even on Windows, if possible. // There's a lot of test code that will need reworking, and we may have trouble // with FilePath elsewhere [e.g. DirName and other methods may also need |