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

Side by Side Diff: chrome/browser/chromeos/audio/audio_handler.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 unified diff | Download patch | Annotate | Revision Log
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 "chrome/browser/chromeos/audio/audio_handler.h" 5 #include "chrome/browser/chromeos/audio/audio_handler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 local_state->ClearPref(prefs::kAudioVolumeDb); 79 local_state->ClearPref(prefs::kAudioVolumeDb);
80 local_state->UnregisterPreference(prefs::kAudioVolumeDb); 80 local_state->UnregisterPreference(prefs::kAudioVolumeDb);
81 } 81 }
82 82
83 double AudioHandler::GetVolumePercent() { 83 double AudioHandler::GetVolumePercent() {
84 return mixer_->GetVolumePercent(); 84 return mixer_->GetVolumePercent();
85 } 85 }
86 86
87 void AudioHandler::SetVolumePercent(double volume_percent) { 87 void AudioHandler::SetVolumePercent(double volume_percent) {
88 volume_percent = min(max(volume_percent, 0.0), 100.0); 88 volume_percent = min(max(volume_percent, 0.0), 100.0);
89 if (IsMuted() && volume_percent > 0.0)
90 SetMuted(false);
89 mixer_->SetVolumePercent(volume_percent); 91 mixer_->SetVolumePercent(volume_percent);
90 prefs_->SetDouble(prefs::kAudioVolumePercent, volume_percent); 92 prefs_->SetDouble(prefs::kAudioVolumePercent, volume_percent);
91 FOR_EACH_OBSERVER(VolumeObserver, volume_observers_, OnVolumeChanged()); 93 FOR_EACH_OBSERVER(VolumeObserver, volume_observers_, OnVolumeChanged());
92 } 94 }
93 95
94 void AudioHandler::AdjustVolumeByPercent(double adjust_by_percent) { 96 void AudioHandler::AdjustVolumeByPercent(double adjust_by_percent) {
95 SetVolumePercent(mixer_->GetVolumePercent() + adjust_by_percent); 97 SetVolumePercent(mixer_->GetVolumePercent() + adjust_by_percent);
96 } 98 }
97 99
98 bool AudioHandler::IsMuted() { 100 bool AudioHandler::IsMuted() {
(...skipping 24 matching lines...) Expand all
123 mixer_->SetVolumePercent(prefs_->GetDouble(prefs::kAudioVolumePercent)); 125 mixer_->SetVolumePercent(prefs_->GetDouble(prefs::kAudioVolumePercent));
124 mixer_->SetMuted(prefs_->GetInteger(prefs::kAudioMute) == kPrefMuteOn); 126 mixer_->SetMuted(prefs_->GetInteger(prefs::kAudioMute) == kPrefMuteOn);
125 mixer_->Init(); 127 mixer_->Init();
126 } 128 }
127 129
128 AudioHandler::~AudioHandler() { 130 AudioHandler::~AudioHandler() {
129 mixer_.reset(); 131 mixer_.reset();
130 }; 132 };
131 133
132 } // namespace chromeos 134 } // namespace chromeos
OLDNEW
« no previous file with comments | « ash/system/audio/tray_volume.cc ('k') | chrome/browser/ui/views/ash/volume_controller_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698