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

Unified Diff: url/origin.cc

Issue 2378323003: Add url::Origin::GetURL() to convert Origins to URLs without reparsing (Closed)
Patch Set: remove fuzzer Created 4 years, 3 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
« no previous file with comments | « url/origin.h ('k') | url/origin_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: url/origin.cc
diff --git a/url/origin.cc b/url/origin.cc
index a14c8918d35bfbf4430d0d5c5d7ebee577639f95..97afd2a06dc05dbfc4c2505f7b22ca5993501e9b 100644
--- a/url/origin.cc
+++ b/url/origin.cc
@@ -65,6 +65,16 @@ std::string Origin::Serialize() const {
return tuple_.Serialize();
}
+GURL Origin::GetURL() const {
+ if (unique())
+ return GURL("null");
Mike West 2016/09/30 12:37:40 Hrm. I think `GURL::GetOrigin()` returns an empty
Charlie Harrison 2016/09/30 14:29:58 GURL("null") == GURL() so that's fine. I would li
+
+ if (scheme() == kFileScheme)
+ return GURL("file://");
+
+ return tuple_.GetURL();
+}
+
bool Origin::IsSameOriginWith(const Origin& other) const {
if (unique_ || other.unique_)
return false;
« no previous file with comments | « url/origin.h ('k') | url/origin_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698