OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/google/core/browser/google_util.h" | 5 #include "components/google/core/browser/google_util.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 } | 276 } |
277 | 277 |
278 bool IsYoutubeDomainUrl(const GURL& url, | 278 bool IsYoutubeDomainUrl(const GURL& url, |
279 SubdomainPermission subdomain_permission, | 279 SubdomainPermission subdomain_permission, |
280 PortPermission port_permission) { | 280 PortPermission port_permission) { |
281 return IsValidURL(url, port_permission) && | 281 return IsValidURL(url, port_permission) && |
282 IsValidHostName(url.host_piece(), "youtube", subdomain_permission, | 282 IsValidHostName(url.host_piece(), "youtube", subdomain_permission, |
283 nullptr); | 283 nullptr); |
284 } | 284 } |
285 | 285 |
| 286 const std::vector<std::string>& GetGoogleRegistrableDomains() { |
| 287 CR_DEFINE_STATIC_LOCAL(std::vector<std::string>, kGoogleRegisterableDomains, |
| 288 ()); |
| 289 |
| 290 // Initialize the list. |
| 291 if (kGoogleRegisterableDomains.empty()) { |
| 292 std::vector<std::string> tlds{GOOGLE_TLD_LIST}; |
| 293 for (const std::string& tld : tlds) { |
| 294 std::string domain = "google." + tld; |
| 295 |
| 296 // The Google TLD list might contain domains that are not considered |
| 297 // to be registrable domains by net::registry_controlled_domains. |
| 298 if (GetDomainAndRegistry( |
| 299 domain, |
| 300 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES) != |
| 301 domain) { |
| 302 continue; |
| 303 } |
| 304 |
| 305 kGoogleRegisterableDomains.push_back(domain); |
| 306 } |
| 307 } |
| 308 |
| 309 return kGoogleRegisterableDomains; |
| 310 } |
| 311 |
286 } // namespace google_util | 312 } // namespace google_util |
OLD | NEW |