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

Unified Diff: chromeos/audio/cras_audio_handler.cc

Issue 1186293003: Implement HasInputDevices in CrasAudioManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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: chromeos/audio/cras_audio_handler.cc
diff --git a/chromeos/audio/cras_audio_handler.cc b/chromeos/audio/cras_audio_handler.cc
index 3a86d8676ff483bb52be7955b979ba21ad5de1bf..88bdc4500f87a8bb144dc5855e5542361d933933 100644
--- a/chromeos/audio/cras_audio_handler.cc
+++ b/chromeos/audio/cras_audio_handler.cc
@@ -903,6 +903,18 @@ void CrasAudioHandler::UpdateDevicesAndSwitchActive(
}
}
+void CrasAudioHandler::UpdateAudioManagerHasInputDevices() {
+ AudioDeviceList devices;
+ GetAudioDevices(&devices);
+ for (size_t i = 0; i < devices.size(); ++i) {
+ if (devices[i].is_input && devices[i].is_for_simple_usage) {
+ media::AudioManager::Get()->SetHasInputDevices(true);
+ return;
+ }
+ }
+ media::AudioManager::Get()->SetHasInputDevices(false);
+}
+
void CrasAudioHandler::HandleGetNodes(const chromeos::AudioNodeList& node_list,
bool success) {
if (!success) {
@@ -911,6 +923,7 @@ void CrasAudioHandler::HandleGetNodes(const chromeos::AudioNodeList& node_list,
}
UpdateDevicesAndSwitchActive(node_list);
+ UpdateAudioManagerHasInputDevices();
FOR_EACH_OBSERVER(AudioObserver, observers_, OnAudioNodesChanged());
}

Powered by Google App Engine
This is Rietveld 408576698