| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "storage/browser/fileapi/file_system_url.h" | 5 #include "storage/browser/fileapi/file_system_url.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 std::string url = GetFileSystemRootURI(origin_, mount_type_).spec(); | 104 std::string url = GetFileSystemRootURI(origin_, mount_type_).spec(); |
| 105 if (url.empty()) | 105 if (url.empty()) |
| 106 return GURL(); | 106 return GURL(); |
| 107 | 107 |
| 108 // Exactly match with DOMFileSystemBase::createFileSystemURL()'s encoding | 108 // Exactly match with DOMFileSystemBase::createFileSystemURL()'s encoding |
| 109 // behavior, where the path is escaped by KURL::encodeWithURLEscapeSequences | 109 // behavior, where the path is escaped by KURL::encodeWithURLEscapeSequences |
| 110 // which is essentially encodeURIComponent except '/'. | 110 // which is essentially encodeURIComponent except '/'. |
| 111 std::string escaped = net::EscapeQueryParamValue( | 111 std::string escaped = net::EscapeQueryParamValue( |
| 112 virtual_path_.NormalizePathSeparatorsTo('/').AsUTF8Unsafe(), | 112 virtual_path_.NormalizePathSeparatorsTo('/').AsUTF8Unsafe(), |
| 113 false /* use_plus */); | 113 false /* use_plus */); |
| 114 ReplaceSubstringsAfterOffset(&escaped, 0, "%2F", "/"); | 114 base::ReplaceSubstringsAfterOffset(&escaped, 0, "%2F", "/"); |
| 115 url.append(escaped); | 115 url.append(escaped); |
| 116 | 116 |
| 117 // Build nested GURL. | 117 // Build nested GURL. |
| 118 return GURL(url); | 118 return GURL(url); |
| 119 } | 119 } |
| 120 | 120 |
| 121 std::string FileSystemURL::DebugString() const { | 121 std::string FileSystemURL::DebugString() const { |
| 122 if (!is_valid_) | 122 if (!is_valid_) |
| 123 return "invalid filesystem: URL"; | 123 return "invalid filesystem: URL"; |
| 124 std::ostringstream ss; | 124 std::ostringstream ss; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 if (lhs.origin_ != rhs.origin_) | 162 if (lhs.origin_ != rhs.origin_) |
| 163 return lhs.origin_ < rhs.origin_; | 163 return lhs.origin_ < rhs.origin_; |
| 164 if (lhs.type_ != rhs.type_) | 164 if (lhs.type_ != rhs.type_) |
| 165 return lhs.type_ < rhs.type_; | 165 return lhs.type_ < rhs.type_; |
| 166 if (lhs.filesystem_id_ != rhs.filesystem_id_) | 166 if (lhs.filesystem_id_ != rhs.filesystem_id_) |
| 167 return lhs.filesystem_id_ < rhs.filesystem_id_; | 167 return lhs.filesystem_id_ < rhs.filesystem_id_; |
| 168 return lhs.path_ < rhs.path_; | 168 return lhs.path_ < rhs.path_; |
| 169 } | 169 } |
| 170 | 170 |
| 171 } // namespace storage | 171 } // namespace storage |
| OLD | NEW |