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

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

Issue 654613004: [Hotword] Delay checking for audio devices until needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updating logic in isAvailable Created 6 years, 2 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_factory.cc
diff --git a/chrome/browser/search/hotword_service_factory.cc b/chrome/browser/search/hotword_service_factory.cc
index d8a061965324dd2d0c639d501872c3861e660f0e..03106422d62cf60922581ac3207e4efbd63494c6 100644
--- a/chrome/browser/search/hotword_service_factory.cc
+++ b/chrome/browser/search/hotword_service_factory.cc
@@ -52,11 +52,17 @@ bool HotwordServiceFactory::IsMicrophoneAvailable() {
return GetInstance()->microphone_available();
}
+// static
+bool HotwordServiceFactory::IsAudioDeviceStateUpdated() {
+ return GetInstance()->audio_device_state_updated();
+}
+
HotwordServiceFactory::HotwordServiceFactory()
: BrowserContextKeyedServiceFactory(
"HotwordService",
BrowserContextDependencyManager::GetInstance()),
- microphone_available_(false) {
+ microphone_available_(false),
+ audio_device_state_updated_(false) {
// No dependencies.
// Register with the device observer list to update the microphone
@@ -77,6 +83,7 @@ void HotwordServiceFactory::InitializeMicrophoneObserver() {
void HotwordServiceFactory::OnUpdateAudioDevices(
const content::MediaStreamDevices& devices) {
microphone_available_ = !devices.empty();
+ audio_device_state_updated_ = true;
}
void HotwordServiceFactory::UpdateMicrophoneState() {
« chrome/browser/search/hotword_service.cc ('K') | « chrome/browser/search/hotword_service_factory.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698