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

Unified Diff: content/common/origin_util.cc

Issue 2005783005: Re-enable storage for Suborigins. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Created 4 years, 7 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: content/common/origin_util.cc
diff --git a/content/common/origin_util.cc b/content/common/origin_util.cc
index 4dfdc6ce8caf7efae0598c82dace3bc6171e8b65..bdf3795d4693af2d08e39c47d9a8790ecccaf764 100644
--- a/content/common/origin_util.cc
+++ b/content/common/origin_util.cc
@@ -86,4 +86,24 @@ void ResetSchemesAndOriginsWhitelistForTesting() {
g_trustworthy_whitelist.Get().Reset();
}
+bool HasSuborigin(const GURL& url) {
+ return url.host().find("_") != std::string::npos;
+}
+
+std::string SuboriginFromUrl(const GURL& url) {
+ if (!HasSuborigin(url))
+ return "";
+ size_t suborigin_end = url.host().find("_");
+ return url.host().substr(0, suborigin_end);
+}
+
+std::string HostFromUrlStripSuborigin(const GURL& url) {
+ std::string host = url.host();
+ size_t suborigin_end = host.find("_");
+ if (suborigin_end == std::string::npos)
+ return host;
+ return url.host().substr(suborigin_end + 1,
+ host.length() - suborigin_end - 1);
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698