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 #ifndef CHROME_BROWSER_CHROMEOS_AUDIO_AUDIO_DEVICES_PREF_HANDLER_IMPL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_AUDIO_AUDIO_DEVICES_PREF_HANDLER_IMPL_H_ |
6 #define CHROME_BROWSER_CHROMEOS_AUDIO_AUDIO_DEVICES_PREF_HANDLER_IMPL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_AUDIO_AUDIO_DEVICES_PREF_HANDLER_IMPL_H_ |
7 | 7 |
8 #include "base/observer_list.h" | 8 #include "base/observer_list.h" |
9 #include "base/prefs/pref_change_registrar.h" | 9 #include "base/prefs/pref_change_registrar.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "chromeos/audio/audio_devices_pref_handler.h" | 11 #include "chromeos/audio/audio_devices_pref_handler.h" |
12 | 12 |
13 class PrefRegistrySimple; | 13 class PrefRegistrySimple; |
14 class PrefService; | 14 class PrefService; |
15 | 15 |
16 namespace chromeos { | 16 namespace chromeos { |
17 | 17 |
18 // Class which implements AudioDevicesPrefHandler interface and register audio | 18 // Class which implements AudioDevicesPrefHandler interface and register audio |
19 // preferences as well. | 19 // preferences as well. |
20 class AudioDevicesPrefHandlerImpl : public AudioDevicesPrefHandler { | 20 class AudioDevicesPrefHandlerImpl : public AudioDevicesPrefHandler { |
21 public: | 21 public: |
22 explicit AudioDevicesPrefHandlerImpl(PrefService* local_state); | 22 explicit AudioDevicesPrefHandlerImpl(PrefService* local_state); |
23 | 23 |
24 // Overridden from AudioDevicesPrefHandler. | 24 // Overridden from AudioDevicesPrefHandler. |
25 virtual double GetVolumeGainValue(const AudioDevice& device) OVERRIDE; | 25 virtual double GetOutputVolumeValue(const AudioDevice* device) OVERRIDE; |
| 26 virtual double GetInputGainValue(const AudioDevice* device) OVERRIDE; |
26 virtual void SetVolumeGainValue(const AudioDevice& device, | 27 virtual void SetVolumeGainValue(const AudioDevice& device, |
27 double value) OVERRIDE; | 28 double value) OVERRIDE; |
28 | 29 |
29 virtual bool GetMuteValue(const AudioDevice& device) OVERRIDE; | 30 virtual bool GetMuteValue(const AudioDevice& device) OVERRIDE; |
30 virtual void SetMuteValue(const AudioDevice& device, bool mute_on) OVERRIDE; | 31 virtual void SetMuteValue(const AudioDevice& device, bool mute_on) OVERRIDE; |
31 | 32 |
32 virtual bool GetAudioCaptureAllowedValue() OVERRIDE; | 33 virtual bool GetAudioCaptureAllowedValue() OVERRIDE; |
33 virtual bool GetAudioOutputAllowedValue() OVERRIDE; | 34 virtual bool GetAudioOutputAllowedValue() OVERRIDE; |
34 | 35 |
35 virtual void AddAudioPrefObserver(AudioPrefObserver* observer) OVERRIDE; | 36 virtual void AddAudioPrefObserver(AudioPrefObserver* observer) OVERRIDE; |
(...skipping 10 matching lines...) Expand all Loading... |
46 void InitializePrefObservers(); | 47 void InitializePrefObservers(); |
47 | 48 |
48 // Update and save methods for the mute preferences for all devices. | 49 // Update and save methods for the mute preferences for all devices. |
49 void UpdateDevicesMutePref(); | 50 void UpdateDevicesMutePref(); |
50 void SaveDevicesMutePref(); | 51 void SaveDevicesMutePref(); |
51 | 52 |
52 // Update and save methods for the volume preferences for all devices. | 53 // Update and save methods for the volume preferences for all devices. |
53 void UpdateDevicesVolumePref(); | 54 void UpdateDevicesVolumePref(); |
54 void SaveDevicesVolumePref(); | 55 void SaveDevicesVolumePref(); |
55 | 56 |
| 57 double GetVolumeGainPrefValue(const AudioDevice& device); |
| 58 double GetDeviceDefaultOutputVolume(const AudioDevice& device); |
| 59 |
56 // Methods to migrate the mute and volume settings for a device from the | 60 // Methods to migrate the mute and volume settings for a device from the |
57 // previous global pref value to the new per device pref value for the | 61 // previous global pref value to the new per device pref value for the |
58 // current active device. If a previous global setting doesn't exist, we'll | 62 // current active device. If a previous global setting doesn't exist, we'll |
59 // use default values of mute = off and volume = 75%. | 63 // use default values of mute = off and volume = 75%. |
60 void MigrateDeviceMuteSettings(std::string active_device); | 64 void MigrateDeviceMuteSettings(std::string active_device); |
61 void MigrateDeviceVolumeSettings(std::string active_device); | 65 void MigrateDeviceVolumeSettings(std::string active_device); |
62 | 66 |
63 // Notifies the AudioPrefObserver for audio policy pref changes. | 67 // Notifies the AudioPrefObserver for audio policy pref changes. |
64 void NotifyAudioPolicyChange(); | 68 void NotifyAudioPolicyChange(); |
65 | 69 |
66 scoped_ptr<base::DictionaryValue> device_mute_settings_; | 70 scoped_ptr<base::DictionaryValue> device_mute_settings_; |
67 scoped_ptr<base::DictionaryValue> device_volume_settings_; | 71 scoped_ptr<base::DictionaryValue> device_volume_settings_; |
68 | 72 |
69 PrefService* local_state_; // not owned | 73 PrefService* local_state_; // not owned |
70 PrefChangeRegistrar pref_change_registrar_; | 74 PrefChangeRegistrar pref_change_registrar_; |
71 ObserverList<AudioPrefObserver> observers_; | 75 ObserverList<AudioPrefObserver> observers_; |
72 | 76 |
73 DISALLOW_COPY_AND_ASSIGN(AudioDevicesPrefHandlerImpl); | 77 DISALLOW_COPY_AND_ASSIGN(AudioDevicesPrefHandlerImpl); |
74 }; | 78 }; |
75 | 79 |
76 } // namespace chromeos | 80 } // namespace chromeos |
77 | 81 |
78 #endif // CHROME_BROWSER_CHROMEOS_AUDIO_AUDIO_DEVICES_PREF_HANDLER_IMPL_H_ | 82 #endif // CHROME_BROWSER_CHROMEOS_AUDIO_AUDIO_DEVICES_PREF_HANDLER_IMPL_H_ |
OLD | NEW |