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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 | 90 |
| 91 // Pre-calculates days_ago_to_recency_numerator_, used in | 91 // Pre-calculates days_ago_to_recency_numerator_, used in |
| 92 // GetRecencyScore(). | 92 // GetRecencyScore(). |
| 93 static void FillInDaysAgoToRecencyScoreArray(); | 93 static void FillInDaysAgoToRecencyScoreArray(); |
| 94 | 94 |
| 95 // Returns a popularity score based on |typed_count| and | 95 // Returns a popularity score based on |typed_count| and |
| 96 // |visit_count|. | 96 // |visit_count|. |
| 97 static float GetPopularityScore(int typed_count, | 97 static float GetPopularityScore(int typed_count, |
| 98 int visit_count); | 98 int visit_count); |
| 99 | 99 |
| 100 // Sets use_new_scoring based on command line flags and/or | |
| 101 // field trial state. | |
| 102 static void InitializeNewScoringField(); | |
| 103 | |
| 100 // End of functions used only in "new" scoring -------------------------- | 104 // End of functions used only in "new" scoring -------------------------- |
| 101 | 105 |
| 102 // An interim score taking into consideration location and completeness | 106 // An interim score taking into consideration location and completeness |
| 103 // of the match. | 107 // of the match. |
| 104 int raw_score; | 108 int raw_score; |
| 105 TermMatches url_matches; // Term matches within the URL. | 109 TermMatches url_matches; // Term matches within the URL. |
| 106 TermMatches title_matches; // Term matches within the page title. | 110 TermMatches title_matches; // Term matches within the page title. |
| 107 bool can_inline; // True if this is a candidate for in-line autocompletion. | 111 bool can_inline; // True if this is a candidate for in-line autocompletion. |
| 108 | 112 |
| 109 // Pre-computed information to speed up calculating recency scores. | 113 // Pre-computed information to speed up calculating recency scores. |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 120 // mapping how raw terms scores (a weighted sum of the number of | 124 // mapping how raw terms scores (a weighted sum of the number of |
| 121 // hits for the term, weighted by how important the hit is: | 125 // hits for the term, weighted by how important the hit is: |
| 122 // hostname, path, etc.) to the topicality score we should assign | 126 // hostname, path, etc.) to the topicality score we should assign |
| 123 // it. This allows easy lookups of scores without requiring math. | 127 // it. This allows easy lookups of scores without requiring math. |
| 124 // This is initialized upon first use of GetTopicalityScore(), | 128 // This is initialized upon first use of GetTopicalityScore(), |
| 125 // which calls FillInTermScoreToTopicalityScoreArray(). | 129 // which calls FillInTermScoreToTopicalityScoreArray(). |
| 126 static const int kMaxRawTermScore = 30; | 130 static const int kMaxRawTermScore = 30; |
| 127 static float* raw_term_score_to_topicality_score; | 131 static float* raw_term_score_to_topicality_score; |
| 128 | 132 |
| 129 // Allows us to determing setting for use_new_scoring_ only once. | 133 // Allows us to determing setting for use_new_scoring_ only once. |
| 130 static bool initialized; | 134 static bool initialized; |
|
sky
2012/06/15 16:41:28
I missed this earlier, these should end with _
Mark P
2012/06/15 18:01:20
Fixed.
| |
| 131 | 135 |
| 132 // Whether to use new-score or old-scoring. Set in the constructor | 136 // Whether to use new-score or old-scoring. Set in the constructor |
| 133 // by examining command line flags. | 137 // by examining command line flags. |
| 134 static bool use_new_scoring; | 138 static bool use_new_scoring; |
| 135 }; | 139 }; |
| 136 typedef std::vector<ScoredHistoryMatch> ScoredHistoryMatches; | 140 typedef std::vector<ScoredHistoryMatch> ScoredHistoryMatches; |
| 137 | 141 |
| 138 } // namespace history | 142 } // namespace history |
| 139 | 143 |
| 140 #endif // CHROME_BROWSER_HISTORY_SCORED_HISTORY_MATCH_H_ | 144 #endif // CHROME_BROWSER_HISTORY_SCORED_HISTORY_MATCH_H_ |
| OLD | NEW |