| 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 <iosfwd> | 8 #include <iosfwd> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 return SchemeIs(url::kFileScheme); | 218 return SchemeIs(url::kFileScheme); |
| 219 } | 219 } |
| 220 | 220 |
| 221 // FileSystem URLs need to be treated differently in some cases. | 221 // FileSystem URLs need to be treated differently in some cases. |
| 222 bool SchemeIsFileSystem() const { | 222 bool SchemeIsFileSystem() const { |
| 223 return SchemeIs(url::kFileSystemScheme); | 223 return SchemeIs(url::kFileSystemScheme); |
| 224 } | 224 } |
| 225 | 225 |
| 226 // Returns true if the scheme indicates a secure connection. | 226 // Returns true if the scheme indicates a secure connection. |
| 227 // | 227 // |
| 228 // NOTE: This function is deprecated. You probably want |SchemeUsesTLS| (if | 228 // NOTE: This function is deprecated. You probably want |
| 229 // you just want to know if a scheme uses TLS for network transport) or | 229 // |SchemeIsCryptographic| (if you just want to know if a scheme uses TLS for |
| 230 // Chromium's |IsOriginSecure| for a higher-level test about an origin's | 230 // network transport) or Chromium's |IsOriginSecure| for a higher-level test |
| 231 // security. See those functions' documentation for more detail. | 231 // about an origin's security. See those functions' documentation for more |
| 232 // detail. |
| 232 // | 233 // |
| 233 // TODO(palmer): Audit callers and change them to |SchemeUsesTLS| or | 234 // TODO(palmer): Audit callers and change them to |SchemeIsCryptographic| or |
| 234 // |IsOriginSecure|, as appropriate. Then remove |SchemeIsSecure|. | 235 // |IsOriginSecure|, as appropriate. Then remove |SchemeIsSecure|. |
| 235 // crbug.com/362214 | 236 // crbug.com/362214 |
| 236 bool SchemeIsSecure() const { | 237 bool SchemeIsSecure() const { |
| 237 return SchemeIs(url::kHttpsScheme) || SchemeIs(url::kWssScheme) || | 238 return SchemeIs(url::kHttpsScheme) || SchemeIs(url::kWssScheme) || |
| 238 (SchemeIsFileSystem() && inner_url() && | 239 (SchemeIsFileSystem() && inner_url() && |
| 239 inner_url()->SchemeIsSecure()); | 240 inner_url()->SchemeIsSecure()); |
| 240 } | 241 } |
| 241 | 242 |
| 242 // Returns true if the scheme indicates a network connection that uses TLS for | 243 // Returns true if the scheme indicates a network connection that uses TLS or |
| 243 // security. | 244 // some other cryptographic protocol (e.g. QUIC) for security. |
| 244 // | 245 // |
| 245 // This function is a not a complete test of whether or not an origin's code | 246 // This function is a not a complete test of whether or not an origin's code |
| 246 // is minimally trustworthy. For that, see Chromium's |IsOriginSecure| for a | 247 // is minimally trustworthy. For that, see Chromium's |IsOriginSecure| for a |
| 247 // higher-level and more complete semantics. See that function's documentation | 248 // higher-level and more complete semantics. See that function's documentation |
| 248 // for more detail. | 249 // for more detail. |
| 249 bool SchemeUsesTLS() const { | 250 bool SchemeIsCryptographic() const { |
| 250 return SchemeIs(url::kHttpsScheme) || SchemeIs(url::kWssScheme); | 251 return SchemeIs(url::kHttpsScheme) || SchemeIs(url::kWssScheme); |
| 251 } | 252 } |
| 252 | 253 |
| 253 // Returns true if the scheme is "blob". | 254 // Returns true if the scheme is "blob". |
| 254 bool SchemeIsBlob() const { | 255 bool SchemeIsBlob() const { |
| 255 return SchemeIs(url::kBlobScheme); | 256 return SchemeIs(url::kBlobScheme); |
| 256 } | 257 } |
| 257 | 258 |
| 258 // The "content" of the URL is everything after the scheme (skipping the | 259 // The "content" of the URL is everything after the scheme (skipping the |
| 259 // scheme delimiting colon). It is an error to get the origin of an invalid | 260 // scheme delimiting colon). It is an error to get the origin of an invalid |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 // Used for nested schemes [currently only filesystem:]. | 417 // Used for nested schemes [currently only filesystem:]. |
| 417 scoped_ptr<GURL> inner_url_; | 418 scoped_ptr<GURL> inner_url_; |
| 418 | 419 |
| 419 // TODO bug 684583: Add encoding for query params. | 420 // TODO bug 684583: Add encoding for query params. |
| 420 }; | 421 }; |
| 421 | 422 |
| 422 // Stream operator so GURL can be used in assertion statements. | 423 // Stream operator so GURL can be used in assertion statements. |
| 423 URL_EXPORT std::ostream& operator<<(std::ostream& out, const GURL& url); | 424 URL_EXPORT std::ostream& operator<<(std::ostream& out, const GURL& url); |
| 424 | 425 |
| 425 #endif // URL_GURL_H_ | 426 #endif // URL_GURL_H_ |
| OLD | NEW |