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

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

Issue 1047973003: Notify hotwording extension of microphone state change. (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_factory.cc
diff --git a/chrome/browser/search/hotword_service_factory.cc b/chrome/browser/search/hotword_service_factory.cc
index bbc10b4f1a22d684fc8ae2709d6b1380db2982b6..7b7284e9bc491096bc23afc4057401ca68aea5d4 100644
--- a/chrome/browser/search/hotword_service_factory.cc
+++ b/chrome/browser/search/hotword_service_factory.cc
@@ -68,45 +68,16 @@ int HotwordServiceFactory::GetCurrentError(BrowserContext* context) {
return hotword_service->error_message();
}
-// static
-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),
- audio_device_state_updated_(false) {
+ BrowserContextDependencyManager::GetInstance()) {
// No dependencies.
-
- // Register with the device observer list to update the microphone
- // availability.
- BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
- base::Bind(&HotwordServiceFactory::InitializeMicrophoneObserver,
- base::Unretained(this)));
}
HotwordServiceFactory::~HotwordServiceFactory() {
}
-void HotwordServiceFactory::InitializeMicrophoneObserver() {
- MediaCaptureDevicesDispatcher::GetInstance()->AddObserver(this);
-}
-
-void HotwordServiceFactory::OnUpdateAudioDevices(
- const content::MediaStreamDevices& devices) {
- microphone_available_ = !devices.empty();
- audio_device_state_updated_ = true;
-}
-
void HotwordServiceFactory::UpdateMicrophoneState() {
// In order to trigger the monitor, just call getAudioCaptureDevices.
content::MediaStreamDevices devices =

Powered by Google App Engine
This is Rietveld 408576698