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

Unified Diff: url/origin.h

Issue 1726323002: Have Permission{Manager,Service} use Origin. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
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_; }
+
// 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);
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/permissions/chromium/test-change-event-worker.html ('k') | url/origin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698