| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef NET_BASE_ESCAPE_H_ | 5 #ifndef NET_BASE_ESCAPE_H_ |
| 6 #define NET_BASE_ESCAPE_H_ | 6 #define NET_BASE_ESCAPE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // This is basically the same as encodeURIComponent in javascript. | 23 // This is basically the same as encodeURIComponent in javascript. |
| 24 NET_EXPORT std::string EscapeQueryParamValue(const std::string& text, | 24 NET_EXPORT std::string EscapeQueryParamValue(const std::string& text, |
| 25 bool use_plus); | 25 bool use_plus); |
| 26 | 26 |
| 27 // Escapes a partial or complete file/pathname. This includes: | 27 // Escapes a partial or complete file/pathname. This includes: |
| 28 // non-printable, non-7bit, and (including space) "#%:<>?[\]^`{|} | 28 // non-printable, non-7bit, and (including space) "#%:<>?[\]^`{|} |
| 29 // For the base::string16 version, we attempt a conversion to |codepage| before | 29 // For the base::string16 version, we attempt a conversion to |codepage| before |
| 30 // encoding the string. If this conversion fails, we return false. | 30 // encoding the string. If this conversion fails, we return false. |
| 31 NET_EXPORT std::string EscapePath(const std::string& path); | 31 NET_EXPORT std::string EscapePath(const std::string& path); |
| 32 | 32 |
| 33 #if defined(OS_MACOSX) |
| 34 // Escapes characters as per expectations of NSURL. This includes: |
| 35 // non-printable, non-7bit, and (including space) "#%<>[\]^`{|} |
| 36 NET_EXPORT std::string EscapeNSURLPrecursor(const std::string& precursor); |
| 37 #endif // defined(OS_MACOSX) |
| 38 |
| 33 // Escapes application/x-www-form-urlencoded content. This includes: | 39 // Escapes application/x-www-form-urlencoded content. This includes: |
| 34 // non-printable, non-7bit, and (including space) ?>=<;+'&%$#"![\]^`{|} | 40 // non-printable, non-7bit, and (including space) ?>=<;+'&%$#"![\]^`{|} |
| 35 // Space is escaped as + (if use_plus is true) and other special characters | 41 // Space is escaped as + (if use_plus is true) and other special characters |
| 36 // as %XX (hex). | 42 // as %XX (hex). |
| 37 NET_EXPORT std::string EscapeUrlEncodedData(const std::string& path, | 43 NET_EXPORT std::string EscapeUrlEncodedData(const std::string& path, |
| 38 bool use_plus); | 44 bool use_plus); |
| 39 | 45 |
| 40 // Escapes all non-ASCII input. | 46 // Escapes all non-ASCII input. |
| 41 NET_EXPORT std::string EscapeNonASCII(const std::string& input); | 47 NET_EXPORT std::string EscapeNonASCII(const std::string& input); |
| 42 | 48 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 UnescapeRule::Type rules, | 135 UnescapeRule::Type rules, |
| 130 base::OffsetAdjuster::Adjustments* adjustments); | 136 base::OffsetAdjuster::Adjustments* adjustments); |
| 131 | 137 |
| 132 // Unescapes the following ampersand character codes from |text|: | 138 // Unescapes the following ampersand character codes from |text|: |
| 133 // < > & " ' | 139 // < > & " ' |
| 134 NET_EXPORT base::string16 UnescapeForHTML(const base::string16& text); | 140 NET_EXPORT base::string16 UnescapeForHTML(const base::string16& text); |
| 135 | 141 |
| 136 } // namespace net | 142 } // namespace net |
| 137 | 143 |
| 138 #endif // NET_BASE_ESCAPE_H_ | 144 #endif // NET_BASE_ESCAPE_H_ |
| OLD | NEW |