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

Unified Diff: chrome/browser/chromeos/audio_mixer_alsa.cc

Issue 6410039: Update AudioMixerAlsa to not use PrefMember. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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 | « chrome/browser/chromeos/audio_mixer_alsa.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/audio_mixer_alsa.cc
diff --git a/chrome/browser/chromeos/audio_mixer_alsa.cc b/chrome/browser/chromeos/audio_mixer_alsa.cc
index 5704cac8e33b5efa2d9fda9aa7630f5f02ad7f72..5ed5f7c33231da24faf04eae434aaef94ed232f4 100644
--- a/chrome/browser/chromeos/audio_mixer_alsa.cc
+++ b/chrome/browser/chromeos/audio_mixer_alsa.cc
@@ -47,7 +47,8 @@ AudioMixerAlsa::AudioMixerAlsa()
mixer_state_(UNINITIALIZED),
alsa_mixer_(NULL),
elem_master_(NULL),
- elem_pcm_(NULL) {
+ elem_pcm_(NULL),
+ prefs_(NULL) {
}
AudioMixerAlsa::~AudioMixerAlsa() {
@@ -112,7 +113,7 @@ void AudioMixerAlsa::SetVolumeDb(double vol_db) {
if (vol_db < kSilenceDb)
vol_db = kSilenceDb;
DoSetVolumeDb_Locked(vol_db);
- volume_pref_.SetValue(vol_db);
+ prefs_->SetDouble(prefs::kAudioVolume, vol_db);
}
bool AudioMixerAlsa::IsMute() const {
@@ -154,7 +155,7 @@ void AudioMixerAlsa::SetMute(bool mute) {
SetElementMuted_Locked(elem_master_, mute);
if (elem_pcm_)
SetElementMuted_Locked(elem_pcm_, mute);
- mute_pref_.SetValue(mute ? kPrefMuteOn : kPrefMuteOff);
+ prefs_->SetInteger(prefs::kAudioMute, mute ? kPrefMuteOn : kPrefMuteOff);
}
AudioMixer::State AudioMixerAlsa::GetState() const {
@@ -210,10 +211,7 @@ bool AudioMixerAlsa::InitThread() {
}
void AudioMixerAlsa::InitPrefs() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- PrefService* prefs = g_browser_process->local_state();
- volume_pref_.Init(prefs::kAudioVolume, prefs, NULL);
- mute_pref_.Init(prefs::kAudioMute, prefs, NULL);
+ prefs_ = g_browser_process->local_state();
}
bool AudioMixerAlsa::InitializeAlsaMixer() {
@@ -322,9 +320,10 @@ void AudioMixerAlsa::DoSetVolumeMute(double pref_volume, int pref_mute) {
void AudioMixerAlsa::RestoreVolumeMuteOnUIThread() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
// This happens during init, so set the volume off the UI thread.
+ int mute = prefs_->GetInteger(prefs::kAudioMute);
+ double volume = prefs_->GetDouble(prefs::kAudioVolume);
thread_->message_loop()->PostTask(FROM_HERE,
- NewRunnableMethod(this, &AudioMixerAlsa::DoSetVolumeMute,
- volume_pref_.GetValue(), mute_pref_.GetValue()));
+ NewRunnableMethod(this, &AudioMixerAlsa::DoSetVolumeMute, volume, mute));
}
double AudioMixerAlsa::DoGetVolumeDb_Locked() const {
« no previous file with comments | « chrome/browser/chromeos/audio_mixer_alsa.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698