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

Side by Side 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, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/public/common/origin_util.h" 5 #include "content/public/common/origin_util.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "content/public/common/content_client.h" 10 #include "content/public/common/content_client.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 return true; 83 return true;
84 } 84 }
85 85
86 return false; 86 return false;
87 } 87 }
88 88
89 void ResetSchemesAndOriginsWhitelistForTesting() { 89 void ResetSchemesAndOriginsWhitelistForTesting() {
90 g_trustworthy_whitelist.Get().Reset(); 90 g_trustworthy_whitelist.Get().Reset();
91 } 91 }
92 92
93 bool HasSuborigin(const GURL& url) {
94 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
95 }
96
97 std::string SuboriginFromUrl(const GURL& url) {
98 if (!HasSuborigin(url))
99 return "";
100 size_t suborigin_end = url.host().find("_");
101 return url.host().substr(0, suborigin_end);
102 }
103
104 std::string HostFromUrlStripSuborigin(const GURL& url) {
105 std::string host = url.host();
106 size_t suborigin_end = host.find("_");
107 if (suborigin_end == std::string::npos)
108 return host;
109 return url.host().substr(suborigin_end + 1,
110 host.length() - suborigin_end - 1);
111 }
112
93 } // namespace content 113 } // namespace content
OLDNEW
« 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