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

Unified Diff: chrome/browser/ui/app_list/start_page_service_factory.cc

Issue 158143002: Fine tuned availability of hotword plugin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 years, 10 months 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
Index: chrome/browser/ui/app_list/start_page_service_factory.cc
diff --git a/chrome/browser/ui/app_list/start_page_service_factory.cc b/chrome/browser/ui/app_list/start_page_service_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0e658664fe6f692600593f7331df56dac55f605d
--- /dev/null
+++ b/chrome/browser/ui/app_list/start_page_service_factory.cc
@@ -0,0 +1,63 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/app_list/start_page_service_factory.h"
+
+#include "base/command_line.h"
+#include "chrome/browser/extensions/extension_system_factory.h"
+#include "chrome/browser/extensions/install_tracker_factory.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/app_list/start_page_service.h"
+#include "chrome/common/chrome_switches.h"
+#include "chrome/common/pref_names.h"
+#include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
+#include "components/user_prefs/pref_registry_syncable.h"
+#include "ui/app_list/app_list_switches.h"
+
+namespace app_list {
+
+// static
+StartPageService* StartPageServiceFactory::GetForProfile(Profile* profile) {
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(
+ ::switches::kShowAppListStartPage) &&
+ !app_list::switches::IsVoiceSearchEnabled()) {
+ return NULL;
+ }
+
+ return static_cast<StartPageService*>(
+ GetInstance()->GetServiceForBrowserContext(profile, true));
+}
+
+// static
+StartPageServiceFactory* StartPageServiceFactory::GetInstance() {
+ return Singleton<StartPageServiceFactory>::get();
+}
+
+StartPageServiceFactory::StartPageServiceFactory()
+ : BrowserContextKeyedServiceFactory(
+ "AppListStartPageService",
+ BrowserContextDependencyManager::GetInstance()) {
+ DependsOn(extensions::ExtensionSystemFactory::GetInstance());
+ DependsOn(extensions::InstallTrackerFactory::GetInstance());
+}
+
+StartPageServiceFactory::~StartPageServiceFactory() {}
+
+BrowserContextKeyedService* StartPageServiceFactory::BuildServiceInstanceFor(
+ content::BrowserContext* context) const {
+ Profile* profile = static_cast<Profile*>(context);
+ return new StartPageService(profile);
+}
+
+void StartPageServiceFactory::RegisterProfilePrefs(
+ user_prefs::PrefRegistrySyncable* registry) {
+#if defined(OS_CHROMEOS)
+ registry->RegisterBooleanPref(
+ prefs::kHotwordAppListEnabled,
+ true,
+ user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
+#endif
+}
+
+} // namespace app_list
« no previous file with comments | « chrome/browser/ui/app_list/start_page_service_factory.h ('k') | chrome/browser/ui/webui/app_list/start_page_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698