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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 81 |
82 // Unescapes various characters that will change the meaning of URLs, | 82 // Unescapes various characters that will change the meaning of URLs, |
83 // including '%', '+', '&', '/', '#'. If we unescaped these characters, the | 83 // including '%', '+', '&', '/', '#'. If we unescaped these characters, the |
84 // resulting URL won't be the same as the source one. This flag is used when | 84 // resulting URL won't be the same as the source one. This flag is used when |
85 // generating final output like filenames for URLs where we won't be | 85 // generating final output like filenames for URLs where we won't be |
86 // interpreting as a URL and want to do as much unescaping as possible. | 86 // interpreting as a URL and want to do as much unescaping as possible. |
87 URL_SPECIAL_CHARS = 4, | 87 URL_SPECIAL_CHARS = 4, |
88 | 88 |
89 // Unescapes control characters such as %01. This INCLUDES NULLs. This is | 89 // Unescapes control characters such as %01. This INCLUDES NULLs. This is |
90 // used for rare cases such as data: URL decoding where the result is binary | 90 // used for rare cases such as data: URL decoding where the result is binary |
91 // data. You should not use this for normal URLs! | 91 // data. This flag also unescapes BiDi control characters. |
| 92 // |
| 93 // DO NOT use CONTROL_CHARS if the URL is going to be displayed in the UI |
| 94 // for security reasons. |
92 CONTROL_CHARS = 8, | 95 CONTROL_CHARS = 8, |
93 | 96 |
94 // URL queries use "+" for space. This flag controls that replacement. | 97 // URL queries use "+" for space. This flag controls that replacement. |
95 REPLACE_PLUS_WITH_SPACE = 16, | 98 REPLACE_PLUS_WITH_SPACE = 16, |
96 }; | 99 }; |
97 }; | 100 }; |
98 | 101 |
99 // Unescapes |escaped_text| and returns the result. | 102 // Unescapes |escaped_text| and returns the result. |
100 // Unescaping consists of looking for the exact pattern "%XX", where each X is | 103 // Unescaping consists of looking for the exact pattern "%XX", where each X is |
101 // a hex digit, and converting to the character with the numerical value of | 104 // a hex digit, and converting to the character with the numerical value of |
(...skipping 24 matching lines...) Expand all Loading... |
126 UnescapeRule::Type rules, | 129 UnescapeRule::Type rules, |
127 base::OffsetAdjuster::Adjustments* adjustments); | 130 base::OffsetAdjuster::Adjustments* adjustments); |
128 | 131 |
129 // Unescapes the following ampersand character codes from |text|: | 132 // Unescapes the following ampersand character codes from |text|: |
130 // < > & " ' | 133 // < > & " ' |
131 NET_EXPORT base::string16 UnescapeForHTML(const base::string16& text); | 134 NET_EXPORT base::string16 UnescapeForHTML(const base::string16& text); |
132 | 135 |
133 } // namespace net | 136 } // namespace net |
134 | 137 |
135 #endif // NET_BASE_ESCAPE_H_ | 138 #endif // NET_BASE_ESCAPE_H_ |
OLD | NEW |