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" |
(...skipping 29 matching lines...) Expand all Loading... |
40 } | 40 } |
41 | 41 |
42 // static | 42 // static |
43 bool HotwordServiceFactory::IsHotwordAllowed(BrowserContext* context) { | 43 bool HotwordServiceFactory::IsHotwordAllowed(BrowserContext* context) { |
44 HotwordService* hotword_service = GetForProfile(context); | 44 HotwordService* hotword_service = GetForProfile(context); |
45 return hotword_service && hotword_service->IsHotwordAllowed(); | 45 return hotword_service && hotword_service->IsHotwordAllowed(); |
46 } | 46 } |
47 | 47 |
48 // static | 48 // static |
49 bool HotwordServiceFactory::IsHotwordHardwareAvailable() { | 49 bool HotwordServiceFactory::IsHotwordHardwareAvailable() { |
50 // Temporarily disabling hotword hardware check for M41. Will be | |
51 // re-enabled for M42. | |
52 #if 0 | |
53 #if defined(OS_CHROMEOS) | 50 #if defined(OS_CHROMEOS) |
54 if (chromeos::CrasAudioHandler::IsInitialized()) { | 51 if (chromeos::CrasAudioHandler::IsInitialized()) { |
55 chromeos::AudioDeviceList devices; | 52 chromeos::AudioDeviceList devices; |
56 chromeos::CrasAudioHandler::Get()->GetAudioDevices(&devices); | 53 chromeos::CrasAudioHandler::Get()->GetAudioDevices(&devices); |
57 for (size_t i = 0; i < devices.size(); ++i) { | 54 for (size_t i = 0; i < devices.size(); ++i) { |
58 if (devices[i].type == chromeos::AUDIO_TYPE_AOKR) { | 55 if (devices[i].type == chromeos::AUDIO_TYPE_AOKR) { |
59 DCHECK(devices[i].is_input); | 56 DCHECK(devices[i].is_input); |
60 return true; | 57 return true; |
61 } | 58 } |
62 } | 59 } |
63 } | 60 } |
64 #endif | 61 #endif |
65 #endif // 0 | |
66 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 62 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
67 return command_line->HasSwitch(switches::kEnableExperimentalHotwordHardware); | 63 return command_line->HasSwitch(switches::kEnableExperimentalHotwordHardware); |
68 } | 64 } |
69 | 65 |
70 // static | 66 // static |
71 int HotwordServiceFactory::GetCurrentError(BrowserContext* context) { | 67 int HotwordServiceFactory::GetCurrentError(BrowserContext* context) { |
72 HotwordService* hotword_service = GetForProfile(context); | 68 HotwordService* hotword_service = GetForProfile(context); |
73 if (!hotword_service) | 69 if (!hotword_service) |
74 return 0; | 70 return 0; |
75 return hotword_service->error_message(); | 71 return hotword_service->error_message(); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 133 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
138 prefs->RegisterBooleanPref(prefs::kHotwordAlwaysOnNotificationSeen, | 134 prefs->RegisterBooleanPref(prefs::kHotwordAlwaysOnNotificationSeen, |
139 false, | 135 false, |
140 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 136 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
141 } | 137 } |
142 | 138 |
143 KeyedService* HotwordServiceFactory::BuildServiceInstanceFor( | 139 KeyedService* HotwordServiceFactory::BuildServiceInstanceFor( |
144 BrowserContext* context) const { | 140 BrowserContext* context) const { |
145 return new HotwordService(Profile::FromBrowserContext(context)); | 141 return new HotwordService(Profile::FromBrowserContext(context)); |
146 } | 142 } |
OLD | NEW |