OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CHROME_BROWSER_UI_APP_LIST_SEARCH_LAUNCHER_SEARCH_LAUNCHER_SEARCH_PROVID
ER_H_ | 5 #ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_LAUNCHER_SEARCH_LAUNCHER_SEARCH_PROVID
ER_H_ |
6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_LAUNCHER_SEARCH_LAUNCHER_SEARCH_PROVID
ER_H_ | 6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_LAUNCHER_SEARCH_LAUNCHER_SEARCH_PROVID
ER_H_ |
7 | 7 |
| 8 #include "base/containers/scoped_ptr_map.h" |
| 9 #include "base/memory/scoped_ptr.h" |
8 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
9 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
10 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
11 #include "base/time/time.h" | 13 #include "base/time/time.h" |
12 #include "base/timer/timer.h" | 14 #include "base/timer/timer.h" |
13 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/ui/app_list/search/launcher_search/launcher_search_resu
lt.h" | 16 #include "chrome/browser/ui/app_list/search/launcher_search/launcher_search_resu
lt.h" |
15 #include "extensions/common/extension.h" | 17 #include "extensions/common/extension.h" |
16 #include "ui/app_list/search_provider.h" | 18 #include "ui/app_list/search_provider.h" |
17 | 19 |
(...skipping 12 matching lines...) Expand all Loading... |
30 ScopedVector<LauncherSearchResult> extension_results); | 32 ScopedVector<LauncherSearchResult> extension_results); |
31 | 33 |
32 private: | 34 private: |
33 // Delays query for |kLauncherSearchProviderQueryDelayInMs|. This dispatches | 35 // Delays query for |kLauncherSearchProviderQueryDelayInMs|. This dispatches |
34 // the latest query after no more calls to Start() for the delay duration. | 36 // the latest query after no more calls to Start() for the delay duration. |
35 void DelayQuery(const base::Closure& closure); | 37 void DelayQuery(const base::Closure& closure); |
36 | 38 |
37 // Dispatches |query| to LauncherSearchProvider service. | 39 // Dispatches |query| to LauncherSearchProvider service. |
38 void StartInternal(const base::string16& query); | 40 void StartInternal(const base::string16& query); |
39 | 41 |
40 // The search results of each extension. The STLValueDeleter will | 42 // The search results of each extension. |
41 // automatically free the vectors in this map, but elements that are | 43 base::ScopedPtrMap<extensions::ExtensionId, |
42 // individually erased or replaced must be manually deleted. | 44 scoped_ptr<ScopedVector<LauncherSearchResult>>> |
43 typedef std::map<extensions::ExtensionId, ScopedVector<LauncherSearchResult>*> | 45 extension_results_; |
44 ExtensionResults; | |
45 ExtensionResults extension_results_; | |
46 STLValueDeleter<ExtensionResults> extension_results_deleter_; | |
47 | 46 |
48 // A timer to delay query. | 47 // A timer to delay query. |
49 base::OneShotTimer<LauncherSearchProvider> query_timer_; | 48 base::OneShotTimer<LauncherSearchProvider> query_timer_; |
50 | 49 |
51 // The timestamp of the last query. | 50 // The timestamp of the last query. |
52 base::Time last_query_time_; | 51 base::Time last_query_time_; |
53 | 52 |
54 // The reference to profile to get LauncherSearchProvider service. | 53 // The reference to profile to get LauncherSearchProvider service. |
55 Profile* profile_; | 54 Profile* profile_; |
56 | 55 |
57 base::WeakPtrFactory<LauncherSearchProvider> weak_ptr_factory_; | 56 base::WeakPtrFactory<LauncherSearchProvider> weak_ptr_factory_; |
58 | 57 |
59 DISALLOW_COPY_AND_ASSIGN(LauncherSearchProvider); | 58 DISALLOW_COPY_AND_ASSIGN(LauncherSearchProvider); |
60 }; | 59 }; |
61 | 60 |
62 } // namespace app_list | 61 } // namespace app_list |
63 | 62 |
64 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_LAUNCHER_SEARCH_LAUNCHER_SEARCH_PRO
VIDER_H_ | 63 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_LAUNCHER_SEARCH_LAUNCHER_SEARCH_PRO
VIDER_H_ |
OLD | NEW |