Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Unified Diff: chrome/browser/autocomplete/zero_suggest_provider.h

Issue 436833002: Stop sharing BaseSearchProvider::OnURLFetchComplete between 2 providers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/autocomplete/zero_suggest_provider.h
diff --git a/chrome/browser/autocomplete/zero_suggest_provider.h b/chrome/browser/autocomplete/zero_suggest_provider.h
index 23dc2fe1e6d8217ed75dc94f74098062df029a57..5c7b9f7287cea6d4d3c9a526ea3dea91a910d6ba 100644
--- a/chrome/browser/autocomplete/zero_suggest_provider.h
+++ b/chrome/browser/autocomplete/zero_suggest_provider.h
@@ -21,7 +21,9 @@
#include "chrome/browser/autocomplete/search_provider.h"
#include "chrome/browser/history/history_types.h"
#include "components/metrics/proto/omnibox_event.pb.h"
+#include "net/url_request/url_fetcher_delegate.h"
+class AutocompleteProviderListener;
class TemplateURLService;
namespace base {
@@ -47,7 +49,8 @@ class PrefRegistrySyncable;
// TODO(jered): Consider deleting this class and building this functionality
// into SearchProvider after dogfood and after we break the association between
// omnibox text and suggestions.
-class ZeroSuggestProvider : public BaseSearchProvider {
+class ZeroSuggestProvider : public BaseSearchProvider,
+ public net::URLFetcherDelegate {
public:
// Creates and returns an instance of this provider.
static ZeroSuggestProvider* Create(AutocompleteProviderListener* listener,
@@ -78,21 +81,22 @@ class ZeroSuggestProvider : public BaseSearchProvider {
virtual ~ZeroSuggestProvider();
// BaseSearchProvider:
- virtual bool StoreSuggestionResponse(const std::string& json_data,
- const base::Value& parsed_data) OVERRIDE;
virtual const TemplateURL* GetTemplateURL(bool is_keyword) const OVERRIDE;
virtual const AutocompleteInput GetInput(bool is_keyword) const OVERRIDE;
- virtual SearchSuggestionParser::Results* GetResultsToFill(
- bool is_keyword) OVERRIDE;
virtual bool ShouldAppendExtraParams(
const SearchSuggestionParser::SuggestResult& result) const OVERRIDE;
virtual void StopSuggest() OVERRIDE;
virtual void ClearAllResults() OVERRIDE;
- virtual int GetDefaultResultRelevance() const OVERRIDE;
virtual void RecordDeletionResult(bool success) OVERRIDE;
- virtual void LogFetchComplete(bool success, bool is_keyword) OVERRIDE;
- virtual bool IsKeywordFetcher(const net::URLFetcher* fetcher) const OVERRIDE;
- virtual void UpdateMatches() OVERRIDE;
+
+ // net::URLFetcherDelegate:
+ virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
+
+ // Optionally, cache the received |json_data| and return true if we want
+ // to stop processing results at this point. The |parsed_data| is the parsed
+ // version of |json_data| used to determine if we received an empty result.
+ bool StoreSuggestionResponse(const std::string& json_data,
+ const base::Value& parsed_data);
// Adds AutocompleteMatches for each of the suggestions in |results| to
// |map|.
@@ -134,6 +138,8 @@ class ZeroSuggestProvider : public BaseSearchProvider {
// populates |matches_| with cached results.
void MaybeUseCachedSuggestions();
+ AutocompleteProviderListener* listener_;
+
// The URL for which a suggestion fetch is pending.
std::string current_query_;
« no previous file with comments | « chrome/browser/autocomplete/search_provider.cc ('k') | chrome/browser/autocomplete/zero_suggest_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698