Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_HISTORY_SCORED_HISTORY_MATCH_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_SCORED_HISTORY_MATCH_H_ |
| 6 #define CHROME_BROWSER_HISTORY_SCORED_HISTORY_MATCH_H_ | 6 #define CHROME_BROWSER_HISTORY_SCORED_HISTORY_MATCH_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 // an appropriate value to use as a relevancy score. | 86 // an appropriate value to use as a relevancy score. |
| 87 static float GetFinalRelevancyScore( | 87 static float GetFinalRelevancyScore( |
| 88 float topicality_score, | 88 float topicality_score, |
| 89 float frecency_score); | 89 float frecency_score); |
| 90 | 90 |
| 91 // Sets also_do_hup_like_scoring and | 91 // Sets also_do_hup_like_scoring and |
| 92 // max_assigned_score_for_non_inlineable_matches based on the field | 92 // max_assigned_score_for_non_inlineable_matches based on the field |
| 93 // trial state. | 93 // trial state. |
| 94 static void InitializeAlsoDoHUPLikeScoringFieldAndMaxScoreField(); | 94 static void InitializeAlsoDoHUPLikeScoringFieldAndMaxScoreField(); |
| 95 | 95 |
| 96 // Sets bookmark_value based on the field trial state. | |
|
Peter Kasting
2013/11/09 00:44:55
Nit: Use pipes on member name since it isn't other
Mark P
2013/11/25 21:11:57
Done.
| |
| 97 static void InitializeBookmarkValue(); | |
| 98 | |
| 96 // An interim score taking into consideration location and completeness | 99 // An interim score taking into consideration location and completeness |
| 97 // of the match. | 100 // of the match. |
| 98 int raw_score; | 101 int raw_score; |
| 99 TermMatches url_matches; // Term matches within the URL. | 102 TermMatches url_matches; // Term matches within the URL. |
| 100 TermMatches title_matches; // Term matches within the page title. | 103 TermMatches title_matches; // Term matches within the page title. |
| 101 bool can_inline; // True if this is a candidate for in-line autocompletion. | 104 bool can_inline; // True if this is a candidate for in-line autocompletion. |
| 102 | 105 |
| 103 // Pre-computed information to speed up calculating recency scores. | 106 // Pre-computed information to speed up calculating recency scores. |
| 104 // |days_ago_to_recency_score| is a simple array mapping how long | 107 // |days_ago_to_recency_score| is a simple array mapping how long |
| 105 // ago a page was visited (in days) to the recency score we should | 108 // ago a page was visited (in days) to the recency score we should |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 119 // which calls FillInTermScoreToTopicalityScoreArray(). | 122 // which calls FillInTermScoreToTopicalityScoreArray(). |
| 120 static const int kMaxRawTermScore = 30; | 123 static const int kMaxRawTermScore = 30; |
| 121 static float* raw_term_score_to_topicality_score; | 124 static float* raw_term_score_to_topicality_score; |
| 122 | 125 |
| 123 // Used so we initialize static variables only once (on first use). | 126 // Used so we initialize static variables only once (on first use). |
| 124 static bool initialized_; | 127 static bool initialized_; |
| 125 | 128 |
| 126 // The maximum number of recent visits to examine in GetFrecency(). | 129 // The maximum number of recent visits to examine in GetFrecency(). |
| 127 static const size_t kMaxVisitsToScore; | 130 static const size_t kMaxVisitsToScore; |
| 128 | 131 |
| 132 // Untyped visits to bookmarked pages score this, compared to 1 for | |
| 133 // untyped visits to non-bookmarked pages and 20 for typed visits. | |
| 134 static int bookmark_value; | |
| 135 | |
| 129 // If true, assign raw scores to be max(whatever it normally would be, | 136 // If true, assign raw scores to be max(whatever it normally would be, |
| 130 // a score that's similar to the score HistoryURL provider would assign). | 137 // a score that's similar to the score HistoryURL provider would assign). |
| 131 // This variable is set in the constructor by examining the field trial | 138 // This variable is set in the constructor by examining the field trial |
| 132 // state. | 139 // state. |
| 133 static bool also_do_hup_like_scoring; | 140 static bool also_do_hup_like_scoring; |
| 134 | 141 |
| 135 // The maximum score that can be assigned to non-inlineable matches. | 142 // The maximum score that can be assigned to non-inlineable matches. |
| 136 // This is useful because often we want inlineable matches to come | 143 // This is useful because often we want inlineable matches to come |
| 137 // first (even if they don't sometimes score as well as non-inlineable | 144 // first (even if they don't sometimes score as well as non-inlineable |
| 138 // matches) because if a non-inlineable match comes first than all matches | 145 // matches) because if a non-inlineable match comes first than all matches |
| 139 // will get demoted later in HistoryQuickProvider to non-inlineable scores. | 146 // will get demoted later in HistoryQuickProvider to non-inlineable scores. |
| 140 // Set to -1 to indicate no maximum score. | 147 // Set to -1 to indicate no maximum score. |
| 141 static int max_assigned_score_for_non_inlineable_matches; | 148 static int max_assigned_score_for_non_inlineable_matches; |
| 142 }; | 149 }; |
| 143 typedef std::vector<ScoredHistoryMatch> ScoredHistoryMatches; | 150 typedef std::vector<ScoredHistoryMatch> ScoredHistoryMatches; |
| 144 | 151 |
| 145 } // namespace history | 152 } // namespace history |
| 146 | 153 |
| 147 #endif // CHROME_BROWSER_HISTORY_SCORED_HISTORY_MATCH_H_ | 154 #endif // CHROME_BROWSER_HISTORY_SCORED_HISTORY_MATCH_H_ |
| OLD | NEW |