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

Unified Diff: chrome/browser/ui/omnibox/omnibox_controller.cc

Issue 69703002: Modified GetMatchToPrefetch() to return a valid match for prefetching even when hide_verbatim flag i (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments Created 7 years 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/ui/omnibox/omnibox_controller.cc
diff --git a/chrome/browser/ui/omnibox/omnibox_controller.cc b/chrome/browser/ui/omnibox/omnibox_controller.cc
index 903f3144ff406cf51d21215c5febf6eef2f60817..d488714b177b7d5b41bebe89f67d9ce4e57a0f3e 100644
--- a/chrome/browser/ui/omnibox/omnibox_controller.cc
+++ b/chrome/browser/ui/omnibox/omnibox_controller.cc
@@ -31,11 +31,14 @@ namespace {
//
// The SearchProvider may mark some suggestions to be prefetched based on
// instructions from the suggest server. If such a match ranks sufficiently
-// highly, we'll return it. We only care about matches that are the default or
-// else the very first entry in the dropdown (which can happen for non-default
-// matches only if we're hiding a top verbatim match); for other matches, we
-// think the likelihood of the user selecting them is low enough that
-// prefetching isn't worth doing.
+// highly, we'll return it.
+//
+// We only care about matches that are the default or the very first entry in
+// the dropdown (which can happen for non-default matches only if we're hiding
+// a top verbatim match) or the second entry in the dropdown (which can happen
+// for non-default matches when a top verbatim match is shown); for other
+// matches, we think the likelihood of the user selecting them is low enough
+// that prefetching isn't worth doing.
const AutocompleteMatch* GetMatchToPrefetch(const AutocompleteResult& result) {
const AutocompleteResult::const_iterator default_match(
result.default_match());
@@ -45,9 +48,11 @@ const AutocompleteMatch* GetMatchToPrefetch(const AutocompleteResult& result) {
if (SearchProvider::ShouldPrefetch(*default_match))
return &(*default_match);
- return (result.ShouldHideTopMatch() && (result.size() > 1) &&
- SearchProvider::ShouldPrefetch(result.match_at(1))) ?
- &result.match_at(1) : NULL;
+ return ((result.ShouldHideTopMatch() ||
+ result.TopMatchIsVerbatimAndHasNoConsecutiveVerbatimMatches()) &&
+ (result.size() > 1) &&
+ SearchProvider::ShouldPrefetch(result.match_at(1))) ?
+ &result.match_at(1) : NULL;
Peter Kasting 2013/12/17 23:47:34 Nit: Indenting here is inconsistent; sometimes you
kmadhusu 2013/12/18 23:26:08 Fixed indentation.
}
} // namespace

Powered by Google App Engine
This is Rietveld 408576698