Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(772)

Side by Side Diff: url/gurl.h

Issue 2403713002: Add suborigin logic to url::Origin (Closed)
Patch Set: Minor simplification Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 } 233 }
234 234
235 // Returns true if the scheme indicates a network connection that uses TLS or 235 // Returns true if the scheme indicates a network connection that uses TLS or
236 // some other cryptographic protocol (e.g. QUIC) for security. 236 // some other cryptographic protocol (e.g. QUIC) for security.
237 // 237 //
238 // This function is a not a complete test of whether or not an origin's code 238 // This function is a not a complete test of whether or not an origin's code
239 // is minimally trustworthy. For that, see Chromium's |IsOriginSecure| for a 239 // is minimally trustworthy. For that, see Chromium's |IsOriginSecure| for a
240 // higher-level and more complete semantics. See that function's documentation 240 // higher-level and more complete semantics. See that function's documentation
241 // for more detail. 241 // for more detail.
242 bool SchemeIsCryptographic() const { 242 bool SchemeIsCryptographic() const {
243 return SchemeIs(url::kHttpsScheme) || SchemeIs(url::kWssScheme); 243 return SchemeIs(url::kHttpsScheme) || SchemeIs(url::kWssScheme) ||
244 SchemeIs(url::kHttpsSuboriginScheme);
Mike West 2016/10/11 07:40:41 This needs tests.
jww 2016/10/11 18:16:27 Done.
244 } 245 }
245 246
246 // Returns true if the scheme is "blob". 247 // Returns true if the scheme is "blob".
247 bool SchemeIsBlob() const { 248 bool SchemeIsBlob() const {
248 return SchemeIs(url::kBlobScheme); 249 return SchemeIs(url::kBlobScheme);
249 } 250 }
250 251
252 // Returns true if the scheme indicates a suborigin URL.
253 bool SchemeIsSuborigin() const {
Mike West 2016/10/11 07:40:41 Ditto.
jww 2016/10/11 18:16:27 Done.
254 return SchemeIs(url::kHttpSuboriginScheme) ||
255 SchemeIs(url::kHttpsSuboriginScheme);
256 }
257
251 // The "content" of the URL is everything after the scheme (skipping the 258 // The "content" of the URL is everything after the scheme (skipping the
252 // scheme delimiting colon). It is an error to get the content of an invalid 259 // scheme delimiting colon). It is an error to get the content of an invalid
253 // URL: the result will be an empty string. 260 // URL: the result will be an empty string.
254 std::string GetContent() const; 261 std::string GetContent() const;
255 262
256 // Returns true if the hostname is an IP address. Note: this function isn't 263 // Returns true if the hostname is an IP address. Note: this function isn't
257 // as cheap as a simple getter because it re-parses the hostname to verify. 264 // as cheap as a simple getter because it re-parses the hostname to verify.
258 bool HostIsIPAddress() const; 265 bool HostIsIPAddress() const;
259 266
260 // Not including the colon. If you are comparing schemes, prefer SchemeIs. 267 // Not including the colon. If you are comparing schemes, prefer SchemeIs.
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 url::Parsed parsed_; 448 url::Parsed parsed_;
442 449
443 // Used for nested schemes [currently only filesystem:]. 450 // Used for nested schemes [currently only filesystem:].
444 std::unique_ptr<GURL> inner_url_; 451 std::unique_ptr<GURL> inner_url_;
445 }; 452 };
446 453
447 // Stream operator so GURL can be used in assertion statements. 454 // Stream operator so GURL can be used in assertion statements.
448 URL_EXPORT std::ostream& operator<<(std::ostream& out, const GURL& url); 455 URL_EXPORT std::ostream& operator<<(std::ostream& out, const GURL& url);
449 456
450 #endif // URL_GURL_H_ 457 #endif // URL_GURL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698