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

Unified Diff: components/google/core/browser/google_util.cc

Issue 2966763003: [Prototype] Delete Google service worker caches on Android signout (Closed)
Patch Set: Fix the test. Created 3 years, 5 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: components/google/core/browser/google_util.cc
diff --git a/components/google/core/browser/google_util.cc b/components/google/core/browser/google_util.cc
index b8f8c1daa9ec038d7f0c81704b53f4053a3a4c6f..10712941b77c02ead549d347bd47ff6fd5d667e2 100644
--- a/components/google/core/browser/google_util.cc
+++ b/components/google/core/browser/google_util.cc
@@ -15,6 +15,7 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
+#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "components/google/core/browser/google_switches.h"
#include "components/google/core/browser/google_tld_list.h"
@@ -283,4 +284,29 @@ bool IsYoutubeDomainUrl(const GURL& url,
nullptr);
}
+const std::vector<std::string>& GetGoogleRegisterableDomains() {
+ CR_DEFINE_STATIC_LOCAL(std::vector<std::string>, kGoogleRegisterableDomains,
+ ());
+
+ // Initialize the list.
+ if (kGoogleRegisterableDomains.empty()) {
+ std::vector<std::string> tlds({GOOGLE_TLD_LIST});
Peter Kasting 2017/07/10 19:26:05 Nit: Are () necessary here?
msramek 2017/07/13 14:19:47 Done. No, and I actually didn't know this was poss
+ for (const std::string& tld : tlds) {
+ std::string domain = base::StringPrintf("google.%s", tld.c_str());
Peter Kasting 2017/07/10 19:26:05 Nit: Easier to read, doesn't require an #include,
msramek 2017/07/13 14:19:47 Done.
+
+ // Our list of domains may be slightly out of date.
Peter Kasting 2017/07/10 19:26:05 I kinda don't think you should do this check. It'
msramek 2017/07/13 14:19:47 Sorry, the comment was unhelpful, because I wrote
+ if (GetDomainAndRegistry(
+ domain,
+ net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES) !=
+ domain) {
+ continue;
+ }
+
+ kGoogleRegisterableDomains.push_back(domain);
+ }
+ }
+
+ return kGoogleRegisterableDomains;
+}
+
} // namespace google_util
« components/google/core/browser/google_util.h ('K') | « components/google/core/browser/google_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698