OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 URL_URL_UTIL_H_ | 5 #ifndef URL_URL_UTIL_H_ |
6 #define URL_URL_UTIL_H_ | 6 #define URL_URL_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
12 #include "base/strings/string_piece.h" | 12 #include "base/strings/string_piece.h" |
13 #include "url/third_party/mozilla/url_parse.h" | 13 #include "url/third_party/mozilla/url_parse.h" |
14 #include "url/url_canon.h" | 14 #include "url/url_canon.h" |
15 #include "url/url_constants.h" | 15 #include "url/url_constants.h" |
16 #include "url/url_export.h" | 16 #include "url/url_export.h" |
17 | 17 |
18 class GURL; | |
19 | |
20 namespace url { | 18 namespace url { |
21 | 19 |
22 // Init ------------------------------------------------------------------------ | 20 // Init ------------------------------------------------------------------------ |
23 | 21 |
24 // Initialization is NOT required, it will be implicitly initialized when first | 22 // Initialization is NOT required, it will be implicitly initialized when first |
25 // used. However, this implicit initialization is NOT threadsafe. If you are | 23 // used. However, this implicit initialization is NOT threadsafe. If you are |
26 // using this library in a threaded environment and don't have a consistent | 24 // using this library in a threaded environment and don't have a consistent |
27 // "first call" (an example might be calling Add*Scheme with your special | 25 // "first call" (an example might be calling Add*Scheme with your special |
28 // application-specific schemes) then you will want to call initialize before | 26 // application-specific schemes) then you will want to call initialize before |
29 // spawning any threads. | 27 // spawning any threads. |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 // the list of allowed schemes for referrers (see AddReferrerScheme). | 159 // the list of allowed schemes for referrers (see AddReferrerScheme). |
162 URL_EXPORT bool IsReferrerScheme(const char* spec, const Component& scheme); | 160 URL_EXPORT bool IsReferrerScheme(const char* spec, const Component& scheme); |
163 | 161 |
164 // Returns true and sets |type| to the SchemeType of the given scheme | 162 // Returns true and sets |type| to the SchemeType of the given scheme |
165 // identified by |scheme| within |spec| if the scheme is in the list of known | 163 // identified by |scheme| within |spec| if the scheme is in the list of known |
166 // standard-format schemes (see AddStandardScheme). | 164 // standard-format schemes (see AddStandardScheme). |
167 URL_EXPORT bool GetStandardSchemeType(const char* spec, | 165 URL_EXPORT bool GetStandardSchemeType(const char* spec, |
168 const Component& scheme, | 166 const Component& scheme, |
169 SchemeType* type); | 167 SchemeType* type); |
170 | 168 |
171 // Check whether the url is of the form about:blank, about:blank?foo or | |
172 // about:blank/#foo. | |
173 URL_EXPORT bool IsAboutBlank(const GURL& url); | |
174 | |
175 // Hosts ---------------------------------------------------------------------- | 169 // Hosts ---------------------------------------------------------------------- |
176 | 170 |
177 // Returns true if the |canonicalized_host| matches or is in the same domain as | 171 // Returns true if the |canonicalized_host| matches or is in the same domain as |
178 // the given |lower_ascii_domain| string. For example, if the canonicalized | 172 // the given |lower_ascii_domain| string. For example, if the canonicalized |
179 // hostname is "www.google.com", this will return true for "com", "google.com", | 173 // hostname is "www.google.com", this will return true for "com", "google.com", |
180 // and "www.google.com" domains. | 174 // and "www.google.com" domains. |
181 // | 175 // |
182 // If either of the input StringPieces is empty, the return value is false. The | 176 // If either of the input StringPieces is empty, the return value is false. The |
183 // input domain should be a lower-case ASCII string in order to match the | 177 // input domain should be a lower-case ASCII string in order to match the |
184 // canonicalized host. | 178 // canonicalized host. |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 | 264 |
271 // Escapes the given string as defined by the JS method encodeURIComponent. See | 265 // Escapes the given string as defined by the JS method encodeURIComponent. See |
272 // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/encodeUR
IComponent | 266 // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/encodeUR
IComponent |
273 URL_EXPORT void EncodeURIComponent(const char* input, | 267 URL_EXPORT void EncodeURIComponent(const char* input, |
274 int length, | 268 int length, |
275 CanonOutput* output); | 269 CanonOutput* output); |
276 | 270 |
277 } // namespace url | 271 } // namespace url |
278 | 272 |
279 #endif // URL_URL_UTIL_H_ | 273 #endif // URL_URL_UTIL_H_ |
OLD | NEW |