OLD | NEW |
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 #include "chrome/browser/ui/app_list/search/search_controller_factory.h" | 5 #include "chrome/browser/ui/app_list/search/search_controller_factory.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "chrome/browser/ui/app_list/search/omnibox_provider.h" | 21 #include "chrome/browser/ui/app_list/search/omnibox_provider.h" |
22 #include "chrome/browser/ui/app_list/search/suggestions/suggestions_search_provi
der.h" | 22 #include "chrome/browser/ui/app_list/search/suggestions/suggestions_search_provi
der.h" |
23 #include "chrome/browser/ui/app_list/search/webstore/webstore_provider.h" | 23 #include "chrome/browser/ui/app_list/search/webstore/webstore_provider.h" |
24 #include "chrome/common/chrome_switches.h" | 24 #include "chrome/common/chrome_switches.h" |
25 #include "ui/app_list/app_list_features.h" | 25 #include "ui/app_list/app_list_features.h" |
26 #include "ui/app_list/app_list_model.h" | 26 #include "ui/app_list/app_list_model.h" |
27 #include "ui/app_list/app_list_switches.h" | 27 #include "ui/app_list/app_list_switches.h" |
28 #include "ui/app_list/search/mixer.h" | 28 #include "ui/app_list/search/mixer.h" |
29 #include "ui/app_list/search_controller.h" | 29 #include "ui/app_list/search_controller.h" |
30 | 30 |
| 31 #if defined(OS_CHROMEOS) |
| 32 #include "chrome/browser/ui/app_list/search/arc/arc_playstore_search_provider.h" |
| 33 #endif |
| 34 |
31 namespace app_list { | 35 namespace app_list { |
32 | 36 |
33 namespace { | 37 namespace { |
34 | 38 |
35 // Maximum number of results to show in each mixer group. | 39 // Maximum number of results to show in each mixer group. |
36 constexpr size_t kMaxAppsGroupResults = 8; | 40 constexpr size_t kMaxAppsGroupResults = 8; |
37 constexpr size_t kMaxOmniboxResults = 4; | 41 constexpr size_t kMaxOmniboxResults = 4; |
38 constexpr size_t kMaxWebstoreResults = 2; | 42 constexpr size_t kMaxWebstoreResults = 2; |
39 constexpr size_t kMaxSuggestionsResults = 6; | 43 constexpr size_t kMaxSuggestionsResults = 6; |
40 constexpr size_t kMaxLauncherSearchResults = 2; | 44 constexpr size_t kMaxLauncherSearchResults = 2; |
| 45 #if defined(OS_CHROMEOS) |
| 46 constexpr size_t kMaxPlayStoreResults = 2; |
| 47 #endif |
41 | 48 |
42 // Constants related to the SuggestionsService in AppList field trial. | 49 // Constants related to the SuggestionsService in AppList field trial. |
43 constexpr char kSuggestionsProviderFieldTrialName[] = | 50 constexpr char kSuggestionsProviderFieldTrialName[] = |
44 "SuggestionsAppListProvider"; | 51 "SuggestionsAppListProvider"; |
45 constexpr char kSuggestionsProviderFieldTrialEnabledPrefix[] = "Enabled"; | 52 constexpr char kSuggestionsProviderFieldTrialEnabledPrefix[] = "Enabled"; |
46 | 53 |
47 // Returns whether the user is part of a group where the Suggestions provider is | 54 // Returns whether the user is part of a group where the Suggestions provider is |
48 // enabled. | 55 // enabled. |
49 bool IsSuggestionsSearchProviderEnabled() { | 56 bool IsSuggestionsSearchProviderEnabled() { |
50 return base::StartsWith( | 57 return base::StartsWith( |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // LauncherSearchProvider is added only when flag is enabled, not in guest | 113 // LauncherSearchProvider is added only when flag is enabled, not in guest |
107 // session and running on Chrome OS. | 114 // session and running on Chrome OS. |
108 if (app_list::switches::IsDriveSearchInChromeLauncherEnabled() && | 115 if (app_list::switches::IsDriveSearchInChromeLauncherEnabled() && |
109 !profile->IsGuestSession()) { | 116 !profile->IsGuestSession()) { |
110 size_t search_api_group_id = | 117 size_t search_api_group_id = |
111 controller->AddGroup(kMaxLauncherSearchResults, 1.0); | 118 controller->AddGroup(kMaxLauncherSearchResults, 1.0); |
112 controller->AddProvider(search_api_group_id, | 119 controller->AddProvider(search_api_group_id, |
113 base::MakeUnique<LauncherSearchProvider>(profile)); | 120 base::MakeUnique<LauncherSearchProvider>(profile)); |
114 } | 121 } |
115 | 122 |
| 123 #if defined(OS_CHROMEOS) |
| 124 size_t playstore_api_group_id = |
| 125 controller->AddGroup(kMaxPlayStoreResults, 1.0); |
| 126 controller->AddProvider(playstore_api_group_id, |
| 127 base::MakeUnique<ArcPlayStoreSearchProvider>( |
| 128 kMaxPlayStoreResults, profile, list_controller)); |
| 129 #endif |
116 return controller; | 130 return controller; |
117 } | 131 } |
118 | 132 |
119 } // namespace app_list | 133 } // namespace app_list |
OLD | NEW |