Index: chrome/browser/autocomplete/history_contents_provider.h |
diff --git a/chrome/browser/autocomplete/history_contents_provider.h b/chrome/browser/autocomplete/history_contents_provider.h |
index 7ceb0b90639758ce5eff2c5d683d37af39068001..f4fd334afd17bcadce9fea75f681a328fe9f9d10 100644 |
--- a/chrome/browser/autocomplete/history_contents_provider.h |
+++ b/chrome/browser/autocomplete/history_contents_provider.h |
@@ -35,6 +35,22 @@ class HistoryContentsProvider : public HistoryProvider { |
virtual void Stop() OVERRIDE; |
private: |
+ // When processing the results from the history query, this structure points |
+ // to a single result. It allows the results to be sorted and processed |
+ // without modifying the larger and slower results structure. |
+ struct MatchReference { |
+ MatchReference(const history::URLResult* result, |
+ int relevance, |
+ float confidence); |
+ |
+ static bool CompareRelevance(const MatchReference& lhs, |
+ const MatchReference& rhs); |
+ |
+ const history::URLResult* result; |
+ int relevance; // Score of relevance computed by CalculateRelevance. |
+ float confidence; // Confidence computed by CalculateConfidence. |
+ }; |
+ |
virtual ~HistoryContentsProvider(); |
void QueryComplete(HistoryService::Handle handle, |
@@ -45,8 +61,7 @@ class HistoryContentsProvider : public HistoryProvider { |
void ConvertResults(); |
// Creates and returns an AutocompleteMatch from a MatchingPageResult. |
- AutocompleteMatch ResultToMatch(const history::URLResult& result, |
- int score); |
+ AutocompleteMatch ResultToMatch(const MatchReference& match_reference); |
// Adds ACMatchClassifications to match from the offset positions in |
// page_result. |
@@ -57,6 +72,12 @@ class HistoryContentsProvider : public HistoryProvider { |
// chart in autocomplete.h for the list of values this returns. |
int CalculateRelevance(const history::URLResult& result); |
+ // Calculates and returns the confidence for a particular result. This is |
+ // calculated by comparing the result's |visit_count| to that of all the |
+ // results. |
+ float CalculateConfidence(const history::URLResult& result, |
+ const history::QueryResults& results) const; |
+ |
// Queries the bookmarks for any bookmarks whose title matches input. All |
// matches are added directly to results_. |
void QueryBookmarks(const AutocompleteInput& input); |