Index: chrome/browser/search/hotword_service_factory.cc |
diff --git a/chrome/browser/search/hotword_service_factory.cc b/chrome/browser/search/hotword_service_factory.cc |
index ed2dabc7763b48137343fcc3cf7cbbe6febf79de..9b5bd8410e93e6c73e46e23e8c789f6bb65298d9 100644 |
--- a/chrome/browser/search/hotword_service_factory.cc |
+++ b/chrome/browser/search/hotword_service_factory.cc |
@@ -15,6 +15,10 @@ |
#include "content/public/browser/browser_context.h" |
#include "content/public/browser/browser_thread.h" |
+#if defined(OS_CHROMEOS) |
+#include "chromeos/audio/cras_audio_handler.h" |
+#endif |
+ |
using content::BrowserContext; |
using content::BrowserThread; |
@@ -43,10 +47,16 @@ bool HotwordServiceFactory::IsHotwordAllowed(BrowserContext* context) { |
// static |
bool HotwordServiceFactory::IsHotwordHardwareAvailable() { |
- // TODO(rlp, dgreid): return has_hotword_hardware() |
- // Fill in once the hardware has the correct interface implemented. |
- // In the meantime, this function can be used to get other parts moving |
- // based on a flag. |
+#if defined(OS_CHROMEOS) |
+ chromeos::AudioDeviceList devices; |
+ chromeos::CrasAudioHandler::Get()->GetAudioDevices(&devices); |
+ for (size_t i = 0; i < devices.size(); ++i) { |
+ if (devices[i].type == chromeos::AUDIO_TYPE_AOKR) { |
+ DCHECK(devices[i].is_input); |
+ return true; |
+ } |
+ } |
+#endif |
CommandLine* command_line = CommandLine::ForCurrentProcess(); |
return command_line->HasSwitch(switches::kEnableExperimentalHotwordHardware); |
} |