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" |
11 #include "base/metrics/field_trial.h" | 11 #include "base/metrics/field_trial.h" |
12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
13 #include "base/time/default_clock.h" | 13 #include "base/time/default_clock.h" |
14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
16 #include "chrome/browser/ui/app_list/search/answer_card_search_provider.h" | 16 #include "chrome/browser/ui/app_list/search/answer_card_search_provider.h" |
17 #include "chrome/browser/ui/app_list/search/app_search_provider.h" | 17 #include "chrome/browser/ui/app_list/search/app_search_provider.h" |
18 #include "chrome/browser/ui/app_list/search/history_factory.h" | 18 #include "chrome/browser/ui/app_list/search/history_factory.h" |
19 #include "chrome/browser/ui/app_list/search/launcher_search/launcher_search_prov ider.h" | 19 #include "chrome/browser/ui/app_list/search/launcher_search/launcher_search_prov ider.h" |
20 #include "chrome/browser/ui/app_list/search/omnibox_provider.h" | 20 #include "chrome/browser/ui/app_list/search/omnibox_provider.h" |
21 #include "chrome/browser/ui/app_list/search/playstore/playstore_search_provider. h" | |
21 #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" |
22 #include "chrome/browser/ui/app_list/search/webstore/webstore_provider.h" | 23 #include "chrome/browser/ui/app_list/search/webstore/webstore_provider.h" |
23 #include "chrome/common/chrome_switches.h" | 24 #include "chrome/common/chrome_switches.h" |
24 #include "ui/app_list/app_list_features.h" | 25 #include "ui/app_list/app_list_features.h" |
25 #include "ui/app_list/app_list_model.h" | 26 #include "ui/app_list/app_list_model.h" |
26 #include "ui/app_list/app_list_switches.h" | 27 #include "ui/app_list/app_list_switches.h" |
27 #include "ui/app_list/search/mixer.h" | 28 #include "ui/app_list/search/mixer.h" |
28 #include "ui/app_list/search_controller.h" | 29 #include "ui/app_list/search_controller.h" |
29 | 30 |
30 namespace app_list { | 31 namespace app_list { |
31 | 32 |
32 namespace { | 33 namespace { |
33 | 34 |
34 // Maximum number of results to show in each mixer group. | 35 // Maximum number of results to show in each mixer group. |
35 constexpr size_t kMaxAppsGroupResults = 8; | 36 constexpr size_t kMaxAppsGroupResults = 8; |
36 constexpr size_t kMaxOmniboxResults = 4; | 37 constexpr size_t kMaxOmniboxResults = 4; |
38 constexpr size_t kMaxPlaystoreResults = 2; | |
Luis Héctor Chávez
2017/06/16 22:24:35
nit: kMaxPlayStoreResults
Jiaquan He
2017/06/22 04:30:04
Done.
| |
37 constexpr size_t kMaxWebstoreResults = 2; | 39 constexpr size_t kMaxWebstoreResults = 2; |
38 constexpr size_t kMaxSuggestionsResults = 6; | 40 constexpr size_t kMaxSuggestionsResults = 6; |
39 constexpr size_t kMaxLauncherSearchResults = 2; | 41 constexpr size_t kMaxLauncherSearchResults = 2; |
40 | 42 |
41 // Constants related to the SuggestionsService in AppList field trial. | 43 // Constants related to the SuggestionsService in AppList field trial. |
42 constexpr char kSuggestionsProviderFieldTrialName[] = | 44 constexpr char kSuggestionsProviderFieldTrialName[] = |
43 "SuggestionsAppListProvider"; | 45 "SuggestionsAppListProvider"; |
44 constexpr char kSuggestionsProviderFieldTrialEnabledPrefix[] = "Enabled"; | 46 constexpr char kSuggestionsProviderFieldTrialEnabledPrefix[] = "Enabled"; |
45 | 47 |
46 // Returns whether the user is part of a group where the Suggestions provider is | 48 // Returns whether the user is part of a group where the Suggestions provider is |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 | 104 |
103 // LauncherSearchProvider is added only when flag is enabled, not in guest | 105 // LauncherSearchProvider is added only when flag is enabled, not in guest |
104 // session and running on Chrome OS. | 106 // session and running on Chrome OS. |
105 if (app_list::switches::IsDriveSearchInChromeLauncherEnabled() && | 107 if (app_list::switches::IsDriveSearchInChromeLauncherEnabled() && |
106 !profile->IsGuestSession()) { | 108 !profile->IsGuestSession()) { |
107 size_t search_api_group_id = | 109 size_t search_api_group_id = |
108 controller->AddGroup(kMaxLauncherSearchResults, 1.0); | 110 controller->AddGroup(kMaxLauncherSearchResults, 1.0); |
109 controller->AddProvider(search_api_group_id, | 111 controller->AddProvider(search_api_group_id, |
110 base::MakeUnique<LauncherSearchProvider>(profile)); | 112 base::MakeUnique<LauncherSearchProvider>(profile)); |
111 } | 113 } |
114 // TODO: these params are arbitrary | |
115 size_t playstore_api_group_id = | |
116 controller->AddGroup(kMaxPlaystoreResults, 1.0); | |
117 controller->AddProvider( | |
118 playstore_api_group_id, | |
119 base::MakeUnique<PlaystoreSearchProvider>(kMaxPlaystoreResults)); | |
112 | 120 |
113 return controller; | 121 return controller; |
114 } | 122 } |
115 | 123 |
116 } // namespace app_list | 124 } // namespace app_list |
OLD | NEW |