| 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 virtual void Stop(bool clear_cached_results) OVERRIDE; |
| 163 | 164 |
| 164 // BaseSearchProvider: | 165 // BaseSearchProvider: |
| 165 virtual const TemplateURL* GetTemplateURL(bool is_keyword) const OVERRIDE; | 166 virtual const TemplateURL* GetTemplateURL(bool is_keyword) const OVERRIDE; |
| 166 virtual const AutocompleteInput GetInput(bool is_keyword) const OVERRIDE; | 167 virtual const AutocompleteInput GetInput(bool is_keyword) const OVERRIDE; |
| 167 virtual bool ShouldAppendExtraParams( | 168 virtual bool ShouldAppendExtraParams( |
| 168 const SearchSuggestionParser::SuggestResult& result) const OVERRIDE; | 169 const SearchSuggestionParser::SuggestResult& result) const OVERRIDE; |
| 169 virtual void StopSuggest() OVERRIDE; | |
| 170 virtual void ClearAllResults() OVERRIDE; | |
| 171 virtual void RecordDeletionResult(bool success) OVERRIDE; | 170 virtual void RecordDeletionResult(bool success) OVERRIDE; |
| 172 | 171 |
| 173 // net::URLFetcherDelegate: | 172 // net::URLFetcherDelegate: |
| 174 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; | 173 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; |
| 175 | 174 |
| 175 // Stops the suggest query. |
| 176 // NOTE: This does not update |done_|. Callers must do so. |
| 177 void StopSuggest(); |
| 178 |
| 179 // Clears the current results. |
| 180 void ClearAllResults(); |
| 181 |
| 176 // Recalculates the match contents class of |results| to better display | 182 // Recalculates the match contents class of |results| to better display |
| 177 // against the current input and user's language. | 183 // against the current input and user's language. |
| 178 void UpdateMatchContentsClass(const base::string16& input_text, | 184 void UpdateMatchContentsClass(const base::string16& input_text, |
| 179 SearchSuggestionParser::Results* results); | 185 SearchSuggestionParser::Results* results); |
| 180 | 186 |
| 181 // Called after ParseSuggestResults to rank the |results|. | 187 // Called after ParseSuggestResults to rank the |results|. |
| 182 void SortResults(bool is_keyword, SearchSuggestionParser::Results* results); | 188 void SortResults(bool is_keyword, SearchSuggestionParser::Results* results); |
| 183 | 189 |
| 184 // Records UMA statistics about a suggest server response. | 190 // Records UMA statistics about a suggest server response. |
| 185 void LogFetchComplete(bool success, bool is_keyword); | 191 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_; | 362 base::TimeTicks token_expiration_time_; |
| 357 | 363 |
| 358 // Answers prefetch management. | 364 // Answers prefetch management. |
| 359 AnswersQueryData prefetch_data_; // Data to use for query prefetching. | 365 AnswersQueryData prefetch_data_; // Data to use for query prefetching. |
| 360 AnswersQueryData last_answer_seen_; // Last answer seen. | 366 AnswersQueryData last_answer_seen_; // Last answer seen. |
| 361 | 367 |
| 362 DISALLOW_COPY_AND_ASSIGN(SearchProvider); | 368 DISALLOW_COPY_AND_ASSIGN(SearchProvider); |
| 363 }; | 369 }; |
| 364 | 370 |
| 365 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ | 371 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ |
| OLD | NEW |