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

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

Issue 903493002: Componentize ScoredHistoryMatch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 10 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') | chrome/chrome_browser.gypi » ('j') | 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 ac6639c48b6ee79a17d7ed11c0276b046da28061..bed87061a1f2b33192c88ed1b64a445356c64ac4 100644
--- a/chrome/browser/history/url_index_private_data.cc
+++ b/chrome/browser/history/url_index_private_data.cc
@@ -151,7 +151,7 @@ ScoredHistoryMatches URLIndexPrivateData::HistoryItemsForTerms(
size_t cursor_position,
size_t max_matches,
const std::string& languages,
- HistoryClient* history_client) {
+ const ScoredHistoryMatchClient* scored_history_match_client) {
// If cursor position is set and useful (not at either end of the
// string), allow the search string to be broken at cursor position.
// We do this by pretending there's a space where the cursor is.
@@ -242,9 +242,12 @@ ScoredHistoryMatches URLIndexPrivateData::HistoryItemsForTerms(
// but this is such a rare edge case that it's not worth the time.
return scored_items;
}
- scored_items = std::for_each(history_id_set.begin(), history_id_set.end(),
- AddHistoryMatch(*this, languages, history_client, lower_raw_string,
- lower_raw_terms, base::Time::Now())).ScoredMatches();
+ scored_items =
+ std::for_each(
+ history_id_set.begin(), history_id_set.end(),
+ AddHistoryMatch(*this, languages, scored_history_match_client,
+ lower_raw_string, lower_raw_terms, base::Time::Now()))
+ .ScoredMatches();
// Select and sort only the top |max_matches| results.
if (scored_items.size() > max_matches) {
@@ -1266,13 +1269,13 @@ URLIndexPrivateData::SearchTermCacheItem::~SearchTermCacheItem() {}
URLIndexPrivateData::AddHistoryMatch::AddHistoryMatch(
const URLIndexPrivateData& private_data,
const std::string& languages,
- HistoryClient* history_client,
+ const ScoredHistoryMatchClient* scored_history_match_client,
const base::string16& lower_string,
const String16Vector& lower_terms,
const base::Time now)
: private_data_(private_data),
languages_(languages),
- history_client_(history_client),
+ scored_history_match_client_(scored_history_match_client),
lower_string_(lower_string),
lower_terms_(lower_terms),
now_(now) {
@@ -1308,7 +1311,8 @@ void URLIndexPrivateData::AddHistoryMatch::operator()(
DCHECK(starts_pos != private_data_.word_starts_map_.end());
ScoredHistoryMatch match(hist_item, visits, languages_, lower_string_,
lower_terms_, lower_terms_to_word_starts_offsets_,
- starts_pos->second, now_, history_client_);
+ starts_pos->second, now_,
+ scored_history_match_client_);
if (match.raw_score() > 0)
scored_matches_.push_back(match);
}
« no previous file with comments | « chrome/browser/history/url_index_private_data.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698