| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 // Extracts the suggest response metadata which SearchProvider previously | 59 // Extracts the suggest response metadata which SearchProvider previously |
| 60 // stored for |match|. | 60 // stored for |match|. |
| 61 static std::string GetSuggestMetadata(const AutocompleteMatch& match); | 61 static std::string GetSuggestMetadata(const AutocompleteMatch& match); |
| 62 | 62 |
| 63 // Answers prefetch handling - register displayed answers. Takes the top | 63 // Answers prefetch handling - register displayed answers. Takes the top |
| 64 // match for Autocomplete and registers the contained answer data, if any. | 64 // match for Autocomplete and registers the contained answer data, if any. |
| 65 void RegisterDisplayedAnswers(const AutocompleteResult& result); | 65 void RegisterDisplayedAnswers(const AutocompleteResult& result); |
| 66 | 66 |
| 67 // AutocompleteProvider: | 67 // AutocompleteProvider: |
| 68 virtual void ResetSession() OVERRIDE; | 68 virtual void ResetSession() override; |
| 69 | 69 |
| 70 // This URL may be sent with suggest requests; see comments on CanSendURL(). | 70 // This URL may be sent with suggest requests; see comments on CanSendURL(). |
| 71 void set_current_page_url(const GURL& current_page_url) { | 71 void set_current_page_url(const GURL& current_page_url) { |
| 72 current_page_url_ = current_page_url; | 72 current_page_url_ = current_page_url; |
| 73 } | 73 } |
| 74 | 74 |
| 75 protected: | 75 protected: |
| 76 virtual ~SearchProvider(); | 76 virtual ~SearchProvider(); |
| 77 | 77 |
| 78 private: | 78 private: |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 152 |
| 153 // A helper function for UpdateAllOldResults(). | 153 // A helper function for UpdateAllOldResults(). |
| 154 static void UpdateOldResults(bool minimal_changes, | 154 static void UpdateOldResults(bool minimal_changes, |
| 155 SearchSuggestionParser::Results* results); | 155 SearchSuggestionParser::Results* results); |
| 156 | 156 |
| 157 // Returns the first match in |matches| which might be chosen as default. | 157 // Returns the first match in |matches| which might be chosen as default. |
| 158 static ACMatches::iterator FindTopMatch(ACMatches* matches); | 158 static ACMatches::iterator FindTopMatch(ACMatches* matches); |
| 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 virtual void Stop(bool clear_cached_results) override; |
| 164 | 164 |
| 165 // BaseSearchProvider: | 165 // BaseSearchProvider: |
| 166 virtual const TemplateURL* GetTemplateURL(bool is_keyword) const OVERRIDE; | 166 virtual const TemplateURL* GetTemplateURL(bool is_keyword) const override; |
| 167 virtual const AutocompleteInput GetInput(bool is_keyword) const OVERRIDE; | 167 virtual const AutocompleteInput GetInput(bool is_keyword) const override; |
| 168 virtual bool ShouldAppendExtraParams( | 168 virtual bool ShouldAppendExtraParams( |
| 169 const SearchSuggestionParser::SuggestResult& result) const OVERRIDE; | 169 const SearchSuggestionParser::SuggestResult& result) const override; |
| 170 virtual void RecordDeletionResult(bool success) OVERRIDE; | 170 virtual void RecordDeletionResult(bool success) override; |
| 171 | 171 |
| 172 // net::URLFetcherDelegate: | 172 // net::URLFetcherDelegate: |
| 173 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; | 173 virtual void OnURLFetchComplete(const net::URLFetcher* source) override; |
| 174 | 174 |
| 175 // Stops the suggest query. | 175 // Stops the suggest query. |
| 176 // NOTE: This does not update |done_|. Callers must do so. | 176 // NOTE: This does not update |done_|. Callers must do so. |
| 177 void StopSuggest(); | 177 void StopSuggest(); |
| 178 | 178 |
| 179 // Clears the current results. | 179 // Clears the current results. |
| 180 void ClearAllResults(); | 180 void ClearAllResults(); |
| 181 | 181 |
| 182 // Recalculates the match contents class of |results| to better display | 182 // Recalculates the match contents class of |results| to better display |
| 183 // against the current input and user's language. | 183 // against the current input and user's language. |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 base::TimeTicks token_expiration_time_; | 396 base::TimeTicks token_expiration_time_; |
| 397 | 397 |
| 398 // Answers prefetch management. | 398 // Answers prefetch management. |
| 399 AnswersCache answers_cache_; // Cache for last answers seen. | 399 AnswersCache answers_cache_; // Cache for last answers seen. |
| 400 AnswersQueryData prefetch_data_; // Data to use for query prefetching. | 400 AnswersQueryData prefetch_data_; // Data to use for query prefetching. |
| 401 | 401 |
| 402 DISALLOW_COPY_AND_ASSIGN(SearchProvider); | 402 DISALLOW_COPY_AND_ASSIGN(SearchProvider); |
| 403 }; | 403 }; |
| 404 | 404 |
| 405 #endif // COMPONENTS_OMNIBOX_SEARCH_PROVIDER_H_ | 405 #endif // COMPONENTS_OMNIBOX_SEARCH_PROVIDER_H_ |
| OLD | NEW |