Chromium Code Reviews| Index: chrome/browser/autocomplete/shortcuts_provider.cc |
| diff --git a/chrome/browser/autocomplete/shortcuts_provider.cc b/chrome/browser/autocomplete/shortcuts_provider.cc |
| index cf121be0bd3a49eefebb8635c947d4decd04ccb9..5858443a6e57445ade869aa2e2773f2f902bafb5 100644 |
| --- a/chrome/browser/autocomplete/shortcuts_provider.cc |
| +++ b/chrome/browser/autocomplete/shortcuts_provider.cc |
| @@ -174,15 +174,21 @@ void ShortcutsProvider::GetMatches(const AutocompleteInput& input) { |
| matches_.erase(matches_.begin() + AutocompleteProvider::kMaxMatches, |
| matches_.end()); |
| } |
| - // Reset relevance scores to guarantee no results are given an |
| - // inlineable score and all scores are decreasing (but not do assign |
| - // any scores below 1). |
| - int max_relevance = AutocompleteResult::kLowestDefaultScore - 1; |
| - for (ACMatches::iterator it = matches_.begin(); it != matches_.end(); ++it) { |
| - max_relevance = std::min(max_relevance, it->relevance); |
| - it->relevance = max_relevance; |
| - if (max_relevance > 1) |
| - --max_relevance; |
| + // Reset relevance scores to guarantee no result is given a score that may |
|
Peter Kasting
2013/08/06 22:56:16
Nit: result -> match
Mark P
2013/08/07 00:44:31
Done.
|
| + // allow it to become the highest ranked match (i.e., the default match) |
| + // unless the omnibox will reorder matches as necessary to correct the |
| + // problem. In the process of resetting scores, guarantee that all scores |
|
Peter Kasting
2013/08/06 22:56:16
Nit: You may want to say why this is a problem (or
Mark P
2013/08/07 00:44:31
Added a comment. Not sure if it help or hurts.
|
| + // are decreasing (but not do assign any scores below 1). |
| + if (!OmniboxFieldTrial::ReorderForLegalDefaultMatch( |
| + input.current_page_classification())) { |
|
Peter Kasting
2013/08/06 22:56:16
Nit: Indent 4, not 8
Mark P
2013/08/07 00:44:31
Done.
|
| + int max_relevance = AutocompleteResult::kLowestDefaultScore - 1; |
| + for (ACMatches::iterator it = matches_.begin(); it != matches_.end(); |
| + ++it) { |
| + max_relevance = std::min(max_relevance, it->relevance); |
| + it->relevance = max_relevance; |
| + if (max_relevance > 1) |
| + --max_relevance; |
| + } |
| } |
| } |