Chromium Code Reviews| 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 |