Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Unified Diff: chrome/browser/ui/app_list/search/search_controller_factory.cc

Issue 775893005: [AppList] Add a Suggestions Provider to applist. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test fix Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/app_list/search/search_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/app_list/search/search_controller_factory.cc
diff --git a/chrome/browser/ui/app_list/search/search_controller_factory.cc b/chrome/browser/ui/app_list/search/search_controller_factory.cc
index c9fa326c42f51d6308719b52ccc5f583eeb0c574..98a8cc2b90a6de5a02480e069006ed1d9984b1d2 100644
--- a/chrome/browser/ui/app_list/search/search_controller_factory.cc
+++ b/chrome/browser/ui/app_list/search/search_controller_factory.cc
@@ -5,11 +5,14 @@
#include "chrome/browser/ui/app_list/search/search_controller_factory.h"
#include "base/command_line.h"
+#include "base/metrics/field_trial.h"
+#include "base/strings/string_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/app_list/search/app_search_provider.h"
#include "chrome/browser/ui/app_list/search/history_factory.h"
#include "chrome/browser/ui/app_list/search/omnibox_provider.h"
#include "chrome/browser/ui/app_list/search/people/people_provider.h"
+#include "chrome/browser/ui/app_list/search/suggestions/suggestions_search_provider.h"
#include "chrome/browser/ui/app_list/search/webstore/webstore_provider.h"
#include "chrome/common/chrome_switches.h"
#include "ui/app_list/search/mixer.h"
@@ -17,6 +20,22 @@
namespace app_list {
+namespace {
+
+// Constants related to the SuggestionsService in AppList field trial.
+const char kSuggestionsProviderFieldTrialName[] = "SuggestionsAppListProvider";
+const char kSuggestionsProviderFieldTrialEnabledPrefix[] = "Enabled";
+
+// Returns whether the user is part of a group where the Suggestions provider is
+// enabled.
+bool IsSuggestionsSearchProviderEnabled() {
+ return StartsWithASCII(
+ base::FieldTrialList::FindFullName(kSuggestionsProviderFieldTrialName),
+ kSuggestionsProviderFieldTrialEnabledPrefix, true);
+}
+
+} // namespace
+
scoped_ptr<SearchController> CreateSearchController(
Profile* profile,
SearchBoxModel* search_box,
@@ -40,6 +59,12 @@ scoped_ptr<SearchController> CreateSearchController(
scoped_ptr<SearchProvider>(
new PeopleProvider(profile, list_controller)));
}
+ if (IsSuggestionsSearchProviderEnabled()) {
+ controller->AddProvider(
+ Mixer::SUGGESTIONS_GROUP,
+ scoped_ptr<SearchProvider>(
+ new SuggestionsSearchProvider(profile, list_controller)));
+ }
return controller.Pass();
}
« no previous file with comments | « no previous file | chrome/browser/ui/app_list/search/search_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698