OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/search/hotword_service_factory.h" | 5 #include "chrome/browser/search/hotword_service_factory.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/search/hotword_service.h" | 10 #include "chrome/browser/search/hotword_service.h" |
11 #include "chrome/common/chrome_switches.h" | 11 #include "chrome/common/chrome_switches.h" |
12 #include "chrome/common/pref_names.h" | 12 #include "chrome/common/pref_names.h" |
13 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 13 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
14 #include "components/pref_registry/pref_registry_syncable.h" | 14 #include "components/pref_registry/pref_registry_syncable.h" |
15 #include "content/public/browser/browser_context.h" | 15 #include "content/public/browser/browser_context.h" |
16 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
17 | 17 |
18 using content::BrowserContext; | 18 using content::BrowserContext; |
19 using content::BrowserThread; | 19 using content::BrowserThread; |
20 | 20 |
21 // static | 21 // static |
22 HotwordService* HotwordServiceFactory::GetForProfile(BrowserContext* context) { | 22 HotwordService* HotwordServiceFactory::GetForProfile(BrowserContext* context) { |
23 return static_cast<HotwordService*>( | 23 return static_cast<HotwordService*>( |
24 GetInstance()->GetServiceForBrowserContext(context, true)); | 24 GetInstance()->GetServiceForBrowserContext(context, true)); |
25 } | 25 } |
26 | 26 |
27 // static | 27 // static |
28 HotwordServiceFactory* HotwordServiceFactory::GetInstance() { | 28 HotwordServiceFactory* HotwordServiceFactory::GetInstance() { |
29 return Singleton<HotwordServiceFactory>::get(); | 29 return base::Singleton<HotwordServiceFactory>::get(); |
30 } | 30 } |
31 | 31 |
32 // static | 32 // static |
33 bool HotwordServiceFactory::IsServiceAvailable(BrowserContext* context) { | 33 bool HotwordServiceFactory::IsServiceAvailable(BrowserContext* context) { |
34 HotwordService* hotword_service = GetForProfile(context); | 34 HotwordService* hotword_service = GetForProfile(context); |
35 return hotword_service && hotword_service->IsServiceAvailable(); | 35 return hotword_service && hotword_service->IsServiceAvailable(); |
36 } | 36 } |
37 | 37 |
38 // static | 38 // static |
39 bool HotwordServiceFactory::IsHotwordAllowed(BrowserContext* context) { | 39 bool HotwordServiceFactory::IsHotwordAllowed(BrowserContext* context) { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 // Per-device settings (do not sync). | 86 // Per-device settings (do not sync). |
87 prefs->RegisterBooleanPref(prefs::kHotwordSearchEnabled, false); | 87 prefs->RegisterBooleanPref(prefs::kHotwordSearchEnabled, false); |
88 prefs->RegisterBooleanPref(prefs::kHotwordAlwaysOnSearchEnabled, false); | 88 prefs->RegisterBooleanPref(prefs::kHotwordAlwaysOnSearchEnabled, false); |
89 prefs->RegisterBooleanPref(prefs::kHotwordAlwaysOnNotificationSeen, false); | 89 prefs->RegisterBooleanPref(prefs::kHotwordAlwaysOnNotificationSeen, false); |
90 } | 90 } |
91 | 91 |
92 KeyedService* HotwordServiceFactory::BuildServiceInstanceFor( | 92 KeyedService* HotwordServiceFactory::BuildServiceInstanceFor( |
93 BrowserContext* context) const { | 93 BrowserContext* context) const { |
94 return new HotwordService(Profile::FromBrowserContext(context)); | 94 return new HotwordService(Profile::FromBrowserContext(context)); |
95 } | 95 } |
OLD | NEW |