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

Side by Side 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: based on new cr from Daniel Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/common/system/audio/tray_audio.h" 5 #include "ash/common/system/audio/tray_audio.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <utility> 8 #include <utility>
9 9
10 #include "ash/common/ash_constants.h" 10 #include "ash/common/ash_constants.h"
(...skipping 28 matching lines...) Expand all
39 #include "ui/views/view.h" 39 #include "ui/views/view.h"
40 40
41 namespace ash { 41 namespace ash {
42 42
43 TrayAudio::TrayAudio(SystemTray* system_tray, 43 TrayAudio::TrayAudio(SystemTray* system_tray,
44 std::unique_ptr<system::TrayAudioDelegate> audio_delegate) 44 std::unique_ptr<system::TrayAudioDelegate> audio_delegate)
45 : TrayImageItem(system_tray, IDR_AURA_UBER_TRAY_VOLUME_MUTE, UMA_AUDIO), 45 : TrayImageItem(system_tray, IDR_AURA_UBER_TRAY_VOLUME_MUTE, UMA_AUDIO),
46 audio_delegate_(std::move(audio_delegate)), 46 audio_delegate_(std::move(audio_delegate)),
47 volume_view_(NULL), 47 volume_view_(NULL),
48 pop_up_volume_view_(false) { 48 pop_up_volume_view_(false) {
49 WmShell::Get()->system_tray_notifier()->AddAudioObserver(this); 49 SystemTrayNotifier* notifier = WmShell::Get()->system_tray_notifier();
50 notifier->AddAudioObserver(this);
51 notifier->AddMaximizeModeScreenshotObserver(this);
50 display::Screen::GetScreen()->AddObserver(this); 52 display::Screen::GetScreen()->AddObserver(this);
51 } 53 }
52 54
53 TrayAudio::~TrayAudio() { 55 TrayAudio::~TrayAudio() {
54 display::Screen::GetScreen()->RemoveObserver(this); 56 display::Screen::GetScreen()->RemoveObserver(this);
55 WmShell::Get()->system_tray_notifier()->RemoveAudioObserver(this); 57 SystemTrayNotifier* notifier = WmShell::Get()->system_tray_notifier();
58 notifier->RemoveMaximizeModeScreenshotObserver(this);
59 notifier->RemoveAudioObserver(this);
56 } 60 }
57 61
58 // static 62 // static
59 bool TrayAudio::ShowAudioDeviceMenu() { 63 bool TrayAudio::ShowAudioDeviceMenu() {
60 #if defined(OS_CHROMEOS) 64 #if defined(OS_CHROMEOS)
61 return true; 65 return true;
62 #else 66 #else
63 return false; 67 return false;
64 #endif 68 #endif
65 } 69 }
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 } 135 }
132 136
133 void TrayAudio::OnActiveOutputNodeChanged() { 137 void TrayAudio::OnActiveOutputNodeChanged() {
134 Update(); 138 Update();
135 } 139 }
136 140
137 void TrayAudio::OnActiveInputNodeChanged() { 141 void TrayAudio::OnActiveInputNodeChanged() {
138 Update(); 142 Update();
139 } 143 }
140 144
145 void TrayAudio::OnTakingScreenshotInMaximizeMode() {
146 HideDetailedView(false);
147 }
148
141 void TrayAudio::ChangeInternalSpeakerChannelMode() { 149 void TrayAudio::ChangeInternalSpeakerChannelMode() {
142 // Swap left/right channel only if it is in Yoga mode. 150 // Swap left/right channel only if it is in Yoga mode.
143 system::TrayAudioDelegate::AudioChannelMode channel_mode = 151 system::TrayAudioDelegate::AudioChannelMode channel_mode =
144 system::TrayAudioDelegate::NORMAL; 152 system::TrayAudioDelegate::NORMAL;
145 if (display::Display::HasInternalDisplay()) { 153 if (display::Display::HasInternalDisplay()) {
146 const DisplayInfo& display_info = 154 const DisplayInfo& display_info =
147 WmShell::Get()->GetDisplayInfo(display::Display::InternalDisplayId()); 155 WmShell::Get()->GetDisplayInfo(display::Display::InternalDisplayId());
148 if (display_info.GetActiveRotation() == display::Display::ROTATE_180) 156 if (display_info.GetActiveRotation() == display::Display::ROTATE_180)
149 channel_mode = system::TrayAudioDelegate::LEFT_RIGHT_SWAPPED; 157 channel_mode = system::TrayAudioDelegate::LEFT_RIGHT_SWAPPED;
150 } 158 }
(...skipping 26 matching lines...) Expand all
177 if (tray_view()) 185 if (tray_view())
178 tray_view()->SetVisible(GetInitialVisibility()); 186 tray_view()->SetVisible(GetInitialVisibility());
179 if (volume_view_) { 187 if (volume_view_) {
180 volume_view_->SetVolumeLevel( 188 volume_view_->SetVolumeLevel(
181 static_cast<float>(audio_delegate_->GetOutputVolumeLevel()) / 100.0f); 189 static_cast<float>(audio_delegate_->GetOutputVolumeLevel()) / 100.0f);
182 volume_view_->Update(); 190 volume_view_->Update();
183 } 191 }
184 } 192 }
185 193
186 } // namespace ash 194 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698