| OLD | NEW |
| 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/system/audio/tray_audio.h" | 5 #include "ash/system/audio/tray_audio.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "ash/ash_constants.h" | 9 #include "ash/ash_constants.h" |
| 10 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 } | 160 } |
| 161 | 161 |
| 162 void TrayAudio::ChangeInternalSpeakerChannelMode() { | 162 void TrayAudio::ChangeInternalSpeakerChannelMode() { |
| 163 // Swap left/right channel only if it is in Yoga mode. | 163 // Swap left/right channel only if it is in Yoga mode. |
| 164 system::TrayAudioDelegate::AudioChannelMode channel_mode = | 164 system::TrayAudioDelegate::AudioChannelMode channel_mode = |
| 165 system::TrayAudioDelegate::NORMAL; | 165 system::TrayAudioDelegate::NORMAL; |
| 166 if (gfx::Display::InternalDisplayId() != gfx::Display::kInvalidDisplayID) { | 166 if (gfx::Display::InternalDisplayId() != gfx::Display::kInvalidDisplayID) { |
| 167 const DisplayInfo& display_info = | 167 const DisplayInfo& display_info = |
| 168 Shell::GetInstance()->display_manager()->GetDisplayInfo( | 168 Shell::GetInstance()->display_manager()->GetDisplayInfo( |
| 169 gfx::Display::InternalDisplayId()); | 169 gfx::Display::InternalDisplayId()); |
| 170 if (display_info.rotation() == gfx::Display::ROTATE_180) | 170 if (display_info.GetActiveRotation() == gfx::Display::ROTATE_180) |
| 171 channel_mode = system::TrayAudioDelegate::LEFT_RIGHT_SWAPPED; | 171 channel_mode = system::TrayAudioDelegate::LEFT_RIGHT_SWAPPED; |
| 172 } | 172 } |
| 173 | 173 |
| 174 audio_delegate_->SetInternalSpeakerChannelMode(channel_mode); | 174 audio_delegate_->SetInternalSpeakerChannelMode(channel_mode); |
| 175 } | 175 } |
| 176 | 176 |
| 177 void TrayAudio::Update() { | 177 void TrayAudio::Update() { |
| 178 if (tray_view()) | 178 if (tray_view()) |
| 179 tray_view()->SetVisible(GetInitialVisibility()); | 179 tray_view()->SetVisible(GetInitialVisibility()); |
| 180 if (volume_view_) { | 180 if (volume_view_) { |
| 181 volume_view_->SetVolumeLevel( | 181 volume_view_->SetVolumeLevel( |
| 182 static_cast<float>(audio_delegate_->GetOutputVolumeLevel()) / 100.0f); | 182 static_cast<float>(audio_delegate_->GetOutputVolumeLevel()) / 100.0f); |
| 183 volume_view_->Update(); | 183 volume_view_->Update(); |
| 184 } | 184 } |
| 185 } | 185 } |
| 186 | 186 |
| 187 } // namespace ash | 187 } // namespace ash |
| OLD | NEW |