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

Unified Diff: chrome/browser/autocomplete/autocomplete_result.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/autocomplete/autocomplete_result.cc
diff --git a/chrome/browser/autocomplete/autocomplete_result.cc b/chrome/browser/autocomplete/autocomplete_result.cc
index 675a96c7382afad2b89cb9076a5668ffb4121e4b..f502edd53b21f5abed35da5f176c2593feaf1bf9 100644
--- a/chrome/browser/autocomplete/autocomplete_result.cc
+++ b/chrome/browser/autocomplete/autocomplete_result.cc
@@ -259,20 +259,15 @@ AutocompleteMatch* AutocompleteResult::match_at(size_t index) {
bool AutocompleteResult::ShouldHideTopMatch() const {
// Gate on our field trial flag.
Peter Kasting 2013/12/17 23:47:34 Nit: Remove this comment.
kmadhusu 2013/12/18 23:26:08 Done.
- if (!chrome::ShouldHideTopVerbatimMatch())
- return false;
+ return chrome::ShouldHideTopVerbatimMatch() &&
+ TopMatchIsVerbatimAndHasNoConsecutiveVerbatimMatches();
+}
- // If we don't have a verbatim first match, show everything.
+bool AutocompleteResult::TopMatchIsVerbatimAndHasNoConsecutiveVerbatimMatches()
Peter Kasting 2013/12/17 23:47:34 Nit: Name this TopMatchIsStandaloneVerbatimMatch()
kmadhusu 2013/12/18 23:26:08 Done.
+ const {
if (empty() || !match_at(0).IsVerbatimType())
return false;
-
- // If the verbatim first match is followed by another verbatim match, don't
- // hide anything, lest we cause user confusion.
- if ((size() > 1) && match_at(1).IsVerbatimType())
- return false;
-
- // Otherwise, it's safe to hide the verbatim first match.
- return true;
+ return !(size() > 1) || !match_at(1).IsVerbatimType();
Peter Kasting 2013/12/17 23:47:34 Nit: Simpler: return !empty() && match_at(0).Is
kmadhusu 2013/12/18 23:26:08 Done.
}
void AutocompleteResult::Reset() {

Powered by Google App Engine
This is Rietveld 408576698