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

Unified Diff: ash/system/audio/tray_volume.cc

Issue 10408036: Modify the volume visuals: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/audio/tray_volume.cc
diff --git a/ash/system/audio/tray_volume.cc b/ash/system/audio/tray_volume.cc
index b43f1218deff505379c7f30501f6e70e853dd043..869c517c3a470eddfed8b096f8e960c333571ecf 100644
--- a/ash/system/audio/tray_volume.cc
+++ b/ash/system/audio/tray_volume.cc
@@ -106,7 +106,8 @@ class VolumeView : public views::View,
ash::Shell::GetInstance()->tray_delegate();
slider_ = new views::Slider(this, views::Slider::HORIZONTAL);
slider_->set_focus_border_color(kFocusBorderColor);
- slider_->SetValue(delegate->GetVolumeLevel());
+ slider_->SetValue(
+ delegate->IsAudioMuted() ? 0.0 : delegate->GetVolumeLevel());
slider_->SetAccessibleName(
ui::ResourceBundle::GetSharedInstance().GetLocalizedString(
IDS_ASH_STATUS_TRAY_VOLUME));
@@ -148,8 +149,13 @@ class VolumeView : public views::View,
float value,
float old_value,
views::SliderChangeReason reason) OVERRIDE {
- if (reason == views::VALUE_CHANGED_BY_USER)
- ash::Shell::GetInstance()->tray_delegate()->SetVolumeLevel(value);
+ if (reason == views::VALUE_CHANGED_BY_USER) {
+ ash::SystemTrayDelegate* delegate =
+ ash::Shell::GetInstance()->tray_delegate();
+ delegate->SetVolumeLevel(value);
+ if (delegate->IsAudioMuted() && value > 0.0)
+ delegate->SetAudioMuted(false);
sadrul 2012/05/19 02:10:54 I don't think this is the right place for this cha
Daniel Erat 2012/05/19 05:38:34 Sorry, I gave conflicting feedback in the review f
Jun Mukai 2012/05/21 17:05:38 Still not sure which is better, but is there any r
Jun Mukai 2012/05/21 17:19:38 Note that same thing was introduced to volume_cont
+ }
icon_->Update();
}
@@ -171,7 +177,9 @@ TrayVolume::~TrayVolume() {
}
bool TrayVolume::GetInitialVisibility() {
- return ash::Shell::GetInstance()->tray_delegate()->IsAudioMuted();
+ ash::SystemTrayDelegate* delegate =
+ ash::Shell::GetInstance()->tray_delegate();
+ return delegate->GetVolumeLevel() == 0.0 || delegate->IsAudioMuted();
}
views::View* TrayVolume::CreateDefaultView(user::LoginStatus status) {
@@ -201,6 +209,8 @@ void TrayVolume::OnVolumeChanged(float percent) {
tray_view()->SetVisible(GetInitialVisibility());
if (volume_view_) {
+ if (ash::Shell::GetInstance()->tray_delegate()->IsAudioMuted())
+ percent = 0.0;
volume_view_->SetVolumeLevel(percent);
SetDetailedViewCloseDelay(kTrayPopupAutoCloseDelayInSeconds);
return;
« 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