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

Side by Side Diff: chrome/browser/autocomplete/zero_suggest_provider.h

Issue 1185723002: Prepare HistoryProvider for componentization (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Response to review Created 5 years, 6 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 unified diff | Download patch
OLDNEW
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 zero-suggest autocomplete provider. This experimental 5 // This file contains the zero-suggest autocomplete provider. This experimental
6 // provider is invoked when the user focuses in the omnibox prior to editing, 6 // provider is invoked when the user focuses in the omnibox prior to editing,
7 // and generates search query suggestions based on the current URL. 7 // and generates search query suggestions based on the current URL.
8 8
9 #ifndef CHROME_BROWSER_AUTOCOMPLETE_ZERO_SUGGEST_PROVIDER_H_ 9 #ifndef CHROME_BROWSER_AUTOCOMPLETE_ZERO_SUGGEST_PROVIDER_H_
10 #define CHROME_BROWSER_AUTOCOMPLETE_ZERO_SUGGEST_PROVIDER_H_ 10 #define CHROME_BROWSER_AUTOCOMPLETE_ZERO_SUGGEST_PROVIDER_H_
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // 44 //
45 // TODO(jered): Consider deleting this class and building this functionality 45 // TODO(jered): Consider deleting this class and building this functionality
46 // into SearchProvider after dogfood and after we break the association between 46 // into SearchProvider after dogfood and after we break the association between
47 // omnibox text and suggestions. 47 // omnibox text and suggestions.
48 class ZeroSuggestProvider : public BaseSearchProvider, 48 class ZeroSuggestProvider : public BaseSearchProvider,
49 public net::URLFetcherDelegate { 49 public net::URLFetcherDelegate {
50 public: 50 public:
51 // Creates and returns an instance of this provider. 51 // Creates and returns an instance of this provider.
52 static ZeroSuggestProvider* Create(AutocompleteProviderListener* listener, 52 static ZeroSuggestProvider* Create(AutocompleteProviderListener* listener,
53 TemplateURLService* template_url_service, 53 TemplateURLService* template_url_service,
54 Profile* profile); 54 Profile* profile,
55 AutocompleteProviderClient* client);
55 56
56 // Registers a preference used to cache zero suggest results. 57 // Registers a preference used to cache zero suggest results.
57 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); 58 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
58 59
59 // AutocompleteProvider: 60 // AutocompleteProvider:
60 void Start(const AutocompleteInput& input, 61 void Start(const AutocompleteInput& input,
61 bool minimal_changes, 62 bool minimal_changes,
62 bool called_due_to_focus) override; 63 bool called_due_to_focus) override;
63 void Stop(bool clear_cached_results, 64 void Stop(bool clear_cached_results,
64 bool due_to_user_inactivity) override; 65 bool due_to_user_inactivity) override;
65 void DeleteMatch(const AutocompleteMatch& match) override; 66 void DeleteMatch(const AutocompleteMatch& match) override;
66 void AddProviderInfo(ProvidersInfo* provider_info) const override; 67 void AddProviderInfo(ProvidersInfo* provider_info) const override;
67 68
68 // Sets |field_trial_triggered_| to false. 69 // Sets |field_trial_triggered_| to false.
69 void ResetSession() override; 70 void ResetSession() override;
70 71
71 private: 72 private:
72 ZeroSuggestProvider(AutocompleteProviderListener* listener, 73 ZeroSuggestProvider(AutocompleteProviderListener* listener,
73 TemplateURLService* template_url_service, 74 TemplateURLService* template_url_service,
74 Profile* profile); 75 Profile* profile,
76 AutocompleteProviderClient* client);
75 77
76 ~ZeroSuggestProvider() override; 78 ~ZeroSuggestProvider() override;
77 79
78 // BaseSearchProvider: 80 // BaseSearchProvider:
79 const TemplateURL* GetTemplateURL(bool is_keyword) const override; 81 const TemplateURL* GetTemplateURL(bool is_keyword) const override;
80 const AutocompleteInput GetInput(bool is_keyword) const override; 82 const AutocompleteInput GetInput(bool is_keyword) const override;
81 bool ShouldAppendExtraParams( 83 bool ShouldAppendExtraParams(
82 const SearchSuggestionParser::SuggestResult& result) const override; 84 const SearchSuggestionParser::SuggestResult& result) const override;
83 void RecordDeletionResult(bool success) override; 85 void RecordDeletionResult(bool success) override;
84 86
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 // Whether we are waiting for a most visited visited urls callback to run. 165 // Whether we are waiting for a most visited visited urls callback to run.
164 bool waiting_for_most_visited_urls_request_; 166 bool waiting_for_most_visited_urls_request_;
165 167
166 // For callbacks that may be run after destruction. 168 // For callbacks that may be run after destruction.
167 base::WeakPtrFactory<ZeroSuggestProvider> weak_ptr_factory_; 169 base::WeakPtrFactory<ZeroSuggestProvider> weak_ptr_factory_;
168 170
169 DISALLOW_COPY_AND_ASSIGN(ZeroSuggestProvider); 171 DISALLOW_COPY_AND_ASSIGN(ZeroSuggestProvider);
170 }; 172 };
171 173
172 #endif // CHROME_BROWSER_AUTOCOMPLETE_ZERO_SUGGEST_PROVIDER_H_ 174 #endif // CHROME_BROWSER_AUTOCOMPLETE_ZERO_SUGGEST_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698