Chromium Code Reviews| 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()); |