| 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 autocomplete entries that start with "Search <engine> | 6 // responsible for all autocomplete entries that start with "Search <engine> |
| 7 // for ...", including searching for the current input string, search | 7 // for ...", including searching for the current input string, search |
| 8 // history, and search suggestions. An instance of it gets created and | 8 // 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 int did_not_accept_suggestion, | 253 int did_not_accept_suggestion, |
| 254 MatchMap* map); | 254 MatchMap* map); |
| 255 | 255 |
| 256 // Calculates relevance scores for all |results|. | 256 // Calculates relevance scores for all |results|. |
| 257 SearchSuggestionParser::SuggestResults ScoreHistoryResults( | 257 SearchSuggestionParser::SuggestResults ScoreHistoryResults( |
| 258 const HistoryResults& results, | 258 const HistoryResults& results, |
| 259 bool base_prevent_inline_autocomplete, | 259 bool base_prevent_inline_autocomplete, |
| 260 bool input_multiple_words, | 260 bool input_multiple_words, |
| 261 const base::string16& input_text, | 261 const base::string16& input_text, |
| 262 bool is_keyword); | 262 bool is_keyword); |
| 263 | 263 void ScoreHistoryResultsMultiWord( |
| 264 const HistoryResults& results, |
| 265 bool is_keyword, |
| 266 SearchSuggestionParser::SuggestResults* scored_results); |
| 264 // Adds matches for |results| to |map|. | 267 // Adds matches for |results| to |map|. |
| 265 void AddSuggestResultsToMap( | 268 void AddSuggestResultsToMap( |
| 266 const SearchSuggestionParser::SuggestResults& results, | 269 const SearchSuggestionParser::SuggestResults& results, |
| 267 const std::string& metadata, | 270 const std::string& metadata, |
| 268 MatchMap* map); | 271 MatchMap* map); |
| 269 | 272 |
| 270 // Gets the relevance score for the verbatim result. This value may be | 273 // Gets the relevance score for the verbatim result. This value may be |
| 271 // provided by the suggest server or calculated locally; if | 274 // provided by the suggest server or calculated locally; if |
| 272 // |relevance_from_server| is non-NULL, it will be set to indicate which of | 275 // |relevance_from_server| is non-NULL, it will be set to indicate which of |
| 273 // those is true. | 276 // those is true. |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 // The user's input. | 336 // The user's input. |
| 334 AutocompleteInput input_; | 337 AutocompleteInput input_; |
| 335 | 338 |
| 336 // Input when searching against the keyword provider. | 339 // Input when searching against the keyword provider. |
| 337 AutocompleteInput keyword_input_; | 340 AutocompleteInput keyword_input_; |
| 338 | 341 |
| 339 // Searches in the user's history that begin with the input text. | 342 // Searches in the user's history that begin with the input text. |
| 340 HistoryResults keyword_history_results_; | 343 HistoryResults keyword_history_results_; |
| 341 HistoryResults default_history_results_; | 344 HistoryResults default_history_results_; |
| 342 | 345 |
| 346 // Scored searches in the user's history - based on xxx_history_results_. |
| 347 SearchSuggestionParser::SuggestResults scored_keyword_history_results_; |
| 348 SearchSuggestionParser::SuggestResults scored_default_history_results_; |
| 349 |
| 343 // A timer to start a query to the suggest server after the user has stopped | 350 // A timer to start a query to the suggest server after the user has stopped |
| 344 // typing for long enough. | 351 // typing for long enough. |
| 345 base::OneShotTimer<SearchProvider> timer_; | 352 base::OneShotTimer<SearchProvider> timer_; |
| 346 | 353 |
| 347 // The time at which we sent a query to the suggest server. | 354 // The time at which we sent a query to the suggest server. |
| 348 base::TimeTicks time_suggest_request_sent_; | 355 base::TimeTicks time_suggest_request_sent_; |
| 349 | 356 |
| 350 // Fetchers used to retrieve results for the keyword and default providers. | 357 // Fetchers used to retrieve results for the keyword and default providers. |
| 351 scoped_ptr<net::URLFetcher> keyword_fetcher_; | 358 scoped_ptr<net::URLFetcher> keyword_fetcher_; |
| 352 scoped_ptr<net::URLFetcher> default_fetcher_; | 359 scoped_ptr<net::URLFetcher> default_fetcher_; |
| 353 | 360 |
| 354 // Results from the default and keyword search providers. | 361 // Results from the default and keyword search providers. |
| 355 SearchSuggestionParser::Results default_results_; | 362 SearchSuggestionParser::Results default_results_; |
| 356 SearchSuggestionParser::Results keyword_results_; | 363 SearchSuggestionParser::Results keyword_results_; |
| 357 | 364 |
| 358 GURL current_page_url_; | 365 GURL current_page_url_; |
| 359 | 366 |
| 360 // Session token management. | 367 // Session token management. |
| 361 std::string current_token_; | 368 std::string current_token_; |
| 362 base::TimeTicks token_expiration_time_; | 369 base::TimeTicks token_expiration_time_; |
| 363 | 370 |
| 364 // Answers prefetch management. | 371 // Answers prefetch management. |
| 365 AnswersQueryData prefetch_data_; // Data to use for query prefetching. | 372 AnswersQueryData prefetch_data_; // Data to use for query prefetching. |
| 366 AnswersQueryData last_answer_seen_; // Last answer seen. | 373 AnswersQueryData last_answer_seen_; // Last answer seen. |
| 367 | 374 |
| 368 DISALLOW_COPY_AND_ASSIGN(SearchProvider); | 375 DISALLOW_COPY_AND_ASSIGN(SearchProvider); |
| 369 }; | 376 }; |
| 370 | 377 |
| 371 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ | 378 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ |
| OLD | NEW |