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 | |
50 #if defined(OS_CHROMEOS) | 53 #if defined(OS_CHROMEOS) |
Matt Giuca
2015/01/15 02:56:43
I think you should delete this inner if.
Your cho
| |
51 if (chromeos::CrasAudioHandler::IsInitialized()) { | 54 if (chromeos::CrasAudioHandler::IsInitialized()) { |
52 chromeos::AudioDeviceList devices; | 55 chromeos::AudioDeviceList devices; |
53 chromeos::CrasAudioHandler::Get()->GetAudioDevices(&devices); | 56 chromeos::CrasAudioHandler::Get()->GetAudioDevices(&devices); |
54 for (size_t i = 0; i < devices.size(); ++i) { | 57 for (size_t i = 0; i < devices.size(); ++i) { |
55 if (devices[i].type == chromeos::AUDIO_TYPE_AOKR) { | 58 if (devices[i].type == chromeos::AUDIO_TYPE_AOKR) { |
56 DCHECK(devices[i].is_input); | 59 DCHECK(devices[i].is_input); |
57 return true; | 60 return true; |
58 } | 61 } |
59 } | 62 } |
60 } | 63 } |
61 #endif | 64 #endif |
65 #endif // 0 | |
62 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 66 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
63 return command_line->HasSwitch(switches::kEnableExperimentalHotwordHardware); | 67 return command_line->HasSwitch(switches::kEnableExperimentalHotwordHardware); |
64 } | 68 } |
65 | 69 |
66 // static | 70 // static |
67 int HotwordServiceFactory::GetCurrentError(BrowserContext* context) { | 71 int HotwordServiceFactory::GetCurrentError(BrowserContext* context) { |
68 HotwordService* hotword_service = GetForProfile(context); | 72 HotwordService* hotword_service = GetForProfile(context); |
69 if (!hotword_service) | 73 if (!hotword_service) |
70 return 0; | 74 return 0; |
71 return hotword_service->error_message(); | 75 return hotword_service->error_message(); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
133 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 137 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
134 prefs->RegisterBooleanPref(prefs::kHotwordAlwaysOnNotificationSeen, | 138 prefs->RegisterBooleanPref(prefs::kHotwordAlwaysOnNotificationSeen, |
135 false, | 139 false, |
136 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 140 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
137 } | 141 } |
138 | 142 |
139 KeyedService* HotwordServiceFactory::BuildServiceInstanceFor( | 143 KeyedService* HotwordServiceFactory::BuildServiceInstanceFor( |
140 BrowserContext* context) const { | 144 BrowserContext* context) const { |
141 return new HotwordService(Profile::FromBrowserContext(context)); | 145 return new HotwordService(Profile::FromBrowserContext(context)); |
142 } | 146 } |
OLD | NEW |