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

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

Issue 9706007: ash: Update the volume icon when audio is muted/unmuted. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_volume.h" 5 #include "ash/system/audio/tray_volume.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/system/tray/system_tray_delegate.h" 8 #include "ash/system/tray/system_tray_delegate.h"
9 #include "ash/system/tray/tray_constants.h" 9 #include "ash/system/tray/tray_constants.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 slider_ = new views::Slider(this, views::Slider::HORIZONTAL); 108 slider_ = new views::Slider(this, views::Slider::HORIZONTAL);
109 slider_->SetValue(delegate->GetVolumeLevel()); 109 slider_->SetValue(delegate->GetVolumeLevel());
110 slider_->set_border(views::Border::CreateEmptyBorder(0, 0, 0, 20)); 110 slider_->set_border(views::Border::CreateEmptyBorder(0, 0, 0, 20));
111 AddChildView(slider_); 111 AddChildView(slider_);
112 } 112 }
113 113
114 virtual ~VolumeView() {} 114 virtual ~VolumeView() {}
115 115
116 void SetVolumeLevel(float percent) { 116 void SetVolumeLevel(float percent) {
117 slider_->SetValue(percent); 117 slider_->SetValue(percent);
118 // It is possible that the volume was (un)muted, but the actual volume level
119 // did not change. In that case, setting the value of the slider won't
120 // trigger a repaint. So explicitly trigger a repaint.
121 icon_->SchedulePaint();
118 } 122 }
119 123
120 private: 124 private:
121 // Overridden from views::ButtonListener. 125 // Overridden from views::ButtonListener.
122 virtual void ButtonPressed(views::Button* sender, 126 virtual void ButtonPressed(views::Button* sender,
123 const views::Event& event) OVERRIDE { 127 const views::Event& event) OVERRIDE {
124 CHECK(sender == icon_); 128 CHECK(sender == icon_);
125 ash::SystemTrayDelegate* delegate = 129 ash::SystemTrayDelegate* delegate =
126 ash::Shell::GetInstance()->tray_delegate(); 130 ash::Shell::GetInstance()->tray_delegate();
127 delegate->SetAudioMuted(!delegate->IsAudioMuted()); 131 delegate->SetAudioMuted(!delegate->IsAudioMuted());
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 if (volume_view_.get()) { 184 if (volume_view_.get()) {
181 volume_view_->SetVolumeLevel(percent); 185 volume_view_->SetVolumeLevel(percent);
182 return; 186 return;
183 } 187 }
184 188
185 PopupDetailedView(kTrayPopupAutoCloseDelayInSeconds, false); 189 PopupDetailedView(kTrayPopupAutoCloseDelayInSeconds, false);
186 } 190 }
187 191
188 } // namespace internal 192 } // namespace internal
189 } // namespace ash 193 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698