Index: chrome/browser/autocomplete/history_contents_provider.cc |
diff --git a/chrome/browser/autocomplete/history_contents_provider.cc b/chrome/browser/autocomplete/history_contents_provider.cc |
index 37f314403dacfac7b095bc3d8e9689208385aac5..07c913219cadf637bc7f5cefc95928e7d3253ca2 100644 |
--- a/chrome/browser/autocomplete/history_contents_provider.cc |
+++ b/chrome/browser/autocomplete/history_contents_provider.cc |
@@ -133,7 +133,7 @@ void HistoryContentsProvider::Start(const AutocompleteInput& input, |
history::QueryOptions options; |
options.SetRecentDayRange(kDaysToSearch); |
- options.max_count = kMaxMatchCount; |
+ options.max_count = kMaxMatches; |
history->QueryHistory(WideToUTF16(input.text()), options, |
&request_consumer_, |
NewCallback(this, &HistoryContentsProvider::QueryComplete)); |
@@ -183,34 +183,15 @@ void HistoryContentsProvider::ConvertResults() { |
result_refs.push_back(ref); |
} |
- // Get the top matches and add them. Always do max number of matches the popup |
- // will show plus one. This ensures that if the other providers provide the |
- // exact same set of results, and the db only has max_matches + 1 results |
- // available for this query, we know the last one. |
- // |
- // This is done to avoid having the history search shortcut show |
- // 'See 1 previously viewed ...'. |
- // |
- // Note that AutocompleteResult::kMaxMatches (maximum size of the popup) |
- // is different than both kMaxMatches (the provider's maximum) and |
- // kMaxMatchCount (the number of items we want from the history). |
- size_t max_for_popup = std::min(AutocompleteResult::kMaxMatches + 1, |
- result_refs.size()); |
+ // Get the top matches and add them. |
size_t max_for_provider = std::min(kMaxMatches, result_refs.size()); |
- std::partial_sort(result_refs.begin(), result_refs.begin() + max_for_popup, |
+ std::partial_sort(result_refs.begin(), result_refs.begin() + max_for_provider, |
result_refs.end(), &CompareMatchRelevance); |
matches_.clear(); |
- for (size_t i = 0; i < max_for_popup; i++) { |
+ for (size_t i = 0; i < max_for_provider; i++) { |
matches_.push_back(ResultToMatch(*result_refs[i].result, |
result_refs[i].relevance)); |
} |
- |
- // We made more matches than the autocomplete service requested for this |
- // provider (see previous comment). We invert the weights for the items |
- // we want to get removed, but preserve their magnitude which will be used |
- // to fill them in with our other results. |
- for (size_t i = max_for_provider; i < max_for_popup; i++) |
- matches_[i].relevance = -matches_[i].relevance; |
} |
static bool MatchInTitle(const history::URLResult& result) { |