| 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 // 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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 // Apply calculated relevance scores to the current results. | 234 // Apply calculated relevance scores to the current results. |
| 235 void ApplyCalculatedRelevance(); | 235 void ApplyCalculatedRelevance(); |
| 236 void ApplyCalculatedSuggestRelevance(SuggestResults* list, bool is_keyword); | 236 void ApplyCalculatedSuggestRelevance(SuggestResults* list, bool is_keyword); |
| 237 void ApplyCalculatedNavigationRelevance(NavigationResults* list, | 237 void ApplyCalculatedNavigationRelevance(NavigationResults* list, |
| 238 bool is_keyword); | 238 bool is_keyword); |
| 239 | 239 |
| 240 // Starts a new URLFetcher requesting suggest results from |template_url|; | 240 // Starts a new URLFetcher requesting suggest results from |template_url|; |
| 241 // callers own the returned URLFetcher, which is NULL for invalid providers. | 241 // callers own the returned URLFetcher, which is NULL for invalid providers. |
| 242 net::URLFetcher* CreateSuggestFetcher(int id, | 242 net::URLFetcher* CreateSuggestFetcher(int id, |
| 243 const TemplateURL* template_url, | 243 const TemplateURL* template_url, |
| 244 const string16& text); | 244 const AutocompleteInput& input); |
| 245 | 245 |
| 246 // Parses results from the suggest server and updates the appropriate suggest | 246 // Parses results from the suggest server and updates the appropriate suggest |
| 247 // and navigation result lists, depending on whether |is_keyword| is true. | 247 // and navigation result lists, depending on whether |is_keyword| is true. |
| 248 // Returns whether the appropriate result list members were updated. | 248 // Returns whether the appropriate result list members were updated. |
| 249 bool ParseSuggestResults(base::Value* root_val, bool is_keyword); | 249 bool ParseSuggestResults(base::Value* root_val, bool is_keyword); |
| 250 | 250 |
| 251 // Converts the parsed results to a set of AutocompleteMatches, |matches_|. | 251 // Converts the parsed results to a set of AutocompleteMatches, |matches_|. |
| 252 void ConvertResultsToAutocompleteMatches(); | 252 void ConvertResultsToAutocompleteMatches(); |
| 253 | 253 |
| 254 // Checks if suggested relevances violate certain expected constraints. | 254 // Checks if suggested relevances violate certain expected constraints. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 | 324 |
| 325 // Updates the value of |done_| from the internal state. | 325 // Updates the value of |done_| from the internal state. |
| 326 void UpdateDone(); | 326 void UpdateDone(); |
| 327 | 327 |
| 328 // Maintains the TemplateURLs used. | 328 // Maintains the TemplateURLs used. |
| 329 Providers providers_; | 329 Providers providers_; |
| 330 | 330 |
| 331 // The user's input. | 331 // The user's input. |
| 332 AutocompleteInput input_; | 332 AutocompleteInput input_; |
| 333 | 333 |
| 334 // Input text when searching against the keyword provider. | 334 // Input when searching against the keyword provider. |
| 335 string16 keyword_input_text_; | 335 AutocompleteInput keyword_input_; |
| 336 | 336 |
| 337 // Searches in the user's history that begin with the input text. | 337 // Searches in the user's history that begin with the input text. |
| 338 HistoryResults keyword_history_results_; | 338 HistoryResults keyword_history_results_; |
| 339 HistoryResults default_history_results_; | 339 HistoryResults default_history_results_; |
| 340 | 340 |
| 341 // Number of suggest results that haven't yet arrived. If greater than 0 it | 341 // Number of suggest results that haven't yet arrived. If greater than 0 it |
| 342 // indicates one of the URLFetchers is still running. | 342 // indicates one of the URLFetchers is still running. |
| 343 int suggest_results_pending_; | 343 int suggest_results_pending_; |
| 344 | 344 |
| 345 // A timer to start a query to the suggest server after the user has stopped | 345 // A timer to start a query to the suggest server after the user has stopped |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 bool field_trial_triggered_; | 386 bool field_trial_triggered_; |
| 387 | 387 |
| 388 // Same as above except that it is maintained across the current Omnibox | 388 // Same as above except that it is maintained across the current Omnibox |
| 389 // session. | 389 // session. |
| 390 bool field_trial_triggered_in_session_; | 390 bool field_trial_triggered_in_session_; |
| 391 | 391 |
| 392 DISALLOW_COPY_AND_ASSIGN(SearchProvider); | 392 DISALLOW_COPY_AND_ASSIGN(SearchProvider); |
| 393 }; | 393 }; |
| 394 | 394 |
| 395 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ | 395 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ |
| OLD | NEW |