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

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

Issue 244056: Add EscapeURL to the ASCII escape methods.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/logging.h" 9 #include "base/logging.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 179
180 // non-printable, non-7bit, and (including space) "#%:<>?[\]^`{|} 180 // non-printable, non-7bit, and (including space) "#%:<>?[\]^`{|}
181 static const Charmap kPathCharmap( 181 static const Charmap kPathCharmap(
182 0xffffffffL, 0xd400002dL, 0x78000000L, 0xb8000001L, 182 0xffffffffL, 0xd400002dL, 0x78000000L, 0xb8000001L,
183 0xffffffffL, 0xffffffffL, 0xffffffffL, 0xffffffffL); 183 0xffffffffL, 0xffffffffL, 0xffffffffL, 0xffffffffL);
184 184
185 std::string EscapePath(const std::string& path) { 185 std::string EscapePath(const std::string& path) {
186 return Escape(path, kPathCharmap, false); 186 return Escape(path, kPathCharmap, false);
187 } 187 }
188 188
189 // non-printable, non-7bit, and (including space) ?>=<;+'&%$#"![\]^`{|}
190 static const Charmap kUrlEscape(
191 0xffffffffL, 0xf80008fdL, 0x78000001L, 0xb8000001L,
192 0xffffffffL, 0xffffffffL, 0xffffffffL, 0xffffffffL
193 );
194
195 std::string EscapeUrl(const std::string& path) {
196 return Escape(path, kUrlEscape, true);
197 }
198
189 // non-7bit 199 // non-7bit
190 static const Charmap kNonASCIICharmap( 200 static const Charmap kNonASCIICharmap(
191 0x00000000L, 0x00000000L, 0x00000000L, 0x00000000L, 201 0x00000000L, 0x00000000L, 0x00000000L, 0x00000000L,
192 0xffffffffL, 0xffffffffL, 0xffffffffL, 0xffffffffL); 202 0xffffffffL, 0xffffffffL, 0xffffffffL, 0xffffffffL);
193 203
194 std::string EscapeNonASCII(const std::string& input) { 204 std::string EscapeNonASCII(const std::string& input) {
195 return Escape(input, kNonASCIICharmap, false); 205 return Escape(input, kNonASCIICharmap, false);
196 } 206 }
197 207
198 // Everything except alphanumerics, the reserved characters(;/?:@&=+$,) and 208 // Everything except alphanumerics, the reserved characters(;/?:@&=+$,) and
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 return result; 289 return result;
280 } 290 }
281 291
282 std::string EscapeForHTML(const std::string& input) { 292 std::string EscapeForHTML(const std::string& input) {
283 return EscapeForHTMLImpl(input); 293 return EscapeForHTMLImpl(input);
284 } 294 }
285 295
286 std::wstring EscapeForHTML(const std::wstring& input) { 296 std::wstring EscapeForHTML(const std::wstring& input) {
287 return EscapeForHTMLImpl(input); 297 return EscapeForHTMLImpl(input);
288 } 298 }
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