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

Unified Diff: chrome/browser/chromeos/audio/audio_handler.cc

Issue 10411028: Fix the volume controlling behaviors. (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
Index: chrome/browser/chromeos/audio/audio_handler.cc
diff --git a/chrome/browser/chromeos/audio/audio_handler.cc b/chrome/browser/chromeos/audio/audio_handler.cc
index fc4316294856cd3cb0be3743980e9e9aedff8dda..13606a23a2e4281955a55b8e9a1637eddb8fb31c 100644
--- a/chrome/browser/chromeos/audio/audio_handler.cc
+++ b/chrome/browser/chromeos/audio/audio_handler.cc
@@ -40,7 +40,11 @@ static AudioHandler* g_audio_handler = NULL;
// static
void AudioHandler::Initialize() {
CHECK(!g_audio_handler);
- g_audio_handler = new AudioHandler();
+#if defined(USE_CRAS)
+ g_audio_handler = new AudioHandler(new AudioMixerCras());
+#else
+ g_audio_handler = new AudioHandler(new AudioMixerAlsa());
+#endif
}
// static
@@ -53,6 +57,12 @@ void AudioHandler::Shutdown() {
}
// static
+void AudioHandler::InitializeForTesting(AudioMixer* mixer) {
+ CHECK(!g_audio_handler);
+ g_audio_handler = new AudioHandler(mixer);
+}
+
+// static
AudioHandler* AudioHandler::GetInstance() {
VLOG_IF(1, !g_audio_handler)
<< "AudioHandler::GetInstance() called with NULL global instance.";
@@ -113,12 +123,8 @@ void AudioHandler::RemoveVolumeObserver(VolumeObserver* observer) {
volume_observers_.RemoveObserver(observer);
}
-AudioHandler::AudioHandler()
-#if defined(USE_CRAS)
- : mixer_(new AudioMixerCras()),
-#else
- : mixer_(new AudioMixerAlsa()),
-#endif
+AudioHandler::AudioHandler(AudioMixer* mixer)
+ : mixer_(mixer),
prefs_(g_browser_process->local_state()) {
mixer_->SetVolumePercent(prefs_->GetDouble(prefs::kAudioVolumePercent));
mixer_->SetMuted(prefs_->GetInteger(prefs::kAudioMute) == kPrefMuteOn);
« no previous file with comments | « chrome/browser/chromeos/audio/audio_handler.h ('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