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

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

Issue 945103002: Add a new audio extension event OnLevelChanged. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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/system/audio/tray_audio.h ('k') | ash/system/tray/system_tray_notifier.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/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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 } 90 }
91 91
92 bool TrayAudio::ShouldHideArrow() const { 92 bool TrayAudio::ShouldHideArrow() const {
93 return true; 93 return true;
94 } 94 }
95 95
96 bool TrayAudio::ShouldShowShelf() const { 96 bool TrayAudio::ShouldShowShelf() const {
97 return TrayAudio::ShowAudioDeviceMenu() && !pop_up_volume_view_; 97 return TrayAudio::ShowAudioDeviceMenu() && !pop_up_volume_view_;
98 } 98 }
99 99
100 void TrayAudio::OnOutputVolumeChanged() { 100 void TrayAudio::OnOutputNodeVolumeChanged(uint64 node_id, double volume) {
stevenjb 2015/02/23 22:16:19 Comment out node_id and volume to indicate that th
jennyz 2015/02/24 00:05:38 Done.
101 float percent = 101 float percent =
102 static_cast<float>(audio_delegate_->GetOutputVolumeLevel()) / 100.0f; 102 static_cast<float>(audio_delegate_->GetOutputVolumeLevel()) / 100.0f;
103 if (tray_view()) 103 if (tray_view())
104 tray_view()->SetVisible(GetInitialVisibility()); 104 tray_view()->SetVisible(GetInitialVisibility());
105 105
106 if (volume_view_) { 106 if (volume_view_) {
107 volume_view_->SetVolumeLevel(percent); 107 volume_view_->SetVolumeLevel(percent);
108 SetDetailedViewCloseDelay(kTrayPopupAutoCloseDelayInSeconds); 108 SetDetailedViewCloseDelay(kTrayPopupAutoCloseDelayInSeconds);
109 return; 109 return;
110 } 110 }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « ash/system/audio/tray_audio.h ('k') | ash/system/tray/system_tray_notifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698