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

Side by Side Diff: ash/common/system/audio/tray_audio.cc

Issue 2270553002: Move ash::DisplayInfo to ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 3 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
« no previous file with comments | « ash/common/display/display_info_unittest.cc ('k') | ash/common/wm_shell.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "ash/common/display/display_info.h"
12 #include "ash/common/system/audio/tray_audio_delegate.h" 11 #include "ash/common/system/audio/tray_audio_delegate.h"
13 #include "ash/common/system/audio/volume_view.h" 12 #include "ash/common/system/audio/volume_view.h"
14 #include "ash/common/system/tray/actionable_view.h" 13 #include "ash/common/system/tray/actionable_view.h"
15 #include "ash/common/system/tray/fixed_sized_scroll_view.h" 14 #include "ash/common/system/tray/fixed_sized_scroll_view.h"
16 #include "ash/common/system/tray/hover_highlight_view.h" 15 #include "ash/common/system/tray/hover_highlight_view.h"
17 #include "ash/common/system/tray/system_tray_delegate.h" 16 #include "ash/common/system/tray/system_tray_delegate.h"
18 #include "ash/common/system/tray/system_tray_notifier.h" 17 #include "ash/common/system/tray/system_tray_notifier.h"
19 #include "ash/common/system/tray/tray_constants.h" 18 #include "ash/common/system/tray/tray_constants.h"
20 #include "ash/common/system/volume_control_delegate.h" 19 #include "ash/common/system/volume_control_delegate.h"
21 #include "ash/common/wm_shell.h" 20 #include "ash/common/wm_shell.h"
22 #include "base/strings/utf_string_conversions.h" 21 #include "base/strings/utf_string_conversions.h"
23 #include "grit/ash_resources.h" 22 #include "grit/ash_resources.h"
24 #include "third_party/skia/include/core/SkCanvas.h" 23 #include "third_party/skia/include/core/SkCanvas.h"
25 #include "third_party/skia/include/core/SkPaint.h" 24 #include "third_party/skia/include/core/SkPaint.h"
26 #include "third_party/skia/include/core/SkRect.h" 25 #include "third_party/skia/include/core/SkRect.h"
27 #include "third_party/skia/include/effects/SkGradientShader.h" 26 #include "third_party/skia/include/effects/SkGradientShader.h"
28 #include "ui/display/display.h" 27 #include "ui/display/display.h"
28 #include "ui/display/manager/managed_display_info.h"
29 #include "ui/display/screen.h" 29 #include "ui/display/screen.h"
30 #include "ui/gfx/canvas.h" 30 #include "ui/gfx/canvas.h"
31 #include "ui/gfx/font_list.h" 31 #include "ui/gfx/font_list.h"
32 #include "ui/gfx/image/image.h" 32 #include "ui/gfx/image/image.h"
33 #include "ui/gfx/image/image_skia_operations.h" 33 #include "ui/gfx/image/image_skia_operations.h"
34 #include "ui/views/controls/button/image_button.h" 34 #include "ui/views/controls/button/image_button.h"
35 #include "ui/views/controls/image_view.h" 35 #include "ui/views/controls/image_view.h"
36 #include "ui/views/controls/label.h" 36 #include "ui/views/controls/label.h"
37 #include "ui/views/layout/box_layout.h" 37 #include "ui/views/layout/box_layout.h"
38 #include "ui/views/view.h" 38 #include "ui/views/view.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 135
136 void TrayAudio::OnActiveInputNodeChanged() { 136 void TrayAudio::OnActiveInputNodeChanged() {
137 Update(); 137 Update();
138 } 138 }
139 139
140 void TrayAudio::ChangeInternalSpeakerChannelMode() { 140 void TrayAudio::ChangeInternalSpeakerChannelMode() {
141 // Swap left/right channel only if it is in Yoga mode. 141 // Swap left/right channel only if it is in Yoga mode.
142 system::TrayAudioDelegate::AudioChannelMode channel_mode = 142 system::TrayAudioDelegate::AudioChannelMode channel_mode =
143 system::TrayAudioDelegate::NORMAL; 143 system::TrayAudioDelegate::NORMAL;
144 if (display::Display::HasInternalDisplay()) { 144 if (display::Display::HasInternalDisplay()) {
145 const DisplayInfo& display_info = 145 const display::ManagedDisplayInfo& display_info =
146 WmShell::Get()->GetDisplayInfo(display::Display::InternalDisplayId()); 146 WmShell::Get()->GetDisplayInfo(display::Display::InternalDisplayId());
147 if (display_info.GetActiveRotation() == display::Display::ROTATE_180) 147 if (display_info.GetActiveRotation() == display::Display::ROTATE_180)
148 channel_mode = system::TrayAudioDelegate::LEFT_RIGHT_SWAPPED; 148 channel_mode = system::TrayAudioDelegate::LEFT_RIGHT_SWAPPED;
149 } 149 }
150 150
151 audio_delegate_->SetInternalSpeakerChannelMode(channel_mode); 151 audio_delegate_->SetInternalSpeakerChannelMode(channel_mode);
152 } 152 }
153 153
154 void TrayAudio::OnDisplayAdded(const display::Display& new_display) { 154 void TrayAudio::OnDisplayAdded(const display::Display& new_display) {
155 if (!new_display.IsInternal()) 155 if (!new_display.IsInternal())
(...skipping 20 matching lines...) Expand all
176 if (tray_view()) 176 if (tray_view())
177 tray_view()->SetVisible(GetInitialVisibility()); 177 tray_view()->SetVisible(GetInitialVisibility());
178 if (volume_view_) { 178 if (volume_view_) {
179 volume_view_->SetVolumeLevel( 179 volume_view_->SetVolumeLevel(
180 static_cast<float>(audio_delegate_->GetOutputVolumeLevel()) / 100.0f); 180 static_cast<float>(audio_delegate_->GetOutputVolumeLevel()) / 100.0f);
181 volume_view_->Update(); 181 volume_view_->Update();
182 } 182 }
183 } 183 }
184 184
185 } // namespace ash 185 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/display/display_info_unittest.cc ('k') | ash/common/wm_shell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698