| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chromeos/audio/audio_devices_pref_handler_impl.h" | 5 #include "chromeos/audio/audio_devices_pref_handler_impl.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 } | 237 } |
| 238 | 238 |
| 239 void AudioDevicesPrefHandlerImpl::MigrateDeviceVolumeSettings( | 239 void AudioDevicesPrefHandlerImpl::MigrateDeviceVolumeSettings( |
| 240 const std::string& active_device) { | 240 const std::string& active_device) { |
| 241 double old_volume = local_state_->GetDouble(prefs::kAudioVolumePercent); | 241 double old_volume = local_state_->GetDouble(prefs::kAudioVolumePercent); |
| 242 device_volume_settings_->SetDouble(active_device, old_volume); | 242 device_volume_settings_->SetDouble(active_device, old_volume); |
| 243 SaveDevicesVolumePref(); | 243 SaveDevicesVolumePref(); |
| 244 } | 244 } |
| 245 | 245 |
| 246 void AudioDevicesPrefHandlerImpl::NotifyAudioPolicyChange() { | 246 void AudioDevicesPrefHandlerImpl::NotifyAudioPolicyChange() { |
| 247 FOR_EACH_OBSERVER(AudioPrefObserver, | 247 for (auto& observer : observers_) |
| 248 observers_, | 248 observer.OnAudioPolicyPrefChanged(); |
| 249 OnAudioPolicyPrefChanged()); | |
| 250 } | 249 } |
| 251 | 250 |
| 252 // static | 251 // static |
| 253 void AudioDevicesPrefHandlerImpl::RegisterPrefs(PrefRegistrySimple* registry) { | 252 void AudioDevicesPrefHandlerImpl::RegisterPrefs(PrefRegistrySimple* registry) { |
| 254 registry->RegisterDictionaryPref(prefs::kAudioDevicesVolumePercent); | 253 registry->RegisterDictionaryPref(prefs::kAudioDevicesVolumePercent); |
| 255 registry->RegisterDictionaryPref(prefs::kAudioDevicesMute); | 254 registry->RegisterDictionaryPref(prefs::kAudioDevicesMute); |
| 256 registry->RegisterDictionaryPref(prefs::kAudioDevicesState); | 255 registry->RegisterDictionaryPref(prefs::kAudioDevicesState); |
| 257 | 256 |
| 258 // Register the prefs backing the audio muting policies. | 257 // Register the prefs backing the audio muting policies. |
| 259 // Policy for audio input is handled by kAudioCaptureAllowed in the Chrome | 258 // Policy for audio input is handled by kAudioCaptureAllowed in the Chrome |
| 260 // media system. | 259 // media system. |
| 261 registry->RegisterBooleanPref(prefs::kAudioOutputAllowed, true); | 260 registry->RegisterBooleanPref(prefs::kAudioOutputAllowed, true); |
| 262 | 261 |
| 263 // Register the legacy audio prefs for migration. | 262 // Register the legacy audio prefs for migration. |
| 264 registry->RegisterDoublePref(prefs::kAudioVolumePercent, | 263 registry->RegisterDoublePref(prefs::kAudioVolumePercent, |
| 265 kDefaultOutputVolumePercent); | 264 kDefaultOutputVolumePercent); |
| 266 registry->RegisterIntegerPref(prefs::kAudioMute, kPrefMuteOff); | 265 registry->RegisterIntegerPref(prefs::kAudioMute, kPrefMuteOff); |
| 267 } | 266 } |
| 268 | 267 |
| 269 } // namespace chromeos | 268 } // namespace chromeos |
| OLD | NEW |