Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(794)

Side by Side Diff: net/base/escape.cc

Issue 6291003: Revert 71485 - Remove wstring from TemplateURL and friends.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/base/escape.h ('k') | net/base/escape_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <algorithm> 5 #include <algorithm>
6 6
7 #include "net/base/escape.h" 7 #include "net/base/escape.h"
8 8
9 #include "base/i18n/icu_string_conversions.h" 9 #include "base/i18n/icu_string_conversions.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/string_piece.h" 11 #include "base/string_piece.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 static const Charmap kQueryCharmap( 185 static const Charmap kQueryCharmap(
186 0xffffffffL, 0xfc00987dL, 0x78000001L, 0xb8000001L, 186 0xffffffffL, 0xfc00987dL, 0x78000001L, 0xb8000001L,
187 0xffffffffL, 0xffffffffL, 0xffffffffL, 0xffffffffL); 187 0xffffffffL, 0xffffffffL, 0xffffffffL, 0xffffffffL);
188 188
189 std::string EscapeQueryParamValue(const std::string& text, bool use_plus) { 189 std::string EscapeQueryParamValue(const std::string& text, bool use_plus) {
190 return Escape(text, kQueryCharmap, use_plus); 190 return Escape(text, kQueryCharmap, use_plus);
191 } 191 }
192 192
193 // Convert the string to a sequence of bytes and then % escape anything 193 // Convert the string to a sequence of bytes and then % escape anything
194 // except alphanumerics and !'()*-._~ 194 // except alphanumerics and !'()*-._~
195 string16 EscapeQueryParamValueUTF8(const string16& text, 195 std::wstring EscapeQueryParamValueUTF8(const std::wstring& text,
196 bool use_plus) { 196 bool use_plus) {
197 return UTF8ToUTF16(Escape(UTF16ToUTF8(text), kQueryCharmap, use_plus)); 197 return UTF8ToWide(Escape(WideToUTF8(text), kQueryCharmap, use_plus));
198 } 198 }
199 199
200 // non-printable, non-7bit, and (including space) "#%:<>?[\]^`{|} 200 // non-printable, non-7bit, and (including space) "#%:<>?[\]^`{|}
201 static const Charmap kPathCharmap( 201 static const Charmap kPathCharmap(
202 0xffffffffL, 0xd400002dL, 0x78000000L, 0xb8000001L, 202 0xffffffffL, 0xd400002dL, 0x78000000L, 0xb8000001L,
203 0xffffffffL, 0xffffffffL, 0xffffffffL, 0xffffffffL); 203 0xffffffffL, 0xffffffffL, 0xffffffffL, 0xffffffffL);
204 204
205 std::string EscapePath(const std::string& path) { 205 std::string EscapePath(const std::string& path) {
206 return Escape(path, kPathCharmap, false); 206 return Escape(path, kPathCharmap, false);
207 } 207 }
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 if (text.find(ampersand_chars[i], index) == index) { 357 if (text.find(ampersand_chars[i], index) == index) {
358 text.replace(iter, iter + ampersand_chars[i].length(), 358 text.replace(iter, iter + ampersand_chars[i].length(),
359 1, kEscapeToChars[i].replacement); 359 1, kEscapeToChars[i].replacement);
360 break; 360 break;
361 } 361 }
362 } 362 }
363 } 363 }
364 } 364 }
365 return text; 365 return text;
366 } 366 }
OLDNEW
« no previous file with comments | « net/base/escape.h ('k') | net/base/escape_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698