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_GURL_H_ | 5 #ifndef URL_GURL_H_ |
6 #define URL_GURL_H_ | 6 #define URL_GURL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <iosfwd> | 10 #include <iosfwd> |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 } | 229 } |
230 | 230 |
231 // Returns true if the scheme indicates a network connection that uses TLS or | 231 // Returns true if the scheme indicates a network connection that uses TLS or |
232 // some other cryptographic protocol (e.g. QUIC) for security. | 232 // some other cryptographic protocol (e.g. QUIC) for security. |
233 // | 233 // |
234 // This function is a not a complete test of whether or not an origin's code | 234 // This function is a not a complete test of whether or not an origin's code |
235 // is minimally trustworthy. For that, see Chromium's |IsOriginSecure| for a | 235 // is minimally trustworthy. For that, see Chromium's |IsOriginSecure| for a |
236 // higher-level and more complete semantics. See that function's documentation | 236 // higher-level and more complete semantics. See that function's documentation |
237 // for more detail. | 237 // for more detail. |
238 bool SchemeIsCryptographic() const { | 238 bool SchemeIsCryptographic() const { |
239 return SchemeIs(url::kHttpsScheme) || SchemeIs(url::kWssScheme); | 239 return SchemeIs(url::kHttpsScheme) || SchemeIs(url::kWssScheme) || |
| 240 SchemeIs(url::kHttpsSuboriginScheme); |
240 } | 241 } |
241 | 242 |
242 // Returns true if the scheme is "blob". | 243 // Returns true if the scheme is "blob". |
243 bool SchemeIsBlob() const { | 244 bool SchemeIsBlob() const { |
244 return SchemeIs(url::kBlobScheme); | 245 return SchemeIs(url::kBlobScheme); |
245 } | 246 } |
246 | 247 |
| 248 // Returns true if the scheme indicates a serialized suborigin. |
| 249 bool SchemeIsSuborigin() const { |
| 250 return SchemeIs(url::kHttpSuboriginScheme) || |
| 251 SchemeIs(url::kHttpsSuboriginScheme); |
| 252 } |
| 253 |
247 // The "content" of the URL is everything after the scheme (skipping the | 254 // The "content" of the URL is everything after the scheme (skipping the |
248 // scheme delimiting colon). It is an error to get the content of an invalid | 255 // scheme delimiting colon). It is an error to get the content of an invalid |
249 // URL: the result will be an empty string. | 256 // URL: the result will be an empty string. |
250 std::string GetContent() const; | 257 std::string GetContent() const; |
251 | 258 |
252 // Returns true if the hostname is an IP address. Note: this function isn't | 259 // Returns true if the hostname is an IP address. Note: this function isn't |
253 // as cheap as a simple getter because it re-parses the hostname to verify. | 260 // as cheap as a simple getter because it re-parses the hostname to verify. |
254 bool HostIsIPAddress() const; | 261 bool HostIsIPAddress() const; |
255 | 262 |
256 // Not including the colon. If you are comparing schemes, prefer SchemeIs. | 263 // Not including the colon. If you are comparing schemes, prefer SchemeIs. |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 URL_EXPORT bool operator==(const GURL& x, const GURL& y); | 453 URL_EXPORT bool operator==(const GURL& x, const GURL& y); |
447 URL_EXPORT bool operator!=(const GURL& x, const GURL& y); | 454 URL_EXPORT bool operator!=(const GURL& x, const GURL& y); |
448 | 455 |
449 // Equality operator for comparing raw spec_. This should be used in place of | 456 // Equality operator for comparing raw spec_. This should be used in place of |
450 // url == GURL(spec) where |spec| is known (i.e. constants). This is to prevent | 457 // url == GURL(spec) where |spec| is known (i.e. constants). This is to prevent |
451 // needlessly re-parsing |spec| into a temporary GURL. | 458 // needlessly re-parsing |spec| into a temporary GURL. |
452 URL_EXPORT bool operator==(const GURL& x, const base::StringPiece& spec); | 459 URL_EXPORT bool operator==(const GURL& x, const base::StringPiece& spec); |
453 URL_EXPORT bool operator!=(const GURL& x, const base::StringPiece& spec); | 460 URL_EXPORT bool operator!=(const GURL& x, const base::StringPiece& spec); |
454 | 461 |
455 #endif // URL_GURL_H_ | 462 #endif // URL_GURL_H_ |
OLD | NEW |