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

Side by Side Diff: chrome/browser/chromeos/audio/audio_handler.cc

Issue 9768007: ChromeOS mixer: Talk to new ChromeOS audio server. (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 | chrome/browser/chromeos/audio/audio_mixer_cras.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 (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"
11 #include "base/memory/singleton.h" 11 #include "base/memory/singleton.h"
12 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
13 #if defined(USE_CRAS)
14 #include "chrome/browser/chromeos/audio/audio_mixer_cras.h"
15 #else
13 #include "chrome/browser/chromeos/audio/audio_mixer_alsa.h" 16 #include "chrome/browser/chromeos/audio/audio_mixer_alsa.h"
17 #endif
14 #include "chrome/browser/prefs/pref_service.h" 18 #include "chrome/browser/prefs/pref_service.h"
15 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
16 #include "content/public/browser/browser_thread.h" 20 #include "content/public/browser/browser_thread.h"
17 21
18 using std::max; 22 using std::max;
19 using std::min; 23 using std::min;
20 24
21 namespace chromeos { 25 namespace chromeos {
22 26
23 namespace { 27 namespace {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 107
104 void AudioHandler::AddVolumeObserver(VolumeObserver* observer) { 108 void AudioHandler::AddVolumeObserver(VolumeObserver* observer) {
105 volume_observers_.AddObserver(observer); 109 volume_observers_.AddObserver(observer);
106 } 110 }
107 111
108 void AudioHandler::RemoveVolumeObserver(VolumeObserver* observer) { 112 void AudioHandler::RemoveVolumeObserver(VolumeObserver* observer) {
109 volume_observers_.RemoveObserver(observer); 113 volume_observers_.RemoveObserver(observer);
110 } 114 }
111 115
112 AudioHandler::AudioHandler() 116 AudioHandler::AudioHandler()
117 #if defined(USE_CRAS)
118 : mixer_(new AudioMixerCras()),
119 #else
113 : mixer_(new AudioMixerAlsa()), 120 : mixer_(new AudioMixerAlsa()),
121 #endif
114 prefs_(g_browser_process->local_state()) { 122 prefs_(g_browser_process->local_state()) {
115 mixer_->SetVolumePercent(prefs_->GetDouble(prefs::kAudioVolumePercent)); 123 mixer_->SetVolumePercent(prefs_->GetDouble(prefs::kAudioVolumePercent));
116 mixer_->SetMuted(prefs_->GetInteger(prefs::kAudioMute) == kPrefMuteOn); 124 mixer_->SetMuted(prefs_->GetInteger(prefs::kAudioMute) == kPrefMuteOn);
117 mixer_->Init(); 125 mixer_->Init();
118 } 126 }
119 127
120 AudioHandler::~AudioHandler() { 128 AudioHandler::~AudioHandler() {
121 mixer_.reset(); 129 mixer_.reset();
122 }; 130 };
123 131
124 } // namespace chromeos 132 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/audio/audio_mixer_cras.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698