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

Unified Diff: chrome/browser/search/hotword_service.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
Index: chrome/browser/search/hotword_service.cc
diff --git a/chrome/browser/search/hotword_service.cc b/chrome/browser/search/hotword_service.cc
index b6b54ae69801b69b13e63629bc72266f4399512f..b7d16f132964c43cd9f783358342c6cb8d677267 100644
--- a/chrome/browser/search/hotword_service.cc
+++ b/chrome/browser/search/hotword_service.cc
@@ -49,6 +49,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;
@@ -307,6 +311,13 @@ HotwordService::HotwordService(Profile* profile)
reinstall_pending_(false),
training_(false),
weak_factory_(this) {
+#if defined(OS_CHROMEOS)
+ // Tests on chromeos need to have the handler initialized.
+ if (profile_->AsTestingProfile() &&
+ !chromeos::CrasAudioHandler::IsInitialized())
+ chromeos::CrasAudioHandler::InitializeForTesting();
+#endif
+
extension_registry_observer_.Add(extensions::ExtensionRegistry::Get(profile));
if (IsExperimentalHotwordingEnabled()) {
// Disable the old extension so it doesn't interfere with the new stuff.
« no previous file with comments | « chrome/browser/extensions/component_loader_unittest.cc ('k') | chrome/browser/search/hotword_service_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698