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 | |
35 namespace app_list { | 31 namespace app_list { |
36 | 32 |
37 namespace { | 33 namespace { |
38 | 34 |
39 // Maximum number of results to show in each mixer group. | 35 // Maximum number of results to show in each mixer group. |
40 constexpr size_t kMaxAppsGroupResults = 8; | 36 constexpr size_t kMaxAppsGroupResults = 8; |
41 constexpr size_t kMaxOmniboxResults = 4; | 37 constexpr size_t kMaxOmniboxResults = 4; |
42 constexpr size_t kMaxWebstoreResults = 2; | 38 constexpr size_t kMaxWebstoreResults = 2; |
43 constexpr size_t kMaxSuggestionsResults = 6; | 39 constexpr size_t kMaxSuggestionsResults = 6; |
44 constexpr size_t kMaxLauncherSearchResults = 2; | 40 constexpr size_t kMaxLauncherSearchResults = 2; |
45 #if defined(OS_CHROMEOS) | |
46 constexpr size_t kMaxPlayStoreResults = 2; | |
47 #endif | |
48 | 41 |
49 // Constants related to the SuggestionsService in AppList field trial. | 42 // Constants related to the SuggestionsService in AppList field trial. |
50 constexpr char kSuggestionsProviderFieldTrialName[] = | 43 constexpr char kSuggestionsProviderFieldTrialName[] = |
51 "SuggestionsAppListProvider"; | 44 "SuggestionsAppListProvider"; |
52 constexpr char kSuggestionsProviderFieldTrialEnabledPrefix[] = "Enabled"; | 45 constexpr char kSuggestionsProviderFieldTrialEnabledPrefix[] = "Enabled"; |
53 | 46 |
54 // Returns whether the user is part of a group where the Suggestions provider is | 47 // Returns whether the user is part of a group where the Suggestions provider is |
55 // enabled. | 48 // enabled. |
56 bool IsSuggestionsSearchProviderEnabled() { | 49 bool IsSuggestionsSearchProviderEnabled() { |
57 return base::StartsWith( | 50 return base::StartsWith( |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 // LauncherSearchProvider is added only when flag is enabled, not in guest | 106 // LauncherSearchProvider is added only when flag is enabled, not in guest |
114 // session and running on Chrome OS. | 107 // session and running on Chrome OS. |
115 if (app_list::switches::IsDriveSearchInChromeLauncherEnabled() && | 108 if (app_list::switches::IsDriveSearchInChromeLauncherEnabled() && |
116 !profile->IsGuestSession()) { | 109 !profile->IsGuestSession()) { |
117 size_t search_api_group_id = | 110 size_t search_api_group_id = |
118 controller->AddGroup(kMaxLauncherSearchResults, 1.0); | 111 controller->AddGroup(kMaxLauncherSearchResults, 1.0); |
119 controller->AddProvider(search_api_group_id, | 112 controller->AddProvider(search_api_group_id, |
120 base::MakeUnique<LauncherSearchProvider>(profile)); | 113 base::MakeUnique<LauncherSearchProvider>(profile)); |
121 } | 114 } |
122 | 115 |
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 | |
130 return controller; | 116 return controller; |
131 } | 117 } |
132 | 118 |
133 } // namespace app_list | 119 } // namespace app_list |
OLD | NEW |