Chromium Code Reviews| 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 = |