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

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: Fix comment spacing 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
Index: content/common/origin_util.cc
diff --git a/content/common/origin_util.cc b/content/common/origin_util.cc
index 11873d63cfd9de6f8b7b2c4592d785abef089e42..3dcc1558f7a679d2522a12aea0ee6b3d0b52c456 100644
--- a/content/common/origin_util.cc
+++ b/content/common/origin_util.cc
@@ -90,4 +90,24 @@ void ResetSchemesAndOriginsWhitelistForTesting() {
g_trustworthy_whitelist.Get().Reset();
}
+bool HasSuborigin(const GURL& url) {
+ return url.host().find("_") != std::string::npos;
nasko 2016/09/26 18:26:13 Huh, I thought we changed how we serialize suborig
jww 2016/09/26 21:18:57 Indeed! I'm a moron. New patch should address this
+}
+
+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
« no previous file with comments | « chrome/browser/browsing_data/mock_browsing_data_local_storage_helper.cc ('k') | content/common/origin_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698