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

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

Issue 284183011: Code clean up for ScoredHistoryMatch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moving out from class variables 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 | « no previous file | 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 e713b2575df6caf2d206ec399eb901b3bd96db01..9014d1599f02f2fdd75384a37e7a04d207b24e1d 100644
--- a/chrome/browser/history/scored_history_match.cc
+++ b/chrome/browser/history/scored_history_match.cc
@@ -16,13 +16,22 @@
#include "base/metrics/histogram.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
-#include "chrome/browser/autocomplete/history_url_provider.h"
#include "chrome/browser/autocomplete/url_prefix.h"
#include "chrome/browser/omnibox/omnibox_field_trial.h"
#include "components/bookmarks/browser/bookmark_service.h"
#include "components/bookmarks/browser/bookmark_utils.h"
#include "content/public/browser/browser_thread.h"
+namespace {
+
+// These magic numbers are duplicated from HistoryURLProvider
+const int kScoreForBestInlineableResult = 1413;
+const int kScoreForUnvisitedIntranetResult = 1403;
+const int kScoreForWhatYouTypedResult = 1203;
+const int kBaseScoreForNonInlineableResult = 900;
+
+} // namespace
+
namespace history {
// ScoredHistoryMatch ----------------------------------------------------------
@@ -167,8 +176,8 @@ ScoredHistoryMatch::ScoredHistoryMatch(
const bool promote_to_inline = (row.typed_count() > 1) ||
blundell 2014/05/26 06:58:35 This whole function feels like it should be abstra
sdefresne 2014/05/30 15:22:25 No, I had not thought of that, but it makes sense
blundell 2014/06/02 11:11:49 Note: I think that we should come up with a more a
(IsHostOnly() && (row.typed_count() == 1));
int hup_like_score = promote_to_inline ?
- HistoryURLProvider::kScoreForBestInlineableResult :
- HistoryURLProvider::kBaseScoreForNonInlineableResult;
+ kScoreForBestInlineableResult :
+ kBaseScoreForNonInlineableResult;
// Also, if the user types the hostname of a host with a typed
// visit, then everything from that host get given inlineable scores
@@ -176,7 +185,7 @@ ScoredHistoryMatch::ScoredHistoryMatch(
// else will be assigned one minus the previous score, as coded
// at the end of HistoryURLProvider::DoAutocomplete().
if (base::UTF8ToUTF16(gurl.host()) == terms[0])
- hup_like_score = HistoryURLProvider::kScoreForBestInlineableResult;
+ hup_like_score = kScoreForBestInlineableResult;
// HistoryURLProvider has the function PromoteOrCreateShorterSuggestion()
// that's meant to promote prefixes of the best match (if they've
@@ -597,7 +606,7 @@ void ScoredHistoryMatch::Init() {
// results to preserve this behavior.
if (also_do_hup_like_scoring_) {
blundell 2014/05/26 06:58:35 Am I missing something, or is this dead code? Line
max_assigned_score_for_non_inlineable_matches_ =
- HistoryURLProvider::kScoreForBestInlineableResult - 1;
+ kScoreForBestInlineableResult - 1;
}
bookmark_value_ = OmniboxFieldTrial::HQPBookmarkValue();
allow_tld_matches_ = OmniboxFieldTrial::HQPAllowMatchInTLDValue();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698