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

Unified Diff: chrome/browser/history/url_index_private_data.cc

Issue 296743009: Pass AutocompleteProvider::kMaxMatches to InMemoryURLIndex (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 7 months 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 | « chrome/browser/history/url_index_private_data.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/url_index_private_data.cc
diff --git a/chrome/browser/history/url_index_private_data.cc b/chrome/browser/history/url_index_private_data.cc
index 236db65e60db187965a2d0815c37ee8c14730ff8..d00c8c33ad47a0edb3e2aa8334a0bbc467fce5b0 100644
--- a/chrome/browser/history/url_index_private_data.cc
+++ b/chrome/browser/history/url_index_private_data.cc
@@ -19,7 +19,6 @@
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
-#include "chrome/browser/autocomplete/autocomplete_provider.h"
#include "chrome/browser/history/history_database.h"
#include "chrome/browser/history/history_db_task.h"
#include "chrome/browser/history/history_service.h"
@@ -150,6 +149,7 @@ URLIndexPrivateData::URLIndexPrivateData()
ScoredHistoryMatches URLIndexPrivateData::HistoryItemsForTerms(
base::string16 search_string,
size_t cursor_position,
+ size_t max_matches,
const std::string& languages,
BookmarkService* bookmark_service) {
// If cursor position is set and useful (not at either end of the
@@ -246,14 +246,14 @@ ScoredHistoryMatches URLIndexPrivateData::HistoryItemsForTerms(
AddHistoryMatch(*this, languages, bookmark_service, lower_raw_string,
lower_raw_terms, base::Time::Now())).ScoredMatches();
- // Select and sort only the top kMaxMatches results.
- if (scored_items.size() > AutocompleteProvider::kMaxMatches) {
+ // Select and sort only the top |max_matches| results.
+ if (scored_items.size() > max_matches) {
std::partial_sort(scored_items.begin(),
scored_items.begin() +
- AutocompleteProvider::kMaxMatches,
+ max_matches,
scored_items.end(),
ScoredHistoryMatch::MatchScoreGreater);
- scored_items.resize(AutocompleteProvider::kMaxMatches);
+ scored_items.resize(max_matches);
} else {
std::sort(scored_items.begin(), scored_items.end(),
ScoredHistoryMatch::MatchScoreGreater);
« no previous file with comments | « chrome/browser/history/url_index_private_data.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698