OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 // indicates whether the results correspond to the keyword provider or default | 225 // indicates whether the results correspond to the keyword provider or default |
226 // provider. | 226 // provider. |
227 void AddSuggestResultsToMap(const SuggestResults& suggest_results, | 227 void AddSuggestResultsToMap(const SuggestResults& suggest_results, |
228 bool is_keyword, | 228 bool is_keyword, |
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. |
236 // if the search is from the keyword provider. |looks_like_url| is true if the | 236 // |is_primary_provider| is true if this match comes from the primary provider |
237 // search term would be treated as a URL if typed into the omnibox. | 237 // for the user's input (e.g. the keyword provider for a keyword input). |
| 238 // |prevent_inline_autocomplete| is true if we should not inline autocomplete |
| 239 // this query. |
238 int CalculateRelevanceForHistory(const base::Time& time, | 240 int CalculateRelevanceForHistory(const base::Time& time, |
239 bool looks_like_url, | 241 bool is_primary_provider, |
240 bool is_keyword) const; | 242 bool prevent_inline_autocomplete) const; |
241 // |result_number| is the index of the suggestion in the result set from the | 243 // |result_number| is the index of the suggestion in the result set from the |
242 // server; the best suggestion is suggestion number 0. |is_keyword| is true | 244 // server; the best suggestion is suggestion number 0. |is_keyword| is true |
243 // if the search is from the keyword provider. | 245 // if the search is from the keyword provider. |
244 int CalculateRelevanceForSuggestion(size_t num_results, | 246 int CalculateRelevanceForSuggestion(size_t num_results, |
245 size_t result_number, | 247 size_t result_number, |
246 bool is_keyword) const; | 248 bool is_keyword) const; |
247 // |result_number| is same as above. |is_keyword| is true if the navigation | 249 // |result_number| is same as above. |is_keyword| is true if the navigation |
248 // result was suggested by the keyword provider. | 250 // result was suggested by the keyword provider. |
249 int CalculateRelevanceForNavigation(size_t num_results, | 251 int CalculateRelevanceForNavigation(size_t num_results, |
250 size_t result_number, | 252 size_t result_number, |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 // Has FinalizeInstantQuery been invoked since the last |Start|? | 321 // Has FinalizeInstantQuery been invoked since the last |Start|? |
320 bool instant_finalized_; | 322 bool instant_finalized_; |
321 | 323 |
322 // The |suggest_text| parameter passed to FinalizeInstantQuery. | 324 // The |suggest_text| parameter passed to FinalizeInstantQuery. |
323 string16 default_provider_suggest_text_; | 325 string16 default_provider_suggest_text_; |
324 | 326 |
325 DISALLOW_COPY_AND_ASSIGN(SearchProvider); | 327 DISALLOW_COPY_AND_ASSIGN(SearchProvider); |
326 }; | 328 }; |
327 | 329 |
328 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ | 330 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ |
OLD | NEW |