Index: chrome/browser/autocomplete/search_provider.cc |
diff --git a/chrome/browser/autocomplete/search_provider.cc b/chrome/browser/autocomplete/search_provider.cc |
index 89d29257b45d18355f036406f556a99ad4426500..55d4c667be3a2c8b8b2ff2fd3f672fe91f5b85e1 100644 |
--- a/chrome/browser/autocomplete/search_provider.cc |
+++ b/chrome/browser/autocomplete/search_provider.cc |
@@ -251,11 +251,7 @@ SearchProvider::SearchProvider(AutocompleteProviderListener* listener, |
suggest_results_pending_(0), |
field_trial_triggered_(false), |
field_trial_triggered_in_session_(false), |
- omnibox_start_margin_(-1), |
- prevent_search_history_inlining_( |
- OmniboxFieldTrial::SearchHistoryPreventInlining()), |
- disable_search_history_( |
- OmniboxFieldTrial::SearchHistoryDisable()) { |
+ omnibox_start_margin_(-1) { |
} |
// static |
@@ -630,8 +626,10 @@ void SearchProvider::DoHistoryQuery(bool minimal_changes) { |
keyword_history_results_.clear(); |
default_history_results_.clear(); |
- if (disable_search_history_) |
+ if (OmniboxFieldTrial::SearchHistoryDisable( |
+ input_.current_page_classification())) { |
Alexei Svitkine (slow)
2013/08/01 15:25:35
Nit: Indent 4 more.
Mark P
2013/08/01 17:23:32
Done.
|
return; |
+ } |
HistoryService* const history_service = |
HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); |
@@ -1203,6 +1201,9 @@ SearchProvider::SuggestResults SearchProvider::ScoreHistoryResults( |
AutocompleteClassifier* classifier = |
AutocompleteClassifierFactory::GetForProfile(profile_); |
SuggestResults scored_results; |
+ const bool prevent_search_history_inlining = |
+ OmniboxFieldTrial::SearchHistoryPreventInlining( |
+ input_.current_page_classification()); |
for (HistoryResults::const_iterator i(results.begin()); i != results.end(); |
++i) { |
// Don't autocomplete multi-word queries that have only been seen once |
@@ -1230,8 +1231,9 @@ SearchProvider::SuggestResults SearchProvider::ScoreHistoryResults( |
!AutocompleteMatch::IsSearchType(match.type); |
} |
- int relevance = CalculateRelevanceForHistory(i->time, is_keyword, |
- prevent_inline_autocomplete); |
+ int relevance = CalculateRelevanceForHistory( |
+ i->time, is_keyword, prevent_inline_autocomplete, |
+ prevent_search_history_inlining); |
scored_results.push_back( |
SuggestResult(i->term, is_keyword, relevance, false)); |
} |
@@ -1336,11 +1338,12 @@ int SearchProvider::GetKeywordVerbatimRelevance( |
int SearchProvider::CalculateRelevanceForHistory( |
const base::Time& time, |
bool is_keyword, |
- bool prevent_inline_autocomplete) const { |
+ bool prevent_inline_autocomplete, |
+ bool prevent_search_history_inlining) const { |
// The relevance of past searches falls off over time. There are two distinct |
// equations used. If the first equation is used (searches to the primary |
// provider that we want to inline autocomplete), the score is in the range |
- // 1300-1599 (unless |prevent_search_history_inlining_|, in which case |
+ // 1300-1599 (unless |prevent_search_history_inlining|, in which case |
// it's in the range 1200-1299). If the second equation is used the |
// relevance of a search 15 minutes ago is discounted 50 points, while the |
// relevance of a search two weeks ago is discounted 450 points. |
@@ -1351,7 +1354,7 @@ int SearchProvider::CalculateRelevanceForHistory( |
const double autocomplete_time = 2 * 24 * 60 * 60; |
if (elapsed_time < autocomplete_time) { |
int max_score = is_keyword ? 1599 : 1399; |
- if (prevent_search_history_inlining_) |
+ if (prevent_search_history_inlining) |
max_score = 1299; |
return max_score - static_cast<int>(99 * |
std::pow(elapsed_time / autocomplete_time, 2.5)); |