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

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

Issue 1011813006: Make availability of hotword hardware known to hotword component extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months 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
Index: chrome/browser/search/hotword_service.cc
diff --git a/chrome/browser/search/hotword_service.cc b/chrome/browser/search/hotword_service.cc
index 7560a50c93ba348e54618446b38439b29fc2cb16..4b404df17a64601cb8835b0abb995459b2cc861c 100644
--- a/chrome/browser/search/hotword_service.cc
+++ b/chrome/browser/search/hotword_service.cc
@@ -50,6 +50,10 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
+#if defined(OS_CHROMEOS)
+#include "chromeos/audio/cras_audio_handler.h"
+#endif
+
using extensions::BrowserContextKeyedAPIFactory;
using extensions::HotwordPrivateEventService;
@@ -299,6 +303,23 @@ bool HotwordService::IsExperimentalHotwordingEnabled() {
return !command_line->HasSwitch(switches::kDisableExperimentalHotwording);
}
+// static
+bool HotwordService::IsHotwordHardwareAvailable() {
+#if defined(OS_CHROMEOS)
+ if (chromeos::CrasAudioHandler::IsInitialized()) {
+ 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
+ return false;
+}
+
#if defined(OS_CHROMEOS)
class HotwordService::HotwordUserSessionStateObserver
: public user_manager::UserManager::UserSessionStateObserver {

Powered by Google App Engine
This is Rietveld 408576698