OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 int did_not_accept_suggestion, | 229 int did_not_accept_suggestion, |
230 MatchMap* map); | 230 MatchMap* map); |
231 | 231 |
232 // Determines the relevance for a particular match. We use different scoring | 232 // Determines the relevance for a particular match. We use different scoring |
233 // algorithms for the different types of matches. | 233 // algorithms for the different types of matches. |
234 int CalculateRelevanceForWhatYouTyped() const; | 234 int CalculateRelevanceForWhatYouTyped() const; |
235 // |time| is the time at which this query was last seen. |is_keyword| is true | 235 // |time| is the time at which this query was last seen. |is_keyword| is true |
236 // if the search is from the keyword provider. | 236 // if the search is from the keyword provider. |
237 int CalculateRelevanceForHistory(const base::Time& time, | 237 int CalculateRelevanceForHistory(const base::Time& time, |
238 bool is_keyword) const; | 238 bool is_keyword) const; |
239 // |suggestion_value| is the index of the suggestion in |suggest_results| that | 239 // |result_number| is the index of the suggestion in the result set from the |
240 // was returned from the server; the best suggestion is suggestion number 0. | 240 // server; the best suggestion is suggestion number 0. |is_keyword| is true |
241 // |is_keyword| is true if the search is from the keyword provider. | 241 // if the search is from the keyword provider. |
242 int CalculateRelevanceForSuggestion(const SuggestResults& suggest_results, | 242 int CalculateRelevanceForSuggestion(size_t num_results, |
243 size_t suggestion_number, | 243 size_t result_number, |
244 bool is_keyword) const; | 244 bool is_keyword) const; |
245 // |suggestion_value| is same as above. |is_keyword| is true if the navigation | 245 // |result_number| is same as above. |is_keyword| is true if the navigation |
246 // result was suggested by the keyword provider. | 246 // result was suggested by the keyword provider. |
247 int CalculateRelevanceForNavigation(size_t suggestion_value, | 247 int CalculateRelevanceForNavigation(size_t num_results, |
| 248 size_t result_number, |
248 bool is_keyword) const; | 249 bool is_keyword) const; |
249 | 250 |
250 // Creates an AutocompleteMatch for "Search <engine> for |query_string|" with | 251 // Creates an AutocompleteMatch for "Search <engine> for |query_string|" with |
251 // the supplied relevance. Adds this match to |map|; if such a match already | 252 // the supplied relevance. Adds this match to |map|; if such a match already |
252 // exists, whichever one has lower relevance is eliminated. | 253 // exists, whichever one has lower relevance is eliminated. |
253 void AddMatchToMap(const std::wstring& query_string, | 254 void AddMatchToMap(const std::wstring& query_string, |
254 int relevance, | 255 int relevance, |
255 AutocompleteMatch::Type type, | 256 AutocompleteMatch::Type type, |
256 int accepted_suggestion, | 257 int accepted_suggestion, |
257 bool is_keyword, | 258 bool is_keyword, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 NavigationResults keyword_navigation_results_; | 316 NavigationResults keyword_navigation_results_; |
316 NavigationResults default_navigation_results_; | 317 NavigationResults default_navigation_results_; |
317 | 318 |
318 // Whether suggest_results_ is valid. | 319 // Whether suggest_results_ is valid. |
319 bool have_suggest_results_; | 320 bool have_suggest_results_; |
320 | 321 |
321 DISALLOW_EVIL_CONSTRUCTORS(SearchProvider); | 322 DISALLOW_EVIL_CONSTRUCTORS(SearchProvider); |
322 }; | 323 }; |
323 | 324 |
324 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ | 325 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ |
OLD | NEW |