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

Unified Diff: chromeos/audio/cras_audio_handler.cc

Issue 2190773002: Fix Volume slider is captured in screenshot done in touchview mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: disable hiding animation; restoring volume does not notify UI Created 4 years, 5 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
« chromeos/audio/cras_audio_handler.h ('K') | « chromeos/audio/cras_audio_handler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/audio/cras_audio_handler.cc
diff --git a/chromeos/audio/cras_audio_handler.cc b/chromeos/audio/cras_audio_handler.cc
index a8f8036134ead71310d5a6748f4230045971f1f3..084a18aeba7a53127671baa76af8cc8c76b0b2b2 100644
--- a/chromeos/audio/cras_audio_handler.cc
+++ b/chromeos/audio/cras_audio_handler.cc
@@ -376,6 +376,17 @@ void CrasAudioHandler::SetOutputVolumePercent(int volume_percent) {
}
}
+void CrasAudioHandler::SetOutputVolumePercentInternally(int volume_percent) {
jennyz 2016/07/28 21:10:05 Please add a unit test for this new API.
Qiang(Joe) Xu 2016/07/28 23:15:57 Done.
+ volume_internally_changed_ = true;
jennyz 2016/07/28 21:02:17 Will it be possible for SetOutputVolumePercentInte
Qiang(Joe) Xu 2016/07/28 23:15:57 Currently only maximize mode screenshot calls this
+ // Set all active devices to the same volume.
+ for (AudioDeviceMap::const_iterator it = audio_devices_.begin();
+ it != audio_devices_.end(); it++) {
+ const AudioDevice& device = it->second;
+ if (!device.is_input && device.active)
+ SetOutputNodeVolumePercent(device.id, volume_percent);
+ }
jennyz 2016/07/28 21:02:17 line 381-387 is the same as SetOutputVolumePercent
Qiang(Joe) Xu 2016/07/28 23:15:57 Done.
+}
+
// TODO: Rename the 'Percent' to something more meaningful.
void CrasAudioHandler::SetInputGainPercent(int gain_percent) {
// TODO(jennyz): Should we set all input devices' gain to the same level?
@@ -632,6 +643,14 @@ void CrasAudioHandler::OutputNodeVolumeChanged(uint64_t node_id, int volume) {
}
}
+ // Do not notify the observers for the volume changed event if that is
+ // initiated internally, not by users. For example, a volume restoring
+ // comes from maximize mode screenshot volume-down, power down accelerators.
+ if (volume_internally_changed_) {
jennyz 2016/07/28 21:02:17 volume_internally_changed_ is similar to initializ
Qiang(Joe) Xu 2016/07/28 23:15:57 I use a mask to merge them.
+ volume_internally_changed_ = false;
+ return;
+ }
+
FOR_EACH_OBSERVER(AudioObserver, observers_,
OnOutputNodeVolumeChanged(node_id, volume));
}
« chromeos/audio/cras_audio_handler.h ('K') | « chromeos/audio/cras_audio_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698