| 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 // are often treated separately by some programs. | 204 // are often treated separately by some programs. |
| 205 bool SchemeIsFile() const { | 205 bool SchemeIsFile() const { |
| 206 return SchemeIs(url::kFileScheme); | 206 return SchemeIs(url::kFileScheme); |
| 207 } | 207 } |
| 208 | 208 |
| 209 // FileSystem URLs need to be treated differently in some cases. | 209 // FileSystem URLs need to be treated differently in some cases. |
| 210 bool SchemeIsFileSystem() const { | 210 bool SchemeIsFileSystem() const { |
| 211 return SchemeIs(url::kFileSystemScheme); | 211 return SchemeIs(url::kFileSystemScheme); |
| 212 } | 212 } |
| 213 | 213 |
| 214 // Returns true if the scheme indicates a secure connection. | |
| 215 // | |
| 216 // NOTE: This function is deprecated. You probably want | |
| 217 // |SchemeIsCryptographic| (if you just want to know if a scheme uses TLS for | |
| 218 // network transport) or Chromium's |IsOriginSecure| for a higher-level test | |
| 219 // about an origin's security. See those functions' documentation for more | |
| 220 // detail. | |
| 221 // | |
| 222 // TODO(palmer): Audit callers and change them to |SchemeIsCryptographic| or | |
| 223 // |IsOriginSecure|, as appropriate. Then remove |SchemeIsSecure|. | |
| 224 // crbug.com/362214 | |
| 225 bool SchemeIsSecure() const { | |
| 226 return SchemeIs(url::kHttpsScheme) || SchemeIs(url::kWssScheme) || | |
| 227 (SchemeIsFileSystem() && inner_url() && | |
| 228 inner_url()->SchemeIsSecure()); | |
| 229 } | |
| 230 | |
| 231 // Returns true if the scheme indicates a network connection that uses TLS or | 214 // Returns true if the scheme indicates a network connection that uses TLS or |
| 232 // some other cryptographic protocol (e.g. QUIC) for security. | 215 // some other cryptographic protocol (e.g. QUIC) for security. |
| 233 // | 216 // |
| 234 // This function is a not a complete test of whether or not an origin's code | 217 // 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 | 218 // is minimally trustworthy. For that, see Chromium's |IsOriginSecure| for a |
| 236 // higher-level and more complete semantics. See that function's documentation | 219 // higher-level and more complete semantics. See that function's documentation |
| 237 // for more detail. | 220 // for more detail. |
| 238 bool SchemeIsCryptographic() const { | 221 bool SchemeIsCryptographic() const { |
| 239 return SchemeIs(url::kHttpsScheme) || SchemeIs(url::kWssScheme); | 222 return SchemeIs(url::kHttpsScheme) || SchemeIs(url::kWssScheme); |
| 240 } | 223 } |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 // Used for nested schemes [currently only filesystem:]. | 380 // Used for nested schemes [currently only filesystem:]. |
| 398 scoped_ptr<GURL> inner_url_; | 381 scoped_ptr<GURL> inner_url_; |
| 399 | 382 |
| 400 // TODO bug 684583: Add encoding for query params. | 383 // TODO bug 684583: Add encoding for query params. |
| 401 }; | 384 }; |
| 402 | 385 |
| 403 // Stream operator so GURL can be used in assertion statements. | 386 // Stream operator so GURL can be used in assertion statements. |
| 404 URL_EXPORT std::ostream& operator<<(std::ostream& out, const GURL& url); | 387 URL_EXPORT std::ostream& operator<<(std::ostream& out, const GURL& url); |
| 405 | 388 |
| 406 #endif // URL_GURL_H_ | 389 #endif // URL_GURL_H_ |
| OLD | NEW |