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

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

Issue 66503003: Omnibox: In Reorder Mode, SearchProvider Doesn't Need to Remove Stale Results (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autocomplete/search_provider.cc
diff --git a/chrome/browser/autocomplete/search_provider.cc b/chrome/browser/autocomplete/search_provider.cc
index ff071132f6029c0199a8111c399826f6db089732..2fc267bda96f3d031d21de8b9a4dc3fec05cd7df 100644
--- a/chrome/browser/autocomplete/search_provider.cc
+++ b/chrome/browser/autocomplete/search_provider.cc
@@ -873,6 +873,13 @@ void SearchProvider::ClearAllResults() {
}
void SearchProvider::RemoveAllStaleResults() {
+ // 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 an algorithm like that in
// RemoveStaleResults(...) below that uses all four results lists
// and both verbatim scores at once. However, that will be much
@@ -880,14 +887,18 @@ void SearchProvider::RemoveAllStaleResults() {
// 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 (!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(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);
+ }
+ }
+ if (keyword_input_.text().empty()) {
// User is either in keyword mode with a blank input or out of
// keyword mode entirely.
keyword_results_.Clear();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698