| OLD | NEW |
| 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 #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 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 | 11 |
| 12 // Escaping -------------------------------------------------------------------- | 12 // Escaping -------------------------------------------------------------------- |
| 13 | 13 |
| 14 // Escape a file or url path. This includes: | 14 // Escape a file. This includes: |
| 15 // non-printable, non-7bit, and (including space) "#%:<>?[\]^`{|} | 15 // non-printable, non-7bit, and (including space) "#%:<>?[\]^`{|} |
| 16 std::string EscapePath(const std::string& path); | 16 std::string EscapePath(const std::string& path); |
| 17 | 17 |
| 18 // Escape an url. This includes: |
| 19 // non-printable, non-7bit, and (including space) ?>=<;+'&%$#"![\]^`{|} |
| 20 // Space is escaped as + and other special characters as %XX (hex). |
| 21 std::string EscapeUrl(const std::string& path); |
| 22 |
| 18 // Escape all non-ASCII input. | 23 // Escape all non-ASCII input. |
| 19 std::string EscapeNonASCII(const std::string& input); | 24 std::string EscapeNonASCII(const std::string& input); |
| 20 | 25 |
| 21 // Escapes characters in text suitable for use as an external protocol handler | 26 // Escapes characters in text suitable for use as an external protocol handler |
| 22 // command. | 27 // command. |
| 23 // We %XX everything except alphanumerics and %-_.!~*'() and the restricted | 28 // We %XX everything except alphanumerics and %-_.!~*'() and the restricted |
| 24 // chracters (;/?:@&=+$,). | 29 // chracters (;/?:@&=+$,). |
| 25 std::string EscapeExternalHandlerValue(const std::string& text); | 30 std::string EscapeExternalHandlerValue(const std::string& text); |
| 26 | 31 |
| 27 // Append the given character to the output string, escaping the character if | 32 // Append the given character to the output string, escaping the character if |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 std::wstring* escaped); | 120 std::wstring* escaped); |
| 116 | 121 |
| 117 // A specialized version of EscapeQueryParamValue for wide strings that | 122 // A specialized version of EscapeQueryParamValue for wide strings that |
| 118 // assumes the codepage is UTF8. This is provided as a convenience. | 123 // assumes the codepage is UTF8. This is provided as a convenience. |
| 119 // | 124 // |
| 120 // TODO(brettw) bug 1201094: This function should be removed. See the bug for | 125 // TODO(brettw) bug 1201094: This function should be removed. See the bug for |
| 121 // why and what callers should do instead. | 126 // why and what callers should do instead. |
| 122 std::wstring EscapeQueryParamValueUTF8(const std::wstring& text); | 127 std::wstring EscapeQueryParamValueUTF8(const std::wstring& text); |
| 123 | 128 |
| 124 #endif // #ifndef NET_BASE_ESCAPE_H__ | 129 #endif // #ifndef NET_BASE_ESCAPE_H__ |
| OLD | NEW |