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

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

Issue 10541045: Move ScoredHistoryMatch into Its Own Set of Files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 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
Index: chrome/browser/history/in_memory_url_index_types.cc
===================================================================
--- chrome/browser/history/in_memory_url_index_types.cc (revision 140773)
+++ chrome/browser/history/in_memory_url_index_types.cc (working copy)
@@ -5,16 +5,28 @@
#include "chrome/browser/history/in_memory_url_index_types.h"
#include <algorithm>
+#include <functional>
#include <iterator>
+#include <numeric>
#include <set>
#include "base/i18n/break_iterator.h"
#include "base/i18n/case_conversion.h"
#include "base/string_util.h"
-#include "base/utf_string_conversions.h"
namespace history {
+// The maximum score any candidate result can achieve.
+const int kMaxTotalScore = 1425;
+
+// Score ranges used to get a 'base' score for each of the scoring factors
+// (such as recency of last visit, times visited, times the URL was typed,
+// and the quality of the string match). There is a matching value range for
+// each of these scores for each factor. Note that the top score is greater
+// than |kMaxTotalScore|. The score for each candidate will be capped in the
+// final calculation.
+const int kScoreRank[] = { 1450, 1200, 900, 400 };
+
// Matches within URL and Title Strings ----------------------------------------
TermMatches MatchTermInString(const string16& term,
@@ -75,25 +87,6 @@
return new_matches;
}
-// ScoredHistoryMatch ----------------------------------------------------------
-
-ScoredHistoryMatch::ScoredHistoryMatch()
- : raw_score(0),
- can_inline(false) {}
-
-ScoredHistoryMatch::ScoredHistoryMatch(const URLRow& url_info)
- : HistoryMatch(url_info, 0, false, false),
- raw_score(0),
- can_inline(false) {}
-
-ScoredHistoryMatch::~ScoredHistoryMatch() {}
-
-// Comparison function for sorting ScoredMatches by their scores.
-bool ScoredHistoryMatch::MatchScoreGreater(const ScoredHistoryMatch& m1,
- const ScoredHistoryMatch& m2) {
- return m1.raw_score > m2.raw_score;
-}
-
// Utility Functions -----------------------------------------------------------
String16Set String16SetFromString16(const string16& uni_string,
@@ -153,4 +146,9 @@
RowWordStarts::RowWordStarts() {}
RowWordStarts::~RowWordStarts() {}
+void RowWordStarts::Clear() {
+ url_word_starts_.clear();
+ title_word_starts_.clear();
+}
+
} // namespace history
« no previous file with comments | « chrome/browser/history/in_memory_url_index_types.h ('k') | chrome/browser/history/in_memory_url_index_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698