Chromium Code Reviews| Index: chrome/browser/autocomplete/search_provider.cc |
| diff --git a/chrome/browser/autocomplete/search_provider.cc b/chrome/browser/autocomplete/search_provider.cc |
| index 04b37a5a6092bfdf1c01e92a91d7a21963d3a863..9e4409a5d1c133a90a92efe5b987a881926ebf9a 100644 |
| --- a/chrome/browser/autocomplete/search_provider.cc |
| +++ b/chrome/browser/autocomplete/search_provider.cc |
| @@ -250,6 +250,14 @@ void SearchProvider::Start(const AutocompleteInput& input, |
| UpdateMatches(); |
| } |
| +void SearchProvider::Stop(bool clear_cached_results) { |
| + StopSuggest(); |
| + done_ = true; |
| + |
| + if (clear_cached_results) |
| + ClearAllResults(); |
| +} |
| + |
| const TemplateURL* SearchProvider::GetTemplateURL(bool is_keyword) const { |
| return is_keyword ? providers_.GetKeywordProviderURL() |
| : providers_.GetDefaultProviderURL(); |
| @@ -265,23 +273,6 @@ bool SearchProvider::ShouldAppendExtraParams( |
| providers_.default_provider().empty(); |
| } |
| -void SearchProvider::StopSuggest() { |
| - // Increment the appropriate field in the histogram by the number of |
| - // pending requests that were invalidated. |
| - for (int i = 0; i < suggest_results_pending_; ++i) |
| - LogOmniboxSuggestRequest(REQUEST_INVALIDATED); |
| - suggest_results_pending_ = 0; |
| - timer_.Stop(); |
| - // Stop any in-progress URL fetches. |
| - keyword_fetcher_.reset(); |
| - default_fetcher_.reset(); |
| -} |
| - |
| -void SearchProvider::ClearAllResults() { |
| - keyword_results_.Clear(); |
| - default_results_.Clear(); |
| -} |
| - |
| void SearchProvider::RecordDeletionResult(bool success) { |
| if (success) { |
| base::RecordAction( |
| @@ -324,6 +315,23 @@ void SearchProvider::OnURLFetchComplete(const net::URLFetcher* source) { |
| listener_->OnProviderUpdate(results_updated); |
| } |
| +void SearchProvider::StopSuggest() { |
|
Peter Kasting
2014/08/13 17:33:45
Nit: You still haven't inlined these two functions
hashimoto
2014/08/14 03:52:09
Sorry to not mentioning this.
StopSuggest() and Cl
|
| + // Increment the appropriate field in the histogram by the number of |
| + // pending requests that were invalidated. |
| + for (int i = 0; i < suggest_results_pending_; ++i) |
| + LogOmniboxSuggestRequest(REQUEST_INVALIDATED); |
| + suggest_results_pending_ = 0; |
| + timer_.Stop(); |
| + // Stop any in-progress URL fetches. |
| + keyword_fetcher_.reset(); |
| + default_fetcher_.reset(); |
| +} |
| + |
| +void SearchProvider::ClearAllResults() { |
| + keyword_results_.Clear(); |
| + default_results_.Clear(); |
| +} |
| + |
| void SearchProvider::UpdateMatchContentsClass( |
| const base::string16& input_text, |
| SearchSuggestionParser::Results* results) { |