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

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 comment 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..4bd8d321f58642a3b55fc90e311f1162aa4817a5 100644
--- a/chrome/browser/autocomplete/autocomplete_result.cc
+++ b/chrome/browser/autocomplete/autocomplete_result.cc
@@ -259,20 +259,18 @@ AutocompleteMatch* AutocompleteResult::match_at(size_t index) {
bool AutocompleteResult::ShouldHideTopMatch() const {
// Gate on our field trial flag.
- if (!chrome::ShouldHideTopVerbatimMatch())
- return false;
+ return chrome::ShouldHideTopVerbatimMatch() &&
+ TopMatchIsVerbatimAndHasNoConsecutiveVerbatimMatches();
+}
- // If we don't have a verbatim first match, show everything.
+bool AutocompleteResult::TopMatchIsVerbatimAndHasNoConsecutiveVerbatimMatches()
+ 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;
+ // If the verbatim first match is followed by another verbatim match, return
+ // false to avoid user confusion.
Mark P 2013/12/12 23:13:07 This user confusion comment doesn't make sense any
kmadhusu 2013/12/13 01:00:29 Done. Removed the comment.
+ return !(size() > 1) || !match_at(1).IsVerbatimType();
}
void AutocompleteResult::Reset() {

Powered by Google App Engine
This is Rietveld 408576698