Chromium Code Reviews| Index: url/origin.h |
| diff --git a/url/origin.h b/url/origin.h |
| index aab1f05a2013cc84cd4aedbb91a9e10b0df88307..5c2600ffe4a4f39086057f34d0f7404af063551e 100644 |
| --- a/url/origin.h |
| +++ b/url/origin.h |
| @@ -89,6 +89,9 @@ class URL_EXPORT Origin { |
| // 3. 'file' URLs all parse as ("file", "", 0). |
| explicit Origin(const GURL& url); |
| + // A convenience: Origin(GURL(url_string)). |
| + explicit Origin(const std::string& url_string); |
| + |
| // Creates an Origin from a |scheme|, |host|, and |port|. All the parameters |
| // must be valid and canonicalized. In particular, note that this cannot be |
| // used to create unique origins; 'url::Origin()' is the right way to do that. |
| @@ -111,6 +114,10 @@ class URL_EXPORT Origin { |
| bool unique() const { return unique_; } |
| + // An Origin is empty if it was constructed from an empty GURL or empty |
| + // string. Empty Origins are equal to each other, but not to unique Origins. |
| + bool empty() const { return empty_; } |
|
palmer
2016/03/03 23:18:05
mkwst: Maybe we should name this |was_constructed_
|
| + |
| // An ASCII serialization of the Origin as per Section 6.2 of RFC 6454, with |
| // the addition that all Origins with a 'file' scheme serialize to "file://". |
| std::string Serialize() const; |
| @@ -131,6 +138,7 @@ class URL_EXPORT Origin { |
| SchemeHostPort tuple_; |
| bool unique_; |
| + bool empty_; |
| }; |
| URL_EXPORT std::ostream& operator<<(std::ostream& out, const Origin& origin); |