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

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

Issue 645303003: Parametrize Suggest polling strategy and delay. Also add a parameter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed two comments. Created 6 years, 1 month 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 Search autocomplete provider. This provider is 5 // This file contains the Search autocomplete provider. This provider is
6 // responsible for all autocomplete entries that start with "Search <engine> 6 // responsible for all autocomplete entries that start with "Search <engine>
7 // for ...", including searching for the current input string, search 7 // for ...", including searching for the current input string, search
8 // history, and search suggestions. An instance of it gets created and 8 // history, and search suggestions. An instance of it gets created and
9 // managed by the autocomplete controller. 9 // managed by the autocomplete controller.
10 10
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 // if suggested relevances cause undesirable behavior. Updates |done_|. 194 // if suggested relevances cause undesirable behavior. Updates |done_|.
195 void UpdateMatches(); 195 void UpdateMatches();
196 196
197 // Called when timer_ expires. 197 // Called when timer_ expires.
198 void Run(); 198 void Run();
199 199
200 // Runs the history query, if necessary. The history query is synchronous. 200 // Runs the history query, if necessary. The history query is synchronous.
201 // This does not update |done_|. 201 // This does not update |done_|.
202 void DoHistoryQuery(bool minimal_changes); 202 void DoHistoryQuery(bool minimal_changes);
203 203
204 // Returns the time to delay before sending the Suggest request.
205 base::TimeDelta GetSuggestQueryDelay() const;
206
204 // Determines whether an asynchronous subcomponent query should run for the 207 // Determines whether an asynchronous subcomponent query should run for the
205 // current input. If so, starts it if necessary; otherwise stops it. 208 // current input. If so, starts it if necessary; otherwise stops it.
206 // NOTE: This function does not update |done_|. Callers must do so. 209 // NOTE: This function does not update |done_|. Callers must do so.
207 void StartOrStopSuggestQuery(bool minimal_changes); 210 void StartOrStopSuggestQuery(bool minimal_changes);
208 211
209 // Returns true when the current query can be sent to the Suggest service. 212 // Returns true when the current query can be sent to the Suggest service.
210 // This will be false e.g. when Suggest is disabled, the query contains 213 // This will be false e.g. when Suggest is disabled, the query contains
211 // potentially private data, etc. 214 // potentially private data, etc.
212 bool IsQuerySuitableForSuggest() const; 215 bool IsQuerySuitableForSuggest() const;
213 216
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 337
335 // Obtains a session token, regenerating if necessary. 338 // Obtains a session token, regenerating if necessary.
336 std::string GetSessionToken(); 339 std::string GetSessionToken();
337 340
338 // Answers prefetch handling - finds the previously displayed answer matching 341 // Answers prefetch handling - finds the previously displayed answer matching
339 // the current top-scoring history result. If there is a previous answer, 342 // the current top-scoring history result. If there is a previous answer,
340 // returns the query data associated with it. Otherwise, returns an empty 343 // returns the query data associated with it. Otherwise, returns an empty
341 // AnswersQueryData. 344 // AnswersQueryData.
342 AnswersQueryData FindAnswersPrefetchData(); 345 AnswersQueryData FindAnswersPrefetchData();
343 346
344 // The amount of time to wait before sending a new suggest request after the
345 // previous one. Non-const because some unittests modify this value.
346 static int kMinimumTimeBetweenSuggestQueriesMs;
347
348 AutocompleteProviderListener* listener_; 347 AutocompleteProviderListener* listener_;
349 348
350 // The number of suggest results that haven't yet arrived. If it's greater 349 // The number of suggest results that haven't yet arrived. If it's greater
351 // than 0, it indicates that one of the URLFetchers is still running. 350 // than 0, it indicates that one of the URLFetchers is still running.
352 int suggest_results_pending_; 351 int suggest_results_pending_;
353 352
354 // Maintains the TemplateURLs used. 353 // Maintains the TemplateURLs used.
355 Providers providers_; 354 Providers providers_;
356 355
357 // The user's input. 356 // The user's input.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 base::TimeTicks token_expiration_time_; 395 base::TimeTicks token_expiration_time_;
397 396
398 // Answers prefetch management. 397 // Answers prefetch management.
399 AnswersCache answers_cache_; // Cache for last answers seen. 398 AnswersCache answers_cache_; // Cache for last answers seen.
400 AnswersQueryData prefetch_data_; // Data to use for query prefetching. 399 AnswersQueryData prefetch_data_; // Data to use for query prefetching.
401 400
402 DISALLOW_COPY_AND_ASSIGN(SearchProvider); 401 DISALLOW_COPY_AND_ASSIGN(SearchProvider);
403 }; 402 };
404 403
405 #endif // COMPONENTS_OMNIBOX_SEARCH_PROVIDER_H_ 404 #endif // COMPONENTS_OMNIBOX_SEARCH_PROVIDER_H_
OLDNEW
« no previous file with comments | « components/omnibox/omnibox_field_trial_unittest.cc ('k') | components/omnibox/search_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698