Index: net/base/registry_controlled_domains/registry_controlled_domain.h |
diff --git a/net/base/registry_controlled_domains/registry_controlled_domain.h b/net/base/registry_controlled_domains/registry_controlled_domain.h |
index 24ffb707a50ab5fd44e7b7f86427a9dfd0bff8b6..f226bcc6f585c1b62582e0d151d9fda94387130b 100644 |
--- a/net/base/registry_controlled_domains/registry_controlled_domain.h |
+++ b/net/base/registry_controlled_domains/registry_controlled_domain.h |
@@ -227,11 +227,35 @@ NET_EXPORT size_t GetRegistryLength(const GURL& gurl, |
UnknownRegistryFilter unknown_filter, |
PrivateRegistryFilter private_filter); |
-// Like the GURL version, but takes a host (which is canonicalized internally) |
-// instead of a full GURL. |
-NET_EXPORT size_t GetRegistryLength(base::StringPiece host, |
- UnknownRegistryFilter unknown_filter, |
- PrivateRegistryFilter private_filter); |
+// Returns true if the given host name has a registry-controlled domain. The |
+// nost name will be internally canonicalized. Invalid host names like |
+// "*.google.com" can be passed and will return true as long as it has a valid |
+// registry-controlled portion. |
+NET_EXPORT bool HostHasRegistryControlledDomain( |
+ base::StringPiece host, |
+ UnknownRegistryFilter unknown_filter, |
+ PrivateRegistryFilter private_filter); |
+ |
+// Like GetRegistryLength, but takes a previously-canonicalized host. Prefer |
+// the GURL version above or HasRegistryControlledSuffix to eliminate |
+// bugs with non-canonical hosts. |
+NET_EXPORT size_t |
+GetRegistryLengthForCanonicalHost(base::StringPiece canon_host, |
+ UnknownRegistryFilter unknown_filter, |
+ PrivateRegistryFilter private_filter); |
+ |
+// This function canonicalizes the host name and returns the registry controlled |
+// length of the canonical version. |
+// |
+// TODO(bug 657199) any use of this length by the caller is likely a bug. |
+// Canonicalization can change the length of different URL components, so using |
+// the returned value as an index into the returned string will be incorrect. If |
+// you have a canonicalized URL, this is safe and you should use |
+// GetRegistryLengthForCanonicalHost above. |
+NET_EXPORT size_t |
+BuggyGetHostRegistryLength(const std::string& host, |
+ UnknownRegistryFilter unknown_filter, |
+ PrivateRegistryFilter private_filter); |
typedef const struct DomainRule* (*FindDomainPtr)(const char *, unsigned int); |