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..845e22a633c5ceeacc1cbae42fa3343cea0eb256 100644 |
--- a/components/google/core/browser/google_util.cc |
+++ b/components/google/core/browser/google_util.cc |
@@ -283,4 +283,30 @@ bool IsYoutubeDomainUrl(const GURL& url, |
nullptr); |
} |
+const std::vector<std::string>& GetGoogleRegistrableDomains() { |
+ CR_DEFINE_STATIC_LOCAL(std::vector<std::string>, kGoogleRegisterableDomains, |
+ ()); |
+ |
+ // Initialize the list. |
+ if (kGoogleRegisterableDomains.empty()) { |
+ std::vector<std::string> tlds{GOOGLE_TLD_LIST}; |
+ for (const std::string& tld : tlds) { |
+ std::string domain = "google." + tld; |
+ |
+ // The Google TLD list might contain domains that are not considered |
+ // to be registrable domains by net::registry_controlled_domains. |
+ if (GetDomainAndRegistry( |
+ domain, |
+ net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES) != |
+ domain) { |
+ continue; |
+ } |
+ |
+ kGoogleRegisterableDomains.push_back(domain); |
+ } |
+ } |
+ |
+ return kGoogleRegisterableDomains; |
+} |
+ |
} // namespace google_util |