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/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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 volume_view_->SetVolumeLevel(percent); | 108 volume_view_->SetVolumeLevel(percent); |
109 SetDetailedViewCloseDelay(kTrayPopupAutoCloseDelayInSeconds); | 109 SetDetailedViewCloseDelay(kTrayPopupAutoCloseDelayInSeconds); |
110 return; | 110 return; |
111 } | 111 } |
112 pop_up_volume_view_ = true; | 112 pop_up_volume_view_ = true; |
113 PopupDetailedView(kTrayPopupAutoCloseDelayInSeconds, false); | 113 PopupDetailedView(kTrayPopupAutoCloseDelayInSeconds, false); |
114 } | 114 } |
115 | 115 |
116 void TrayAudio::OnOutputMuteChanged(bool /* mute_on */, bool system_adjust) { | 116 void TrayAudio::OnOutputMuteChanged(bool /* mute_on */, bool system_adjust) { |
117 if (tray_view()) | 117 if (tray_view()) |
118 tray_view()->SetVisible(GetInitialVisibility()); | 118 tray_view()->SetVisible(GetInitialVisibility()); |
119 | 119 |
120 if (volume_view_) { | 120 if (volume_view_) { |
121 volume_view_->Update(); | 121 volume_view_->Update(); |
122 SetDetailedViewCloseDelay(kTrayPopupAutoCloseDelayInSeconds); | 122 SetDetailedViewCloseDelay(kTrayPopupAutoCloseDelayInSeconds); |
123 } else if (!system_adjust) { | 123 } else if (!system_adjust) { |
124 pop_up_volume_view_ = true; | 124 pop_up_volume_view_ = true; |
125 PopupDetailedView(kTrayPopupAutoCloseDelayInSeconds, false); | 125 PopupDetailedView(kTrayPopupAutoCloseDelayInSeconds, false); |
126 } | 126 } |
127 } | 127 } |
128 | 128 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 uint32_t changed_metrics) { | 168 uint32_t changed_metrics) { |
169 if (!display.IsInternal()) | 169 if (!display.IsInternal()) |
170 return; | 170 return; |
171 | 171 |
172 if (changed_metrics & display::DisplayObserver::DISPLAY_METRIC_ROTATION) | 172 if (changed_metrics & display::DisplayObserver::DISPLAY_METRIC_ROTATION) |
173 ChangeInternalSpeakerChannelMode(); | 173 ChangeInternalSpeakerChannelMode(); |
174 } | 174 } |
175 | 175 |
176 void TrayAudio::Update() { | 176 void TrayAudio::Update() { |
177 if (tray_view()) | 177 if (tray_view()) |
178 tray_view()->SetVisible(GetInitialVisibility()); | 178 tray_view()->SetVisible(GetInitialVisibility()); |
179 if (volume_view_) { | 179 if (volume_view_) { |
180 volume_view_->SetVolumeLevel( | 180 volume_view_->SetVolumeLevel( |
181 static_cast<float>(audio_delegate_->GetOutputVolumeLevel()) / 100.0f); | 181 static_cast<float>(audio_delegate_->GetOutputVolumeLevel()) / 100.0f); |
182 volume_view_->Update(); | 182 volume_view_->Update(); |
183 } | 183 } |
184 } | 184 } |
185 | 185 |
186 } // namespace ash | 186 } // namespace ash |
OLD | NEW |