| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include "base/string16.h" | 11 #include "base/string16.h" |
| 12 | 12 |
| 13 // Escaping -------------------------------------------------------------------- | 13 // Escaping -------------------------------------------------------------------- |
| 14 | 14 |
| 15 // Escape a file. This includes: | 15 // Escape a file. This includes: |
| 16 // non-printable, non-7bit, and (including space) "#%:<>?[\]^`{|} | 16 // non-printable, non-7bit, and (including space) "#%:<>?[\]^`{|} |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 110 |
| 111 // Escapes characters in text suitable for use as a query parameter value. | 111 // Escapes characters in text suitable for use as a query parameter value. |
| 112 // We %XX everything except alphanumerics and -_.!~*'() | 112 // We %XX everything except alphanumerics and -_.!~*'() |
| 113 // Spaces change to "+" unless you pass usePlus=false. | 113 // Spaces change to "+" unless you pass usePlus=false. |
| 114 // This is basically the same as encodeURIComponent in javascript. | 114 // This is basically the same as encodeURIComponent in javascript. |
| 115 // For the string16 version, we do a conversion to charset before encoding the | 115 // For the string16 version, we do a conversion to charset before encoding the |
| 116 // string. If the charset doesn't exist, we return false. | 116 // string. If the charset doesn't exist, we return false. |
| 117 // | 117 // |
| 118 // TODO(brettw) bug 1201094: This function should be removed. See the bug for | 118 // TODO(brettw) bug 1201094: This function should be removed. See the bug for |
| 119 // why and what callers should do instead. | 119 // why and what callers should do instead. |
| 120 std::string EscapeQueryParamValue(const std::string& text); | |
| 121 std::string EscapeQueryParamValue(const std::string& text, bool use_plus); | 120 std::string EscapeQueryParamValue(const std::string& text, bool use_plus); |
| 122 bool EscapeQueryParamValue(const string16& text, const char* codepage, | 121 bool EscapeQueryParamValue(const string16& text, const char* codepage, |
| 123 string16* escaped); | 122 bool use_plus, string16* escaped); |
| 124 | 123 |
| 125 // A specialized version of EscapeQueryParamValue for wide strings that | 124 // A specialized version of EscapeQueryParamValue for wide strings that |
| 126 // assumes the codepage is UTF8. This is provided as a convenience. | 125 // assumes the codepage is UTF8. This is provided as a convenience. |
| 127 // | 126 // |
| 128 // TODO(brettw) bug 1201094: This function should be removed. See the bug for | 127 // TODO(brettw) bug 1201094: This function should be removed. See the bug for |
| 129 // why and what callers should do instead. | 128 // why and what callers should do instead. |
| 130 std::wstring EscapeQueryParamValueUTF8(const std::wstring& text); | 129 std::wstring EscapeQueryParamValueUTF8(const std::wstring& text, bool use_plus); |
| 131 | 130 |
| 132 #endif // #ifndef NET_BASE_ESCAPE_H__ | 131 #endif // NET_BASE_ESCAPE_H_ |
| OLD | NEW |