OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "net/base/escape.h" | 5 #include "net/base/escape.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 } |
208 | 208 |
209 // non-printable, non-7bit, and (including space) ?>=<;+'&%$#"![\]^`{|} | 209 // non-printable, non-7bit, and (including space) ?>=<;+'&%$#"![\]^`{|} |
210 static const Charmap kUrlEscape( | 210 static const Charmap kUrlEscape( |
211 0xffffffffL, 0xf80008fdL, 0x78000001L, 0xb8000001L, | 211 0xffffffffL, 0xf80008fdL, 0x78000001L, 0xb8000001L, |
212 0xffffffffL, 0xffffffffL, 0xffffffffL, 0xffffffffL | 212 0xffffffffL, 0xffffffffL, 0xffffffffL, 0xffffffffL |
213 ); | 213 ); |
214 | 214 |
215 std::string EscapeUrlEncodedData(const std::string& path, | 215 std::string EscapeUrlEncodedData(const std::string& path) { |
216 bool use_plus) { | 216 return Escape(path, kUrlEscape, true); |
217 return Escape(path, kUrlEscape, use_plus); | |
218 } | 217 } |
219 | 218 |
220 // non-7bit | 219 // non-7bit |
221 static const Charmap kNonASCIICharmap( | 220 static const Charmap kNonASCIICharmap( |
222 0x00000000L, 0x00000000L, 0x00000000L, 0x00000000L, | 221 0x00000000L, 0x00000000L, 0x00000000L, 0x00000000L, |
223 0xffffffffL, 0xffffffffL, 0xffffffffL, 0xffffffffL); | 222 0xffffffffL, 0xffffffffL, 0xffffffffL, 0xffffffffL); |
224 | 223 |
225 std::string EscapeNonASCII(const std::string& input) { | 224 std::string EscapeNonASCII(const std::string& input) { |
226 return Escape(input, kNonASCIICharmap, false); | 225 return Escape(input, kNonASCIICharmap, false); |
227 } | 226 } |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 return; | 379 return; |
381 } | 380 } |
382 if (offset <= (location + 2)) { | 381 if (offset <= (location + 2)) { |
383 offset = string16::npos; | 382 offset = string16::npos; |
384 return; | 383 return; |
385 } | 384 } |
386 adjusted_offset -= 2; | 385 adjusted_offset -= 2; |
387 } | 386 } |
388 offset = adjusted_offset; | 387 offset = adjusted_offset; |
389 } | 388 } |
OLD | NEW |