Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1005)

Unified Diff: chrome/browser/autocomplete/search_provider.cc

Issue 353223002: Omnibox: Fix URL-What-You-Typed Allowed-To-Be-Default-Match Issues (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: polish Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/autocomplete/search_provider.cc
diff --git a/chrome/browser/autocomplete/search_provider.cc b/chrome/browser/autocomplete/search_provider.cc
index 85557113ccbac455efaa5b3d50e7fc60be43f61d..00d47cddd3428a95e44d8fcc08a044bbe56b5aa2 100644
--- a/chrome/browser/autocomplete/search_provider.cc
+++ b/chrome/browser/autocomplete/search_provider.cc
@@ -1126,10 +1126,19 @@ AutocompleteMatch SearchProvider::NavigationToMatch(
// that we're not preventing, make sure we didn't trim any whitespace.
// We don't want to claim http://foo.com/bar is inlineable against the
// input "foo.com/b ".
- match.allowed_to_be_default_match = navigation.IsInlineable(input) &&
+ match.allowed_to_be_default_match = (prefix != NULL) &&
(providers_.GetKeywordProviderURL() == NULL) &&
(match.inline_autocompletion.empty() ||
(!input_.prevent_inline_autocomplete() && !trimmed_whitespace));
+ // Also allow a user's input to be marked as default if it would be fixed
+ // up to something equivalent to the URL-what-you-typed match. This handles
+ // cases like the user input containing a trailing colon on a raw hostname.
+ // (The URL-what-you-typed match will ignore the colon.)
+ match.ComputeStrippedDestinationURL(profile_);
+ if (AutocompleteMatch::GURLToStrippedGURL(
+ input_.canonicalized_url(), profile_, base::string16()) ==
+ match.stripped_destination_url)
+ match.allowed_to_be_default_match = true;
match.contents = navigation.match_contents();
match.contents_class = navigation.match_contents_class();

Powered by Google App Engine
This is Rietveld 408576698