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

Side by Side Diff: chrome/browser/ui/app_list/search/common/webservice_search_provider.h

Issue 23874015: Implement people search. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_COMMON_WEBSERVICE_SEARCH_PROVIDER_H_
6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_COMMON_WEBSERVICE_SEARCH_PROVIDER_H_
7
8 #include "base/callback_forward.h"
9 #include "base/strings/string16.h"
10 #include "base/time/time.h"
11 #include "base/timer/timer.h"
12 #include "chrome/browser/ui/app_list/search/search_provider.h"
13
14 class Profile;
15
16 namespace app_list {
17
18 // Helper class for webservice based searches.
19 class WebserviceSearchProvider : public SearchProvider {
20 public:
21 explicit WebserviceSearchProvider(Profile* profile);
22 virtual ~WebserviceSearchProvider();
23
24 // Validate the query for privacy and size.
25 bool IsValidQuery(const string16& query);
26
27 // Start a query with throttling enabled.
28 void StartThrottledQuery(const base::Closure& start_query);
29
30 void set_use_throttling(bool use) { use_throttling_ = use; }
31
32 protected:
33 Profile* profile_;
34
35 private:
36 bool IsSensitiveInput(const string16& query);
37
38 // The timestamp when the last key event happened.
39 base::Time last_keytyped_;
40
41 // The timer to throttle QPS.
42 base::OneShotTimer<WebserviceSearchProvider> query_throttler_;
43
44 // The flag for tests. It prevents the throttling If set to false.
45 bool use_throttling_;
46
47 DISALLOW_COPY_AND_ASSIGN(WebserviceSearchProvider);
48 };
49
50 } // namespace app_list
51
52 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_COMMON_WEBSERVICE_SEARCH_PROVIDER_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698