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/answer_card_search_provi der.h" | 16 #include "chrome/browser/ui/app_list/search/answer_card/answer_card_search_provi der.h" |
17 #include "chrome/browser/ui/app_list/search/answer_card/answer_card_web_contents .h" | 17 #include "chrome/browser/ui/app_list/search/answer_card/answer_card_web_contents .h" |
18 #include "chrome/browser/ui/app_list/search/app_search_provider.h" | 18 #include "chrome/browser/ui/app_list/search/app_search_provider.h" |
19 #include "chrome/browser/ui/app_list/search/arc/arc_playstore_search_provider.h" | |
19 #include "chrome/browser/ui/app_list/search/history_factory.h" | 20 #include "chrome/browser/ui/app_list/search/history_factory.h" |
20 #include "chrome/browser/ui/app_list/search/launcher_search/launcher_search_prov ider.h" | 21 #include "chrome/browser/ui/app_list/search/launcher_search/launcher_search_prov ider.h" |
21 #include "chrome/browser/ui/app_list/search/omnibox_provider.h" | 22 #include "chrome/browser/ui/app_list/search/omnibox_provider.h" |
22 #include "chrome/browser/ui/app_list/search/suggestions/suggestions_search_provi der.h" | 23 #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" | 24 #include "chrome/browser/ui/app_list/search/webstore/webstore_provider.h" |
24 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
25 #include "ui/app_list/app_list_features.h" | 26 #include "ui/app_list/app_list_features.h" |
26 #include "ui/app_list/app_list_model.h" | 27 #include "ui/app_list/app_list_model.h" |
27 #include "ui/app_list/app_list_switches.h" | 28 #include "ui/app_list/app_list_switches.h" |
28 #include "ui/app_list/search/mixer.h" | 29 #include "ui/app_list/search/mixer.h" |
29 #include "ui/app_list/search_controller.h" | 30 #include "ui/app_list/search_controller.h" |
30 | 31 |
31 namespace app_list { | 32 namespace app_list { |
32 | 33 |
33 namespace { | 34 namespace { |
34 | 35 |
35 // Maximum number of results to show in each mixer group. | 36 // Maximum number of results to show in each mixer group. |
36 constexpr size_t kMaxAppsGroupResults = 8; | 37 constexpr size_t kMaxAppsGroupResults = 8; |
37 constexpr size_t kMaxOmniboxResults = 4; | 38 constexpr size_t kMaxOmniboxResults = 4; |
39 constexpr size_t kMaxPlayStoreResults = 2; | |
38 constexpr size_t kMaxWebstoreResults = 2; | 40 constexpr size_t kMaxWebstoreResults = 2; |
39 constexpr size_t kMaxSuggestionsResults = 6; | 41 constexpr size_t kMaxSuggestionsResults = 6; |
40 constexpr size_t kMaxLauncherSearchResults = 2; | 42 constexpr size_t kMaxLauncherSearchResults = 2; |
41 | 43 |
42 // Constants related to the SuggestionsService in AppList field trial. | 44 // Constants related to the SuggestionsService in AppList field trial. |
43 constexpr char kSuggestionsProviderFieldTrialName[] = | 45 constexpr char kSuggestionsProviderFieldTrialName[] = |
44 "SuggestionsAppListProvider"; | 46 "SuggestionsAppListProvider"; |
45 constexpr char kSuggestionsProviderFieldTrialEnabledPrefix[] = "Enabled"; | 47 constexpr char kSuggestionsProviderFieldTrialEnabledPrefix[] = "Enabled"; |
46 | 48 |
47 // Returns whether the user is part of a group where the Suggestions provider is | 49 // Returns whether the user is part of a group where the Suggestions provider is |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
106 // LauncherSearchProvider is added only when flag is enabled, not in guest | 108 // LauncherSearchProvider is added only when flag is enabled, not in guest |
107 // session and running on Chrome OS. | 109 // session and running on Chrome OS. |
108 if (app_list::switches::IsDriveSearchInChromeLauncherEnabled() && | 110 if (app_list::switches::IsDriveSearchInChromeLauncherEnabled() && |
109 !profile->IsGuestSession()) { | 111 !profile->IsGuestSession()) { |
110 size_t search_api_group_id = | 112 size_t search_api_group_id = |
111 controller->AddGroup(kMaxLauncherSearchResults, 1.0); | 113 controller->AddGroup(kMaxLauncherSearchResults, 1.0); |
112 controller->AddProvider(search_api_group_id, | 114 controller->AddProvider(search_api_group_id, |
113 base::MakeUnique<LauncherSearchProvider>(profile)); | 115 base::MakeUnique<LauncherSearchProvider>(profile)); |
114 } | 116 } |
115 | 117 |
118 #if defined(OS_CHROMEOS) | |
xiyuan
2017/06/23 19:57:39
Is this necessary? If it is, we need to put header
Jiaquan He
2017/06/23 21:10:32
Done.
| |
119 size_t playstore_api_group_id = | |
120 controller->AddGroup(kMaxPlayStoreResults, 1.0); | |
121 controller->AddProvider(playstore_api_group_id, | |
122 base::MakeUnique<ArcPlayStoreSearchProvider>( | |
123 kMaxPlayStoreResults, profile, list_controller)); | |
124 #endif | |
116 return controller; | 125 return controller; |
117 } | 126 } |
118 | 127 |
119 } // namespace app_list | 128 } // namespace app_list |
OLD | NEW |