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 #include "url/url_canon.h" | 5 #include "url/url_canon.h" |
6 #include "url/url_canon_internal.h" | 6 #include "url/url_canon_internal.h" |
7 | 7 |
8 // Query canonicalization in IE | 8 // Query canonicalization in IE |
9 // ---------------------------- | 9 // ---------------------------- |
10 // IE is very permissive for query parameters specified in links on the page | 10 // IE is very permissive for query parameters specified in links on the page |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 CharsetConverter* converter, | 73 CharsetConverter* converter, |
74 CanonOutput* output) { | 74 CanonOutput* output) { |
75 // This function will replace any misencoded values with the invalid | 75 // This function will replace any misencoded values with the invalid |
76 // character. This is what we want so we don't have to check for error. | 76 // character. This is what we want so we don't have to check for error. |
77 RawCanonOutputW<1024> utf16; | 77 RawCanonOutputW<1024> utf16; |
78 ConvertUTF8ToUTF16(&spec[query.begin], query.len, &utf16); | 78 ConvertUTF8ToUTF16(&spec[query.begin], query.len, &utf16); |
79 converter->ConvertFromUTF16(utf16.data(), utf16.length(), output); | 79 converter->ConvertFromUTF16(utf16.data(), utf16.length(), output); |
80 } | 80 } |
81 | 81 |
82 // Runs the converter with the given UTF-16 input. We don't have to do | 82 // Runs the converter with the given UTF-16 input. We don't have to do |
83 // anything, but this overriddden function allows us to use the same code | 83 // anything, but this overridden function allows us to use the same code |
84 // for both UTF-8 and UTF-16 input. | 84 // for both UTF-8 and UTF-16 input. |
85 void RunConverter(const base::char16* spec, | 85 void RunConverter(const base::char16* spec, |
86 const Component& query, | 86 const Component& query, |
87 CharsetConverter* converter, | 87 CharsetConverter* converter, |
88 CanonOutput* output) { | 88 CanonOutput* output) { |
89 converter->ConvertFromUTF16(&spec[query.begin], query.len, output); | 89 converter->ConvertFromUTF16(&spec[query.begin], query.len, output); |
90 } | 90 } |
91 | 91 |
92 template<typename CHAR, typename UCHAR> | 92 template<typename CHAR, typename UCHAR> |
93 void DoConvertToQueryEncoding(const CHAR* spec, | 93 void DoConvertToQueryEncoding(const CHAR* spec, |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 | 155 |
156 void ConvertUTF16ToQueryEncoding(const base::char16* input, | 156 void ConvertUTF16ToQueryEncoding(const base::char16* input, |
157 const Component& query, | 157 const Component& query, |
158 CharsetConverter* converter, | 158 CharsetConverter* converter, |
159 CanonOutput* output) { | 159 CanonOutput* output) { |
160 DoConvertToQueryEncoding<base::char16, base::char16>(input, query, | 160 DoConvertToQueryEncoding<base::char16, base::char16>(input, query, |
161 converter, output); | 161 converter, output); |
162 } | 162 } |
163 | 163 |
164 } // namespace url | 164 } // namespace url |
OLD | NEW |