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

Unified Diff: ash/common/system/audio/tray_audio.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: remove OnDidTakeScreenshot; clean code 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
Index: ash/common/system/audio/tray_audio.cc
diff --git a/ash/common/system/audio/tray_audio.cc b/ash/common/system/audio/tray_audio.cc
index 8ff0987aadc01be209d8ef02a09d83a1fd738b8a..b3835dbcb46906c9317b8fee20719139d305d808 100644
--- a/ash/common/system/audio/tray_audio.cc
+++ b/ash/common/system/audio/tray_audio.cc
@@ -45,14 +45,19 @@ TrayAudio::TrayAudio(SystemTray* system_tray,
: TrayImageItem(system_tray, IDR_AURA_UBER_TRAY_VOLUME_MUTE, UMA_AUDIO),
audio_delegate_(std::move(audio_delegate)),
volume_view_(NULL),
- pop_up_volume_view_(false) {
- WmShell::Get()->system_tray_notifier()->AddAudioObserver(this);
+ pop_up_volume_view_(false),
+ hide_popup_(false) {
+ SystemTrayNotifier* notifier = WmShell::Get()->system_tray_notifier();
+ notifier->AddAudioObserver(this);
+ notifier->AddMaximizeModeScreenshotObserver(this);
display::Screen::GetScreen()->AddObserver(this);
}
TrayAudio::~TrayAudio() {
display::Screen::GetScreen()->RemoveObserver(this);
- WmShell::Get()->system_tray_notifier()->RemoveAudioObserver(this);
+ SystemTrayNotifier* notifier = WmShell::Get()->system_tray_notifier();
+ notifier->RemoveMaximizeModeScreenshotObserver(this);
+ notifier->RemoveAudioObserver(this);
}
// static
@@ -110,7 +115,12 @@ void TrayAudio::OnOutputNodeVolumeChanged(uint64_t /* node_id */,
return;
}
pop_up_volume_view_ = true;
- PopupDetailedView(kTrayPopupAutoCloseDelayInSeconds, false);
+ // When the OutputNodeVolumeChanged is caused by a volume restore after
+ // maximize mode screenshot, it should not cause UI popup.
+ if (!hide_popup_)
+ PopupDetailedView(kTrayPopupAutoCloseDelayInSeconds, false);
+ else
+ hide_popup_ = false;
Daniel Erat 2016/07/28 04:45:00 this approach (hiding the next popup) feels a bit
Qiang(Joe) Xu 2016/07/28 20:25:02 done by moving the logic to cras_audio_handler
}
void TrayAudio::OnOutputMuteChanged(bool /* mute_on */, bool system_adjust) {
@@ -138,6 +148,11 @@ void TrayAudio::OnActiveInputNodeChanged() {
Update();
}
+void TrayAudio::OnWillTakeScreenshotInMaximizeMode() {
+ HideDetailedView();
+ hide_popup_ = true;
+}
+
void TrayAudio::ChangeInternalSpeakerChannelMode() {
// Swap left/right channel only if it is in Yoga mode.
system::TrayAudioDelegate::AudioChannelMode channel_mode =

Powered by Google App Engine
This is Rietveld 408576698