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

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

Issue 55413002: Don't demote top match for certain match types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 2 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
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_match.cc ('k') | chrome/browser/omnibox/omnibox_field_trial.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autocomplete/autocomplete_result.cc
diff --git a/chrome/browser/autocomplete/autocomplete_result.cc b/chrome/browser/autocomplete/autocomplete_result.cc
index 0c01b3923344778c50e930e693230cfa507aa19c..8430da06689aaddd747c5acb4200250814930e0d 100644
--- a/chrome/browser/autocomplete/autocomplete_result.cc
+++ b/chrome/browser/autocomplete/autocomplete_result.cc
@@ -47,7 +47,7 @@ int CompareWithDemoteByType::GetDemotedRelevance(
const AutocompleteMatch& match) {
OmniboxFieldTrial::DemotionMultipliers::const_iterator demotion_it =
demotions_.find(match.type);
- return (demotion_it == demotions_.end()) ?
+ return (demotion_it == demotions_.end() || !match.demoteable) ?
match.relevance : (match.relevance * demotion_it->second);
}
@@ -154,6 +154,16 @@ void AutocompleteResult::SortAndCull(const AutocompleteInput& input,
&AutocompleteMatch::DestinationsEqual),
matches_.end());
+ // Don't demote the top match if applicable.
+ OmniboxFieldTrial::UndemotableTopMatchTypes undemotable_top_types;
+ OmniboxFieldTrial::GetUndemotableTopTypes(input.current_page_classification(),
+ &undemotable_top_types);
+ if (!matches_.empty() &&
+ undemotable_top_types.find(matches_.begin()->type) !=
+ undemotable_top_types.end()) {
+ matches_.begin()->demoteable = false;
Peter Kasting 2013/10/31 23:27:59 Is this basically only used by code called from th
H Fung 2013/11/01 23:42:56 Yes, thanks. I've made the change.
+ }
+
// Sort and trim to the most relevant kMaxMatches matches.
size_t max_num_matches = std::min(kMaxMatches, matches_.size());
CompareWithDemoteByType comparing_object(input.current_page_classification());
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_match.cc ('k') | chrome/browser/omnibox/omnibox_field_trial.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698