Make various types of input work better with ctrl-enter. If we detected that the hostname without adding the TLD was illegal, we'd sometimes fail to allow the TLD to be added.
BUG=38605
TEST=Should be able to hit ctrl-enter on "401k" and "999999999999" to open them with www. and .com attached.
Review URL: http://codereview.chromium.org/1088004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42246 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/net/base/net_util.h b/net/base/net_util.h
index 28edad9..f614eb6 100644
--- a/net/base/net_util.h
+++ b/net/base/net_util.h
@@ -171,10 +171,15 @@
// * Each component contains only alphanumeric characters and '-' or '_'
// * The last component does not begin with a digit
// * Optional trailing dot after last component (means "treat as FQDN")
+// If |desired_tld| is non-NULL, the host will only be considered invalid if
+// appending it as a trailing component still results in an invalid host. This
+// helps us avoid marking as "invalid" user attempts to open "www.401k.com" by
+// typing 4-0-1-k-<ctrl>+<enter>.
//
// NOTE: You should only pass in hosts that have been returned from
// CanonicalizeHost(), or you may not get accurate results.
-bool IsCanonicalizedHostCompliant(const std::string& host);
+bool IsCanonicalizedHostCompliant(const std::string& host,
+ const std::string& desired_tld);
// Call these functions to get the html snippet for a directory listing.
// The return values of both functions are in UTF-8.