Chromium Code Reviews| 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 | |
| 18 namespace url { | 20 namespace url { |
| 19 | 21 |
| 20 // Init ------------------------------------------------------------------------ | 22 // Init ------------------------------------------------------------------------ |
| 21 | 23 |
| 22 // Initialization is NOT required, it will be implicitly initialized when first | 24 // Initialization is NOT required, it will be implicitly initialized when first |
| 23 // used. However, this implicit initialization is NOT threadsafe. If you are | 25 // used. However, this implicit initialization is NOT threadsafe. If you are |
| 24 // using this library in a threaded environment and don't have a consistent | 26 // using this library in a threaded environment and don't have a consistent |
| 25 // "first call" (an example might be calling Add*Scheme with your special | 27 // "first call" (an example might be calling Add*Scheme with your special |
| 26 // application-specific schemes) then you will want to call initialize before | 28 // application-specific schemes) then you will want to call initialize before |
| 27 // spawning any threads. | 29 // spawning any threads. |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 146 // the list of allowed schemes for referrers (see AddReferrerScheme). | 148 // the list of allowed schemes for referrers (see AddReferrerScheme). |
| 147 URL_EXPORT bool IsReferrerScheme(const char* spec, const Component& scheme); | 149 URL_EXPORT bool IsReferrerScheme(const char* spec, const Component& scheme); |
| 148 | 150 |
| 149 // Returns true and sets |type| to the SchemeType of the given scheme | 151 // Returns true and sets |type| to the SchemeType of the given scheme |
| 150 // identified by |scheme| within |spec| if the scheme is in the list of known | 152 // identified by |scheme| within |spec| if the scheme is in the list of known |
| 151 // standard-format schemes (see AddStandardScheme). | 153 // standard-format schemes (see AddStandardScheme). |
| 152 URL_EXPORT bool GetStandardSchemeType(const char* spec, | 154 URL_EXPORT bool GetStandardSchemeType(const char* spec, |
| 153 const Component& scheme, | 155 const Component& scheme, |
| 154 SchemeType* type); | 156 SchemeType* type); |
| 155 | 157 |
| 158 // Check whether the url is of the form about:blank, about:blank?foo or | |
| 159 // about:blank/#foo. | |
| 160 URL_EXPORT bool IsAboutBlank(const GURL& url); | |
|
brettw
2017/01/26 21:30:43
url_util is not right right place for this functio
| |
| 161 | |
| 156 // Hosts ---------------------------------------------------------------------- | 162 // Hosts ---------------------------------------------------------------------- |
| 157 | 163 |
| 158 // Returns true if the |canonicalized_host| matches or is in the same domain as | 164 // Returns true if the |canonicalized_host| matches or is in the same domain as |
| 159 // the given |lower_ascii_domain| string. For example, if the canonicalized | 165 // the given |lower_ascii_domain| string. For example, if the canonicalized |
| 160 // hostname is "www.google.com", this will return true for "com", "google.com", | 166 // hostname is "www.google.com", this will return true for "com", "google.com", |
| 161 // and "www.google.com" domains. | 167 // and "www.google.com" domains. |
| 162 // | 168 // |
| 163 // If either of the input StringPieces is empty, the return value is false. The | 169 // If either of the input StringPieces is empty, the return value is false. The |
| 164 // input domain should be a lower-case ASCII string in order to match the | 170 // input domain should be a lower-case ASCII string in order to match the |
| 165 // canonicalized host. | 171 // canonicalized host. |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 251 | 257 |
| 252 // Escapes the given string as defined by the JS method encodeURIComponent. See | 258 // Escapes the given string as defined by the JS method encodeURIComponent. See |
| 253 // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/encodeUR IComponent | 259 // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/encodeUR IComponent |
| 254 URL_EXPORT void EncodeURIComponent(const char* input, | 260 URL_EXPORT void EncodeURIComponent(const char* input, |
| 255 int length, | 261 int length, |
| 256 CanonOutput* output); | 262 CanonOutput* output); |
| 257 | 263 |
| 258 } // namespace url | 264 } // namespace url |
| 259 | 265 |
| 260 #endif // URL_URL_UTIL_H_ | 266 #endif // URL_URL_UTIL_H_ |
| OLD | NEW |