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 return Escape(path, kUrlEscape, true); | 216 bool use_plus) { |
| 217 return Escape(path, kUrlEscape, use_plus); |
217 } | 218 } |
218 | 219 |
219 // non-7bit | 220 // non-7bit |
220 static const Charmap kNonASCIICharmap( | 221 static const Charmap kNonASCIICharmap( |
221 0x00000000L, 0x00000000L, 0x00000000L, 0x00000000L, | 222 0x00000000L, 0x00000000L, 0x00000000L, 0x00000000L, |
222 0xffffffffL, 0xffffffffL, 0xffffffffL, 0xffffffffL); | 223 0xffffffffL, 0xffffffffL, 0xffffffffL, 0xffffffffL); |
223 | 224 |
224 std::string EscapeNonASCII(const std::string& input) { | 225 std::string EscapeNonASCII(const std::string& input) { |
225 return Escape(input, kNonASCIICharmap, false); | 226 return Escape(input, kNonASCIICharmap, false); |
226 } | 227 } |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 return; | 380 return; |
380 } | 381 } |
381 if (offset <= (location + 2)) { | 382 if (offset <= (location + 2)) { |
382 offset = string16::npos; | 383 offset = string16::npos; |
383 return; | 384 return; |
384 } | 385 } |
385 adjusted_offset -= 2; | 386 adjusted_offset -= 2; |
386 } | 387 } |
387 offset = adjusted_offset; | 388 offset = adjusted_offset; |
388 } | 389 } |
OLD | NEW |