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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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. You should not use this for normal URLs! |
92 CONTROL_CHARS = 8, | 92 CONTROL_CHARS = 8, |
93 | 93 |
94 // URL queries use "+" for space. This flag controls that replacement. | 94 // URL queries use "+" for space. This flag controls that replacement. |
95 REPLACE_PLUS_WITH_SPACE = 16, | 95 REPLACE_PLUS_WITH_SPACE = 16, |
| 96 |
| 97 // Unescapes Bidi characters such as RTL/LTR marks. This should only be used |
| 98 // when parsing data urls, but never be used when displaying the url in |
| 99 // the omnibox. URLs in the omnibox should always escape BiDi control |
| 100 // characters for security reasons. |
| 101 // DO NOT use BIDI_CONTROL_CHARS flag without talking to a security person. |
| 102 BIDI_CONTROL_CHARS = 32, |
96 }; | 103 }; |
97 }; | 104 }; |
98 | 105 |
99 // Unescapes |escaped_text| and returns the result. | 106 // Unescapes |escaped_text| and returns the result. |
100 // Unescaping consists of looking for the exact pattern "%XX", where each X is | 107 // 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 | 108 // a hex digit, and converting to the character with the numerical value of |
102 // those digits. Thus "i%20=%203%3b" unescapes to "i = 3;". | 109 // those digits. Thus "i%20=%203%3b" unescapes to "i = 3;". |
103 // | 110 // |
104 // Watch out: this doesn't necessarily result in the correct final result, | 111 // Watch out: this doesn't necessarily result in the correct final result, |
105 // because the encoding may be unknown. For example, the input might be ASCII, | 112 // because the encoding may be unknown. For example, the input might be ASCII, |
(...skipping 20 matching lines...) Expand all Loading... |
126 UnescapeRule::Type rules, | 133 UnescapeRule::Type rules, |
127 base::OffsetAdjuster::Adjustments* adjustments); | 134 base::OffsetAdjuster::Adjustments* adjustments); |
128 | 135 |
129 // Unescapes the following ampersand character codes from |text|: | 136 // Unescapes the following ampersand character codes from |text|: |
130 // < > & " ' | 137 // < > & " ' |
131 NET_EXPORT base::string16 UnescapeForHTML(const base::string16& text); | 138 NET_EXPORT base::string16 UnescapeForHTML(const base::string16& text); |
132 | 139 |
133 } // namespace net | 140 } // namespace net |
134 | 141 |
135 #endif // NET_BASE_ESCAPE_H_ | 142 #endif // NET_BASE_ESCAPE_H_ |
OLD | NEW |