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

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

Issue 77453007: Omnibox: Make HistoryURL Highlight Titles like HistoryQuick Provider (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 | « chrome/browser/history/scored_history_match.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/scored_history_match.cc
diff --git a/chrome/browser/history/scored_history_match.cc b/chrome/browser/history/scored_history_match.cc
index f201414a07e2138878dd9685268c7444bbc38062..fa2bfc4c7f72ad068016e43a6018ba1f5f05c51f 100644
--- a/chrome/browser/history/scored_history_match.cc
+++ b/chrome/browser/history/scored_history_match.cc
@@ -245,6 +245,33 @@ bool ScoredHistoryMatch::MatchScoreGreater(const ScoredHistoryMatch& m1,
return m1.url_info.last_visit() > m2.url_info.last_visit();
}
+// static
+TermMatches ScoredHistoryMatch::FilterTermMatchesByWordStarts(
+ const TermMatches& term_matches,
+ const WordStarts& word_starts,
+ const size_t start_pos) {
+ if (start_pos == std::string::npos)
+ return term_matches;
+ TermMatches filtered_matches;
+ WordStarts::const_iterator next_word_starts = word_starts.begin();
+ WordStarts::const_iterator end_word_starts = word_starts.end();
+ for (TermMatches::const_iterator iter = term_matches.begin();
+ iter != term_matches.end(); ++iter) {
+ // Advance next_word_starts until it's >= the position of the term
+ // we're considering.
+ while ((next_word_starts != end_word_starts) &&
+ (*next_word_starts < iter->offset))
+ ++next_word_starts;
+ // Add the match if it's before the position we start filtering at or
+ // if it's at a word boundary.
+ if ((iter->offset < start_pos) ||
+ ((next_word_starts != end_word_starts) &&
+ (*next_word_starts == iter->offset)))
+ filtered_matches.push_back(*iter);
+ }
+ return filtered_matches;
+}
+
float ScoredHistoryMatch::GetTopicalityScore(
const int num_terms,
const string16& url,
@@ -374,33 +401,6 @@ float ScoredHistoryMatch::GetTopicalityScore(
}
// static
-TermMatches ScoredHistoryMatch::FilterTermMatchesByWordStarts(
- const TermMatches& term_matches,
- const WordStarts& word_starts,
- const size_t start_pos) {
- if (start_pos == std::string::npos)
- return term_matches;
- TermMatches filtered_matches;
- WordStarts::const_iterator next_word_starts = word_starts.begin();
- WordStarts::const_iterator end_word_starts = word_starts.end();
- for (TermMatches::const_iterator iter = term_matches.begin();
- iter != term_matches.end(); ++iter) {
- // Advance next_word_starts until it's >= the position of the term
- // we're considering.
- while ((next_word_starts != end_word_starts) &&
- (*next_word_starts < iter->offset))
- ++next_word_starts;
- // Add the match if it's before the position we start filtering at or
- // if it's at a word boundary.
- if ((iter->offset < start_pos) ||
- ((next_word_starts != end_word_starts) &&
- (*next_word_starts == iter->offset)))
- filtered_matches.push_back(*iter);
- }
- return filtered_matches;
-}
-
-// static
void ScoredHistoryMatch::FillInTermScoreToTopicalityScoreArray() {
for (int term_score = 0; term_score < kMaxRawTermScore; ++term_score) {
float topicality_score;
« no previous file with comments | « chrome/browser/history/scored_history_match.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698