| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // This file contains the Search autocomplete provider. This provider is | 5 // This file contains the Search autocomplete provider. This provider is |
| 6 // responsible for all non-keyword autocomplete entries that start with | 6 // responsible for all non-keyword autocomplete entries that start with |
| 7 // "Search <engine> for ...", including searching for the current input string, | 7 // "Search <engine> for ...", including searching for the current input string, |
| 8 // search history, and search suggestions. An instance of it gets created and | 8 // search history, and search suggestions. An instance of it gets created and |
| 9 // managed by the autocomplete controller. | 9 // managed by the autocomplete controller. |
| 10 // | 10 // |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 | 109 |
| 110 // Converts the parsed server results in server_results_ to a set of | 110 // Converts the parsed server results in server_results_ to a set of |
| 111 // AutocompleteMatches and adds them to |matches_|. This also sets |done_| | 111 // AutocompleteMatches and adds them to |matches_|. This also sets |done_| |
| 112 // correctly. | 112 // correctly. |
| 113 void ConvertResultsToAutocompleteMatches(); | 113 void ConvertResultsToAutocompleteMatches(); |
| 114 | 114 |
| 115 // Determines the relevance for a particular match. We use different scoring | 115 // Determines the relevance for a particular match. We use different scoring |
| 116 // algorithms for the different types of matches. | 116 // algorithms for the different types of matches. |
| 117 int CalculateRelevanceForWhatYouTyped() const; | 117 int CalculateRelevanceForWhatYouTyped() const; |
| 118 // |time| is the time at which this query was last seen. | 118 // |time| is the time at which this query was last seen. |
| 119 int CalculateRelevanceForHistory(const Time& time) const; | 119 int CalculateRelevanceForHistory(const base::Time& time) const; |
| 120 // |suggestion_value| is which suggestion this is in the list returned from | 120 // |suggestion_value| is which suggestion this is in the list returned from |
| 121 // the server; the best suggestion is suggestion number 0. | 121 // the server; the best suggestion is suggestion number 0. |
| 122 int CalculateRelevanceForSuggestion(size_t suggestion_value) const; | 122 int CalculateRelevanceForSuggestion(size_t suggestion_value) const; |
| 123 // |suggestion_value| is same as above. | 123 // |suggestion_value| is same as above. |
| 124 int CalculateRelevanceForNavigation(size_t suggestion_value) const; | 124 int CalculateRelevanceForNavigation(size_t suggestion_value) const; |
| 125 | 125 |
| 126 // Creates an AutocompleteMatch for "Search <engine> for |query_string|" with | 126 // Creates an AutocompleteMatch for "Search <engine> for |query_string|" with |
| 127 // the supplied relevance. Adds this match to |map|; if such a match already | 127 // the supplied relevance. Adds this match to |map|; if such a match already |
| 128 // exists, whichever one has lower relevance is eliminated. | 128 // exists, whichever one has lower relevance is eliminated. |
| 129 void AddMatchToMap(const std::wstring& query_string, | 129 void AddMatchToMap(const std::wstring& query_string, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 // Navigational suggestions returned by the server. | 185 // Navigational suggestions returned by the server. |
| 186 NavigationResults navigation_results_; | 186 NavigationResults navigation_results_; |
| 187 | 187 |
| 188 // Whether suggest_results_ is valid. | 188 // Whether suggest_results_ is valid. |
| 189 bool have_suggest_results_; | 189 bool have_suggest_results_; |
| 190 | 190 |
| 191 DISALLOW_EVIL_CONSTRUCTORS(SearchProvider); | 191 DISALLOW_EVIL_CONSTRUCTORS(SearchProvider); |
| 192 }; | 192 }; |
| 193 | 193 |
| 194 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H__ | 194 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H__ |
| OLD | NEW |