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

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

Issue 836213002: Assume all providers may give zero suggest responses. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation issue in athena Created 5 years, 11 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
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, no more notifications should be sent.
155 // 155 //
156 // |minimal_changes| is an optimization that lets the provider do less work 156 // |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 157 // when the |input|'s text hasn't changed. See the body of
158 // OmniboxPopupModel::StartAutocomplete(). 158 // OmniboxPopupModel::StartAutocomplete().
159 virtual void Start(const AutocompleteInput& input, bool minimal_changes) = 0; 159 //
160 // |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
162 // 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.
164 virtual void Start(const AutocompleteInput& input,
165 bool minimal_changes,
166 bool called_due_to_focus) = 0;
160 167
161 // Called when a provider must not make any more callbacks for the current 168 // Called when a provider must not make any more callbacks for the current
162 // query. This will be called regardless of whether the provider is already 169 // query. This will be called regardless of whether the provider is already
163 // done. If the provider caches any results, it should clear the cache based 170 // done. If the provider caches any results, it should clear the cache based
164 // on the value of |clear_cached_results|. 171 // on the value of |clear_cached_results|.
165 virtual void Stop(bool clear_cached_results); 172 virtual void Stop(bool clear_cached_results);
166 173
167 // Returns the enum equivalent to the name of this provider. 174 // Returns the enum equivalent to the name of this provider.
168 // TODO(derat): Make metrics use AutocompleteProvider::Type directly, or at 175 // TODO(derat): Make metrics use AutocompleteProvider::Type directly, or at
169 // least move this method to the metrics directory. 176 // least move this method to the metrics directory.
(...skipping 20 matching lines...) Expand all
190 197
191 // Returns the set of matches for the current query. 198 // Returns the set of matches for the current query.
192 const ACMatches& matches() const { return matches_; } 199 const ACMatches& matches() const { return matches_; }
193 200
194 // Returns whether the provider is done processing the query. 201 // Returns whether the provider is done processing the query.
195 bool done() const { return done_; } 202 bool done() const { return done_; }
196 203
197 // Returns this provider's type. 204 // Returns this provider's type.
198 Type type() const { return type_; } 205 Type type() const { return type_; }
199 206
200 // Returns whether the provider wants to provide matches in response to the
201 // omnibox being focused.
202 virtual bool ProvidesMatchesOnOmniboxFocus() const;
203
204 // Returns a string describing this provider's type. 207 // Returns a string describing this provider's type.
205 const char* GetName() const; 208 const char* GetName() const;
206 209
207 // A suggested upper bound for how many matches a provider should return. 210 // A suggested upper bound for how many matches a provider should return.
208 // TODO(pkasting): http://b/1111299 , http://b/933133 This should go away once 211 // TODO(pkasting): http://b/1111299 , http://b/933133 This should go away once
209 // we have good relevance heuristics; the controller should handle all 212 // we have good relevance heuristics; the controller should handle all
210 // culling. 213 // culling.
211 static const size_t kMaxMatches; 214 static const size_t kMaxMatches;
212 215
213 protected: 216 protected:
(...skipping 29 matching lines...) Expand all
243 ACMatches matches_; 246 ACMatches matches_;
244 bool done_; 247 bool done_;
245 248
246 Type type_; 249 Type type_;
247 250
248 private: 251 private:
249 DISALLOW_COPY_AND_ASSIGN(AutocompleteProvider); 252 DISALLOW_COPY_AND_ASSIGN(AutocompleteProvider);
250 }; 253 };
251 254
252 #endif // COMPONENTS_OMNIBOX_AUTOCOMPLETE_PROVIDER_H_ 255 #endif // COMPONENTS_OMNIBOX_AUTOCOMPLETE_PROVIDER_H_
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/zero_suggest_provider_unittest.cc ('k') | components/omnibox/autocomplete_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698