summaryrefslogtreecommitdiffstats
path: root/net/base/net_util.cc
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-22 20:05:59 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-22 20:05:59 +0000
commit7e563816b35dcc102eb69849295b5f6f9d048a63 (patch)
treeb6a833b3b32b58ed8453f1d63682c77d6b158d08 /net/base/net_util.cc
parent1679e8667e258a9903a18792894e13a17639e122 (diff)
downloadchromium_src-7e563816b35dcc102eb69849295b5f6f9d048a63.zip
chromium_src-7e563816b35dcc102eb69849295b5f6f9d048a63.tar.gz
chromium_src-7e563816b35dcc102eb69849295b5f6f9d048a63.tar.bz2
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
Diffstat (limited to 'net/base/net_util.cc')
-rw-r--r--net/base/net_util.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/base/net_util.cc b/net/base/net_util.cc
index e226659..67726f4e 100644
--- a/net/base/net_util.cc
+++ b/net/base/net_util.cc
@@ -959,7 +959,8 @@ inline bool IsHostCharDigit(char c) {
return (c >= '0') && (c <= '9');
}
-bool IsCanonicalizedHostCompliant(const std::string& host) {
+bool IsCanonicalizedHostCompliant(const std::string& host,
+ const std::string& desired_tld) {
if (host.empty())
return false;
@@ -989,7 +990,8 @@ bool IsCanonicalizedHostCompliant(const std::string& host) {
}
}
- return most_recent_component_started_alpha;
+ return most_recent_component_started_alpha ||
+ (!desired_tld.empty() && IsHostCharAlpha(desired_tld[0]));
}
std::string GetDirectoryListingEntry(const string16& name,