Chromium Code Reviews| 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 28 matching lines...) Expand all Loading... | |
| 39 return hotword_service && hotword_service->IsServiceAvailable(); | 39 return hotword_service && hotword_service->IsServiceAvailable(); |
| 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() { |
|
Matt Giuca
2015/01/15 01:51:21
I don't like the idea of removing this code; I und
Anand Mistry (off Chromium)
2015/01/15 02:21:01
Done.
| |
| 50 #if defined(OS_CHROMEOS) | |
| 51 if (chromeos::CrasAudioHandler::IsInitialized()) { | |
| 52 chromeos::AudioDeviceList devices; | |
| 53 chromeos::CrasAudioHandler::Get()->GetAudioDevices(&devices); | |
| 54 for (size_t i = 0; i < devices.size(); ++i) { | |
| 55 if (devices[i].type == chromeos::AUDIO_TYPE_AOKR) { | |
| 56 DCHECK(devices[i].is_input); | |
| 57 return true; | |
| 58 } | |
| 59 } | |
| 60 } | |
| 61 #endif | |
| 62 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 50 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 63 return command_line->HasSwitch(switches::kEnableExperimentalHotwordHardware); | 51 return command_line->HasSwitch(switches::kEnableExperimentalHotwordHardware); |
| 64 } | 52 } |
| 65 | 53 |
| 66 // static | 54 // static |
| 67 int HotwordServiceFactory::GetCurrentError(BrowserContext* context) { | 55 int HotwordServiceFactory::GetCurrentError(BrowserContext* context) { |
| 68 HotwordService* hotword_service = GetForProfile(context); | 56 HotwordService* hotword_service = GetForProfile(context); |
| 69 if (!hotword_service) | 57 if (!hotword_service) |
| 70 return 0; | 58 return 0; |
| 71 return hotword_service->error_message(); | 59 return hotword_service->error_message(); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 133 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 121 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 134 prefs->RegisterBooleanPref(prefs::kHotwordAlwaysOnNotificationSeen, | 122 prefs->RegisterBooleanPref(prefs::kHotwordAlwaysOnNotificationSeen, |
| 135 false, | 123 false, |
| 136 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 124 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 137 } | 125 } |
| 138 | 126 |
| 139 KeyedService* HotwordServiceFactory::BuildServiceInstanceFor( | 127 KeyedService* HotwordServiceFactory::BuildServiceInstanceFor( |
| 140 BrowserContext* context) const { | 128 BrowserContext* context) const { |
| 141 return new HotwordService(Profile::FromBrowserContext(context)); | 129 return new HotwordService(Profile::FromBrowserContext(context)); |
| 142 } | 130 } |
| OLD | NEW |