| 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 CHROMEOS_AUDIO_AUDIO_DEVICES_PREF_HANDLER_H_ | 5 #ifndef CHROMEOS_AUDIO_AUDIO_DEVICES_PREF_HANDLER_H_ |
| 6 #define CHROMEOS_AUDIO_AUDIO_DEVICES_PREF_HANDLER_H_ | 6 #define CHROMEOS_AUDIO_AUDIO_DEVICES_PREF_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "chromeos/audio/audio_pref_observer.h" | 10 #include "chromeos/audio/audio_pref_observer.h" |
| 11 #include "chromeos/chromeos_export.h" | 11 #include "chromeos/chromeos_export.h" |
| 12 | 12 |
| 13 class PrefRegistrySimple; | 13 class PrefRegistrySimple; |
| 14 | 14 |
| 15 namespace chromeos { | 15 namespace chromeos { |
| 16 | 16 |
| 17 // Interface that handles audio preference related work, reads and writes | 17 // Interface that handles audio preference related work, reads and writes |
| 18 // audio preferences, and notifies AudioPrefObserver for audio preference | 18 // audio preferences, and notifies AudioPrefObserver for audio preference |
| 19 // changes. | 19 // changes. |
| 20 class CHROMEOS_EXPORT AudioDevicesPrefHandler | 20 class CHROMEOS_EXPORT AudioDevicesPrefHandler |
| 21 : public base::RefCountedThreadSafe<AudioDevicesPrefHandler> { | 21 : public base::RefCountedThreadSafe<AudioDevicesPrefHandler> { |
| 22 public: | 22 public: |
| 23 // Gets the audio output volume value from prefs for a device. Since we can | 23 // Gets the audio output volume value from prefs for the active device. |
| 24 // only have either a gain or a volume for a device (depending on whether it | 24 virtual double GetOutputVolumeValue() = 0; |
| 25 // is input or output), we don't really care which value it is. | 25 // Reads the audio output mute value from prefs for the active device. |
| 26 virtual double GetVolumeGainValue(uint64 device_id) = 0; | 26 virtual bool GetOutputMuteValue() = 0; |
| 27 // Sets the audio volume or gain value to prefs for a device. | |
| 28 virtual void SetVolumeGainValue(uint64 device_id, double value) = 0; | |
| 29 | 27 |
| 30 // Reads the audio mute value from prefs for a device. | 28 // Sets the output audio volume value to prefs for the active device. |
| 31 virtual bool GetMuteValue(uint64 device_id) = 0; | 29 virtual void SetOutputVolumeValue(double volume_percent) = 0; |
| 32 // Sets the audio mute value to prefs for a device. | 30 // Sets the audio output mute value to prefs for the active device. |
| 33 virtual void SetMuteValue(uint64 device_id, bool mute_on) = 0; | 31 virtual void SetOutputMuteValue(bool mute_on) = 0; |
| 34 | 32 |
| 35 // Reads the audio capture allowed value from prefs. | 33 // Reads the audio capture allowed value from prefs. |
| 36 virtual bool GetAudioCaptureAllowedValue() = 0; | 34 virtual bool GetAudioCaptureAllowedValue() = 0; |
| 37 // Reads the audio output allowed value from prefs. | 35 // Reads the audio output allowed value from prefs. |
| 38 virtual bool GetAudioOutputAllowedValue() = 0; | 36 virtual bool GetAudioOutputAllowedValue() = 0; |
| 39 | 37 |
| 40 // Adds an audio preference observer. | 38 // Adds an audio preference observer. |
| 41 virtual void AddAudioPrefObserver(AudioPrefObserver* observer) = 0; | 39 virtual void AddAudioPrefObserver(AudioPrefObserver* observer) = 0; |
| 42 // Removes an audio preference observer. | 40 // Removes an audio preference observer. |
| 43 virtual void RemoveAudioPrefObserver(AudioPrefObserver* observer) = 0; | 41 virtual void RemoveAudioPrefObserver(AudioPrefObserver* observer) = 0; |
| 44 | 42 |
| 45 // Creates the instance. | 43 // Creates the instance. |
| 46 static AudioDevicesPrefHandler* Create(PrefService* local_state); | 44 static AudioDevicesPrefHandler* Create(PrefService* local_state); |
| 47 | 45 |
| 48 protected: | 46 protected: |
| 49 virtual ~AudioDevicesPrefHandler() {} | 47 virtual ~AudioDevicesPrefHandler() {} |
| 50 | 48 |
| 51 private: | 49 private: |
| 52 friend class base::RefCountedThreadSafe<AudioDevicesPrefHandler>; | 50 friend class base::RefCountedThreadSafe<AudioDevicesPrefHandler>; |
| 53 }; | 51 }; |
| 54 | 52 |
| 55 } // namespace chromeos | 53 } // namespace chromeos |
| 56 | 54 |
| 57 #endif // CHROMEOS_AUDIO_AUDIO_DEVICES_PREF_HANDLER_H_ | 55 #endif // CHROMEOS_AUDIO_AUDIO_DEVICES_PREF_HANDLER_H_ |
| OLD | NEW |