| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 153 |
| 154 // Calculates the relevance score for the keyword verbatim result (if the | 154 // Calculates the relevance score for the keyword verbatim result (if the |
| 155 // input matches one of the profile's keyword). | 155 // input matches one of the profile's keyword). |
| 156 static int CalculateRelevanceForKeywordVerbatim( | 156 static int CalculateRelevanceForKeywordVerbatim( |
| 157 metrics::OmniboxInputType::Type type, | 157 metrics::OmniboxInputType::Type type, |
| 158 bool prefer_keyword); | 158 bool prefer_keyword); |
| 159 | 159 |
| 160 // AutocompleteProvider: | 160 // AutocompleteProvider: |
| 161 virtual void Start(const AutocompleteInput& input, | 161 virtual void Start(const AutocompleteInput& input, |
| 162 bool minimal_changes) OVERRIDE; | 162 bool minimal_changes) OVERRIDE; |
| 163 | 163 virtual void Stop(bool clear_cached_results) OVERRIDE; |
| 164 // BaseSearchProvider: | |
| 165 virtual const TemplateURL* GetTemplateURL(bool is_keyword) const OVERRIDE; | |
| 166 virtual const AutocompleteInput GetInput(bool is_keyword) const OVERRIDE; | |
| 167 virtual bool ShouldAppendExtraParams( | |
| 168 const SearchSuggestionParser::SuggestResult& result) const OVERRIDE; | |
| 169 virtual void StopSuggest() OVERRIDE; | |
| 170 virtual void ClearAllResults() OVERRIDE; | |
| 171 virtual void RecordDeletionResult(bool success) OVERRIDE; | |
| 172 | 164 |
| 173 // net::URLFetcherDelegate: | 165 // net::URLFetcherDelegate: |
| 174 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; | 166 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; |
| 175 | 167 |
| 168 // Returns the TemplateURL corresponding to the keyword or default |
| 169 // provider based on the value of |is_keyword|. |
| 170 const TemplateURL* GetTemplateURL(bool is_keyword) const; |
| 171 |
| 172 // Returns the AutocompleteInput for keyword provider or default provider |
| 173 // based on the value of |is_keyword|. |
| 174 const AutocompleteInput& GetInput(bool is_keyword) const; |
| 175 |
| 176 // Returns whether the destination URL corresponding to the given |result| |
| 177 // should contain command-line-specified query params. |
| 178 bool ShouldAppendExtraParams( |
| 179 const SearchSuggestionParser::SuggestResult& result) const; |
| 180 |
| 181 // Stops the suggest query. |
| 182 // NOTE: This does not update |done_|. Callers must do so. |
| 183 void StopSuggest(); |
| 184 |
| 185 // Clears the current results. |
| 186 void ClearAllResults(); |
| 187 |
| 176 // Recalculates the match contents class of |results| to better display | 188 // Recalculates the match contents class of |results| to better display |
| 177 // against the current input and user's language. | 189 // against the current input and user's language. |
| 178 void UpdateMatchContentsClass(const base::string16& input_text, | 190 void UpdateMatchContentsClass(const base::string16& input_text, |
| 179 SearchSuggestionParser::Results* results); | 191 SearchSuggestionParser::Results* results); |
| 180 | 192 |
| 181 // Called after ParseSuggestResults to rank the |results|. | 193 // Called after ParseSuggestResults to rank the |results|. |
| 182 void SortResults(bool is_keyword, SearchSuggestionParser::Results* results); | 194 void SortResults(bool is_keyword, SearchSuggestionParser::Results* results); |
| 183 | 195 |
| 184 // Records UMA statistics about a suggest server response. | 196 // Records UMA statistics about a suggest server response. |
| 185 void LogFetchComplete(bool success, bool is_keyword); | 197 void LogFetchComplete(bool success, bool is_keyword); |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 base::TimeTicks token_expiration_time_; | 368 base::TimeTicks token_expiration_time_; |
| 357 | 369 |
| 358 // Answers prefetch management. | 370 // Answers prefetch management. |
| 359 AnswersQueryData prefetch_data_; // Data to use for query prefetching. | 371 AnswersQueryData prefetch_data_; // Data to use for query prefetching. |
| 360 AnswersQueryData last_answer_seen_; // Last answer seen. | 372 AnswersQueryData last_answer_seen_; // Last answer seen. |
| 361 | 373 |
| 362 DISALLOW_COPY_AND_ASSIGN(SearchProvider); | 374 DISALLOW_COPY_AND_ASSIGN(SearchProvider); |
| 363 }; | 375 }; |
| 364 | 376 |
| 365 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ | 377 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ |
| OLD | NEW |