| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "webkit/fileapi/file_system_util.h" | 5 #include "webkit/fileapi/file_system_util.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 if (bare_url.path().empty()) | 55 if (bare_url.path().empty()) |
| 56 return false; | 56 return false; |
| 57 | 57 |
| 58 origin = bare_url.GetOrigin(); | 58 origin = bare_url.GetOrigin(); |
| 59 | 59 |
| 60 // The input URL was malformed, bail out early. | 60 // The input URL was malformed, bail out early. |
| 61 if (origin.is_empty()) | 61 if (origin.is_empty()) |
| 62 return false; | 62 return false; |
| 63 | 63 |
| 64 std::string path = net::UnescapeURLComponent(bare_url.path(), | 64 std::string path = net::UnescapeURLComponent(bare_url.path(), |
| 65 UnescapeRule::SPACES | UnescapeRule::URL_SPECIAL_CHARS | | 65 net::UnescapeRule::SPACES | net::UnescapeRule::URL_SPECIAL_CHARS | |
| 66 UnescapeRule::CONTROL_CHARS); | 66 net::UnescapeRule::CONTROL_CHARS); |
| 67 if (path.compare(0, strlen(kPersistentDir), kPersistentDir) == 0) { | 67 if (path.compare(0, strlen(kPersistentDir), kPersistentDir) == 0) { |
| 68 file_system_type = kFileSystemTypePersistent; | 68 file_system_type = kFileSystemTypePersistent; |
| 69 path = path.substr(strlen(kPersistentDir)); | 69 path = path.substr(strlen(kPersistentDir)); |
| 70 } else if (path.compare(0, strlen(kTemporaryDir), kTemporaryDir) == 0) { | 70 } else if (path.compare(0, strlen(kTemporaryDir), kTemporaryDir) == 0) { |
| 71 file_system_type = kFileSystemTypeTemporary; | 71 file_system_type = kFileSystemTypeTemporary; |
| 72 path = path.substr(strlen(kTemporaryDir)); | 72 path = path.substr(strlen(kTemporaryDir)); |
| 73 } else if (path.compare(0, strlen(kExternalDir), kExternalDir) == 0) { | 73 } else if (path.compare(0, strlen(kExternalDir), kExternalDir) == 0) { |
| 74 file_system_type = kFileSystemTypeExternal; | 74 file_system_type = kFileSystemTypeExternal; |
| 75 path = path.substr(strlen(kExternalDir)); | 75 path = path.substr(strlen(kExternalDir)); |
| 76 } else { | 76 } else { |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 | 156 |
| 157 // We need this work-around for file:/// URIs as | 157 // We need this work-around for file:/// URIs as |
| 158 // createFromDatabaseIdentifier returns empty origin_url for them. | 158 // createFromDatabaseIdentifier returns empty origin_url for them. |
| 159 if (origin_url.spec().empty() && | 159 if (origin_url.spec().empty() && |
| 160 origin_identifier.find("file__") == 0) | 160 origin_identifier.find("file__") == 0) |
| 161 return GURL("file:///"); | 161 return GURL("file:///"); |
| 162 return origin_url; | 162 return origin_url; |
| 163 } | 163 } |
| 164 | 164 |
| 165 } // namespace fileapi | 165 } // namespace fileapi |
| OLD | NEW |