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

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: Deleting unused variables from header file Created 6 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
« 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 b5219fe6b894b74e7b99e9e6668cb06594ec90e7..6386dc34d605419894ad607b25384f6275907704 100644
--- a/chrome/browser/history/scored_history_match.cc
+++ b/chrome/browser/history/scored_history_match.cc
@@ -37,8 +37,6 @@ bool ScoredHistoryMatch::initialized_ = false;
int ScoredHistoryMatch::bookmark_value_ = 1;
bool ScoredHistoryMatch::allow_tld_matches_ = false;
bool ScoredHistoryMatch::allow_scheme_matches_ = false;
-bool ScoredHistoryMatch::also_do_hup_like_scoring_ = false;
-int ScoredHistoryMatch::max_assigned_score_for_non_inlineable_matches_ = -1;
ScoredHistoryMatch::ScoredHistoryMatch()
: raw_score_(0),
@@ -158,57 +156,6 @@ ScoredHistoryMatch::ScoredHistoryMatch(
raw_score_ =
(raw_score_ <= kint32max) ? static_cast<int>(raw_score_) : kint32max;
- if (also_do_hup_like_scoring_ && can_inline_) {
- // HistoryURL-provider-like scoring gives any match that is
- // capable of being inlined a certain minimum score. Some of these
- // are given a higher score that lets them be shown in inline.
- // This test here derives from the test in
- // HistoryURLProvider::PromoteMatchForInlineAutocomplete().
- const bool promote_to_inline = (row.typed_count() > 1) ||
- (IsHostOnly() && (row.typed_count() == 1));
- int hup_like_score = promote_to_inline ?
- HistoryURLProvider::kScoreForBestInlineableResult :
- HistoryURLProvider::kBaseScoreForNonInlineableResult;
-
- // Also, if the user types the hostname of a host with a typed
- // visit, then everything from that host get given inlineable scores
- // (because the URL-that-you-typed will go first and everything
- // 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;
-
- // HistoryURLProvider has the function PromoteOrCreateShorterSuggestion()
- // that's meant to promote prefixes of the best match (if they've
- // been visited enough related to the best match) or
- // create/promote host-only suggestions (even if they've never
- // been typed). The code is complicated and we don't try to
- // duplicate the logic here. Instead, we handle a simple case: in
- // low-typed-count ranges, give host-only matches (i.e.,
- // http://www.foo.com/ vs. http://www.foo.com/bar.html) a boost so
- // that the host-only match outscores all the other matches that
- // would normally have the same base score. This behavior is not
- // identical to what happens in HistoryURLProvider even in these
- // low typed count ranges--sometimes it will create/promote when
- // this test does not (indeed, we cannot create matches like HUP
- // can) and vice versa--but the underlying philosophy is similar.
- if (!promote_to_inline && IsHostOnly())
- hup_like_score++;
-
- // All the other logic to goes into hup-like-scoring happens in
- // the tie-breaker case of MatchScoreGreater().
-
- // Incorporate hup_like_score into raw_score.
- raw_score_ = std::max(raw_score_, hup_like_score);
- }
-
- // If this match is not inlineable and there's a cap on the maximum
- // score that can be given to non-inlineable matches, apply the cap.
- if (!can_inline_ && (max_assigned_score_for_non_inlineable_matches_ != -1)) {
- raw_score_ = std::min(max_assigned_score_for_non_inlineable_matches_,
- raw_score_);
- }
-
// Now that we're done processing this entry, correct the offsets of the
// matches in |url_matches_| so they point to offsets in the original URL
// spec, not the cleaned-up URL string that we used for matching.
@@ -585,20 +532,6 @@ float ScoredHistoryMatch::GetFinalRelevancyScore(float topicality_score,
void ScoredHistoryMatch::Init() {
if (initialized_)
return;
- also_do_hup_like_scoring_ = false;
- // When doing HUP-like scoring, don't allow a non-inlineable match
- // to beat the score of good inlineable matches. This is a problem
- // because if a non-inlineable match ends up with the highest score
- // from HistoryQuick provider, all HistoryQuick matches get demoted
- // to non-inlineable scores (scores less than 1200). Without
- // HUP-like-scoring, these results would actually come from the HUP
- // and not be demoted, thus outscoring the demoted HQP results.
- // When the HQP provides these, we need to clamp the non-inlineable
- // results to preserve this behavior.
- if (also_do_hup_like_scoring_) {
- max_assigned_score_for_non_inlineable_matches_ =
- HistoryURLProvider::kScoreForBestInlineableResult - 1;
- }
bookmark_value_ = OmniboxFieldTrial::HQPBookmarkValue();
allow_tld_matches_ = OmniboxFieldTrial::HQPAllowMatchInTLDValue();
allow_scheme_matches_ = OmniboxFieldTrial::HQPAllowMatchInSchemeValue();
« 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