Index: net/base/registry_controlled_domain.cc |
diff --git a/net/base/registry_controlled_domain.cc b/net/base/registry_controlled_domain.cc |
index 2d1d4f2939c77471b2c1f509dee2032169add5d1..90e0273f42ec7d6b2fd0070b2e723b80e3dfe5a7 100644 |
--- a/net/base/registry_controlled_domain.cc |
+++ b/net/base/registry_controlled_domain.cc |
@@ -48,7 +48,11 @@ |
#include "net/base/net_module.h" |
#include "net/base/net_util.h" |
+#if defined(USE_DOMAIN_SUFFIX_TRIE) |
+#include "third_party/domain-registry-provider/src/domain_registry/domain_registry.h" |
+#else |
#include "effective_tld_names.cc" |
+#endif |
namespace net { |
@@ -142,9 +146,16 @@ RegistryControlledDomainService* RegistryControlledDomainService::GetInstance() |
return Singleton<RegistryControlledDomainService>::get(); |
} |
+#if defined(USE_DOMAIN_SUFFIX_TRIE) |
RegistryControlledDomainService::RegistryControlledDomainService() |
- : find_domain_function_(Perfect_Hash::FindDomain) { |
+ : find_domain_function_(NULL) { |
+ InitializeDomainRegistry(); |
} |
+#else |
+RegistryControlledDomainService::RegistryControlledDomainService() |
+ : find_domain_function_() { |
+} |
+#endif |
// static |
RegistryControlledDomainService* RegistryControlledDomainService::SetInstance( |
@@ -189,6 +200,17 @@ std::string RegistryControlledDomainService::GetDomainAndRegistryImpl( |
return host.substr(dot + 1); |
} |
+#if defined(USE_DOMAIN_SUFFIX_TRIE) |
+size_t RegistryControlledDomainService::GetRegistryLengthImpl( |
+ const std::string& host, |
+ bool allow_unknown_registries) { |
+ DCHECK(!host.empty()); |
+ if (allow_unknown_registries) |
+ return GetRegistryLengthAllowUnknownRegistries(host.c_str()); |
+ else |
+ return ::GetRegistryLength(host.c_str()); |
+} |
+#else |
size_t RegistryControlledDomainService::GetRegistryLengthImpl( |
const std::string& host, |
bool allow_unknown_registries) { |
@@ -267,5 +289,6 @@ size_t RegistryControlledDomainService::GetRegistryLengthImpl( |
// registries, return the length of this subcomponent. |
return allow_unknown_registries ? (host.length() - curr_start) : 0; |
} |
+#endif |
} // namespace net |