| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // Functions for canonicalizing "path" URLs. Not to be confused with the path | 5 // Functions for canonicalizing "path" URLs. Not to be confused with the path |
| 6 // of a URL, these are URLs that have no authority section, only a path. For | 6 // of a URL, these are URLs that have no authority section, only a path. For |
| 7 // example, "javascript:" and "data:". | 7 // example, "javascript:" and "data:". |
| 8 | 8 |
| 9 #include "url/url_canon.h" | 9 #include "url/url_canon.h" |
| 10 #include "url/url_canon_internal.h" | 10 #include "url/url_canon_internal.h" |
| 11 | 11 |
| 12 namespace url { | 12 namespace url { |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 // Canonicalize the given |component| from |source| into |output| and | 16 // Canonicalize the given |component| from |source| into |output| and |
| 17 // |new_component|. If |separator| is non-zero, it is pre-pended to |ouput| | 17 // |new_component|. If |separator| is non-zero, it is pre-pended to |output| |
| 18 // prior to the canonicalized component; i.e. for the '?' or '#' characters. | 18 // prior to the canonicalized component; i.e. for the '?' or '#' characters. |
| 19 template<typename CHAR, typename UCHAR> | 19 template<typename CHAR, typename UCHAR> |
| 20 bool DoCanonicalizePathComponent(const CHAR* source, | 20 bool DoCanonicalizePathComponent(const CHAR* source, |
| 21 const Component& component, | 21 const Component& component, |
| 22 char separator, | 22 char separator, |
| 23 CanonOutput* output, | 23 CanonOutput* output, |
| 24 Component* new_component) { | 24 Component* new_component) { |
| 25 bool success = true; | 25 bool success = true; |
| 26 if (component.is_valid()) { | 26 if (component.is_valid()) { |
| 27 if (separator) | 27 if (separator) |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 Parsed* new_parsed) { | 112 Parsed* new_parsed) { |
| 113 RawCanonOutput<1024> utf8; | 113 RawCanonOutput<1024> utf8; |
| 114 URLComponentSource<char> source(base); | 114 URLComponentSource<char> source(base); |
| 115 Parsed parsed(base_parsed); | 115 Parsed parsed(base_parsed); |
| 116 SetupUTF16OverrideComponents(base, replacements, &utf8, &source, &parsed); | 116 SetupUTF16OverrideComponents(base, replacements, &utf8, &source, &parsed); |
| 117 return DoCanonicalizePathURL<char, unsigned char>( | 117 return DoCanonicalizePathURL<char, unsigned char>( |
| 118 source, parsed, output, new_parsed); | 118 source, parsed, output, new_parsed); |
| 119 } | 119 } |
| 120 | 120 |
| 121 } // namespace url | 121 } // namespace url |
| OLD | NEW |