OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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_APP_SEARCH_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_APP_SEARCH_PROVIDER_H_ |
6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_APP_SEARCH_PROVIDER_H_ | 6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_APP_SEARCH_PROVIDER_H_ |
7 | 7 |
| 8 #include <memory> |
8 #include <vector> | 9 #include <vector> |
9 | 10 |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/scoped_observer.h" | 13 #include "base/scoped_observer.h" |
14 #include "ui/app_list/search_provider.h" | 14 #include "ui/app_list/search_provider.h" |
15 | 15 |
16 class AppListControllerDelegate; | 16 class AppListControllerDelegate; |
17 class Profile; | 17 class Profile; |
18 | 18 |
19 namespace base { | 19 namespace base { |
20 class Clock; | 20 class Clock; |
21 } | 21 } |
22 | 22 |
23 namespace app_list { | 23 namespace app_list { |
24 | 24 |
25 class AppListItemList; | 25 class AppListItemList; |
26 | 26 |
27 namespace test { | 27 namespace test { |
28 class AppSearchProviderTest; | 28 class AppSearchProviderTest; |
29 } | 29 } |
30 | 30 |
31 class AppSearchProvider : public SearchProvider { | 31 class AppSearchProvider : public SearchProvider { |
32 public: | 32 public: |
33 class App; | 33 class App; |
34 class DataSource; | 34 class DataSource; |
35 typedef std::vector<scoped_ptr<App>> Apps; | 35 typedef std::vector<std::unique_ptr<App>> Apps; |
36 | 36 |
37 AppSearchProvider(Profile* profile, | 37 AppSearchProvider(Profile* profile, |
38 AppListControllerDelegate* list_controller, | 38 AppListControllerDelegate* list_controller, |
39 scoped_ptr<base::Clock> clock, | 39 std::unique_ptr<base::Clock> clock, |
40 AppListItemList* top_level_item_list); | 40 AppListItemList* top_level_item_list); |
41 ~AppSearchProvider() override; | 41 ~AppSearchProvider() override; |
42 | 42 |
43 // SearchProvider overrides: | 43 // SearchProvider overrides: |
44 void Start(bool is_voice_query, const base::string16& query) override; | 44 void Start(bool is_voice_query, const base::string16& query) override; |
45 void Stop() override; | 45 void Stop() override; |
46 | 46 |
47 // Refresh indexed app data and update search results. When |force_inline| is | 47 // Refresh indexed app data and update search results. When |force_inline| is |
48 // set to true, search results is updated before returning from the function. | 48 // set to true, search results is updated before returning from the function. |
49 // Otherwise, search results would be grouped, i.e. multiple calls would only | 49 // Otherwise, search results would be grouped, i.e. multiple calls would only |
50 // update search results once. | 50 // update search results once. |
51 void RefreshAppsAndUpdateResults(bool force_inline); | 51 void RefreshAppsAndUpdateResults(bool force_inline); |
52 | 52 |
53 private: | 53 private: |
54 void RefreshApps(); | 54 void RefreshApps(); |
55 void UpdateResults(); | 55 void UpdateResults(); |
56 | 56 |
57 Profile* profile_; | 57 Profile* profile_; |
58 AppListControllerDelegate* list_controller_; | 58 AppListControllerDelegate* list_controller_; |
59 base::string16 query_; | 59 base::string16 query_; |
60 Apps apps_; | 60 Apps apps_; |
61 AppListItemList* top_level_item_list_; | 61 AppListItemList* top_level_item_list_; |
62 scoped_ptr<base::Clock> clock_; | 62 std::unique_ptr<base::Clock> clock_; |
63 std::vector<scoped_ptr<DataSource>> data_sources_; | 63 std::vector<std::unique_ptr<DataSource>> data_sources_; |
64 base::WeakPtrFactory<AppSearchProvider> update_results_factory_; | 64 base::WeakPtrFactory<AppSearchProvider> update_results_factory_; |
65 | 65 |
66 DISALLOW_COPY_AND_ASSIGN(AppSearchProvider); | 66 DISALLOW_COPY_AND_ASSIGN(AppSearchProvider); |
67 }; | 67 }; |
68 | 68 |
69 } // namespace app_list | 69 } // namespace app_list |
70 | 70 |
71 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_APP_SEARCH_PROVIDER_H_ | 71 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_APP_SEARCH_PROVIDER_H_ |
OLD | NEW |