Chromium Code Reviews| Index: chrome/browser/autocomplete/search_provider.cc |
| diff --git a/chrome/browser/autocomplete/search_provider.cc b/chrome/browser/autocomplete/search_provider.cc |
| index 7373008ae41c28178d92cd5c1eb82d4ecb533100..5b1797ba6e90135ba08e7697fd9f0e5db4b7946c 100644 |
| --- a/chrome/browser/autocomplete/search_provider.cc |
| +++ b/chrome/browser/autocomplete/search_provider.cc |
| @@ -869,21 +869,33 @@ void SearchProvider::ClearAllResults() { |
| } |
| void SearchProvider::RemoveAllStaleResults() { |
| - // In theory it would be better to run an algorithm like that in |
| + // We only need to remove stale results (which ensures the top-scoring |
| + // match is inlineable) if the user is not in reorder mode. In reorder |
| + // mode, the autocomplete system will reorder results to make sure the |
| + // top result is inlineable. |
| + const bool omnibox_will_reorder_for_legal_default_match = |
| + OmniboxFieldTrial::ReorderForLegalDefaultMatch( |
| + input_.current_page_classification()); |
| + // In theory it would be better to run the removal algorithm like that in |
|
Peter Kasting
2013/11/09 00:06:20
Nit: I think changing "an" to "the removal" here a
Mark P
2013/11/11 18:46:14
I thought "an algorithm" was vague (which algorith
|
| // RemoveStaleResults(...) below that uses all four results lists |
| // and both verbatim scores at once. However, that will be much |
| // more complicated for little obvious gain. For code simplicity |
| // and ease in reasoning about the invariants involved, this code |
| // removes stales results from the keyword provider and default |
| // provider independently. |
| - RemoveStaleResults(input_.text(), GetVerbatimRelevance(NULL), |
| - &default_results_.suggest_results, |
| - &default_results_.navigation_results); |
| + if (!omnibox_will_reorder_for_legal_default_match) { |
| + RemoveStaleResults(input_.text(), GetVerbatimRelevance(NULL), |
| + &default_results_.suggest_results, |
| + &default_results_.navigation_results); |
| + } |
| if (!keyword_input_.text().empty()) { |
| - RemoveStaleResults(keyword_input_.text(), GetKeywordVerbatimRelevance(NULL), |
| - &keyword_results_.suggest_results, |
| - &keyword_results_.navigation_results); |
| - } else { |
| + if (!omnibox_will_reorder_for_legal_default_match) { |
| + RemoveStaleResults(keyword_input_.text(), |
| + GetKeywordVerbatimRelevance(NULL), |
| + &keyword_results_.suggest_results, |
| + &keyword_results_.navigation_results); |
| + } |
| + } else { |
| // User is either in keyword mode with a blank input or out of |
| // keyword mode entirely. |
| keyword_results_.Clear(); |