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

Side by Side Diff: components/omnibox/autocomplete_provider.h

Issue 985503002: Omnibox - Make Omnibox Extensions Ignore Stop() Calls Due to User Idleness (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef COMPONENTS_OMNIBOX_AUTOCOMPLETE_PROVIDER_H_ 5 #ifndef COMPONENTS_OMNIBOX_AUTOCOMPLETE_PROVIDER_H_
6 #define COMPONENTS_OMNIBOX_AUTOCOMPLETE_PROVIDER_H_ 6 #define COMPONENTS_OMNIBOX_AUTOCOMPLETE_PROVIDER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 // tracking its matches for this query and whether it is done processing the 144 // tracking its matches for this query and whether it is done processing the
145 // query. When new matches are available or the provider finishes, it 145 // query. When new matches are available or the provider finishes, it
146 // calls the controller's OnProviderUpdate() method. The controller can then 146 // calls the controller's OnProviderUpdate() method. The controller can then
147 // get the new matches using the provider's accessors. 147 // get the new matches using the provider's accessors.
148 // Exception: Matches available immediately after starting the query (that 148 // Exception: Matches available immediately after starting the query (that
149 // is, synchronously) do not cause any notifications to be sent. The 149 // is, synchronously) do not cause any notifications to be sent. The
150 // controller is expected to check for these without prompting (since 150 // controller is expected to check for these without prompting (since
151 // otherwise, starting each provider running would result in a flurry of 151 // otherwise, starting each provider running would result in a flurry of
152 // notifications). 152 // notifications).
153 // 153 //
154 // Once Stop() has been called, no more notifications should be sent. 154 // Once Stop() has been called with user_inactivity_timer=false (i.e., the
155 // user did an action to cancel this input), no more notifications should
156 // be sent.
Peter Kasting 2015/03/05 23:27:28 Nit: How about: Once Stop() has been called, no m
Mark P 2015/03/06 21:24:34 Took (roughly) your suggestions. I like removing
155 // 157 //
156 // |minimal_changes| is an optimization that lets the provider do less work 158 // |minimal_changes| is an optimization that lets the provider do less work
157 // when the |input|'s text hasn't changed. See the body of 159 // when the |input|'s text hasn't changed. See the body of
158 // OmniboxPopupModel::StartAutocomplete(). 160 // OmniboxPopupModel::StartAutocomplete().
159 // 161 //
160 // |called_due_to_focus| is true when Start() is being called in response to 162 // |called_due_to_focus| is true when Start() is being called in response to
161 // the omnibox being focused, instead of due to e.g. user input changes. Most 163 // the omnibox being focused, instead of due to e.g. user input changes. Most
162 // providers should not provide matches in this case. Providers which want to 164 // providers should not provide matches in this case. Providers which want to
163 // display matches on focus can use this flag to know when they can do so. 165 // display matches on focus can use this flag to know when they can do so.
164 virtual void Start(const AutocompleteInput& input, 166 virtual void Start(const AutocompleteInput& input,
165 bool minimal_changes, 167 bool minimal_changes,
166 bool called_due_to_focus) = 0; 168 bool called_due_to_focus) = 0;
167 169
168 // Called when a provider must not make any more callbacks for the current 170 // Called with user_inactivity_timer=false (i.e., the user did an action to
169 // query. This will be called regardless of whether the provider is already 171 // cancel this input) when a provider must not make any more callbacks for
170 // done. If the provider caches any results, it should clear the cache based 172 // the current query. When called with user_inactivity_timer=true, providers
171 // on the value of |clear_cached_results|. 173 // should generally not make any more callbacks for the current query, though
172 virtual void Stop(bool clear_cached_results); 174 // they are allowed. Stop() will be called regardless of whether the provider
175 // is already done. If the provider caches any results, it should clear the
176 // cache based on the value of |clear_cached_results|.
Peter Kasting 2015/03/05 23:27:28 Nit: How about: Advises the provider to stop proc
Mark P 2015/03/06 21:24:34 Very nice. Done.
177 virtual void Stop(bool clear_cached_results,
178 bool user_inactivity_timer);
173 179
174 // Returns the enum equivalent to the name of this provider. 180 // Returns the enum equivalent to the name of this provider.
175 // TODO(derat): Make metrics use AutocompleteProvider::Type directly, or at 181 // TODO(derat): Make metrics use AutocompleteProvider::Type directly, or at
176 // least move this method to the metrics directory. 182 // least move this method to the metrics directory.
177 metrics::OmniboxEventProto_ProviderType AsOmniboxEventProviderType() const; 183 metrics::OmniboxEventProto_ProviderType AsOmniboxEventProviderType() const;
178 184
179 // Called to delete a match and the backing data that produced it. This 185 // Called to delete a match and the backing data that produced it. This
180 // match should not appear again in this or future queries. This can only be 186 // match should not appear again in this or future queries. This can only be
181 // called for matches the provider marks as deletable. This should only be 187 // called for matches the provider marks as deletable. This should only be
182 // called when no query is running. 188 // called when no query is running.
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 ACMatches matches_; 252 ACMatches matches_;
247 bool done_; 253 bool done_;
248 254
249 Type type_; 255 Type type_;
250 256
251 private: 257 private:
252 DISALLOW_COPY_AND_ASSIGN(AutocompleteProvider); 258 DISALLOW_COPY_AND_ASSIGN(AutocompleteProvider);
253 }; 259 };
254 260
255 #endif // COMPONENTS_OMNIBOX_AUTOCOMPLETE_PROVIDER_H_ 261 #endif // COMPONENTS_OMNIBOX_AUTOCOMPLETE_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698