Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(770)

Unified Diff: chrome/browser/search/hotword_service_factory.cc

Issue 795393002: [Hotword] Implement IsHotwordHardwareAvailable() using device types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix failures due to double init of cras audio handler Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/search/hotword_service.cc ('k') | chromeos/audio/audio_device.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « chrome/browser/search/hotword_service.cc ('k') | chromeos/audio/audio_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698