Automated Commit: Committing new LKGM version 6953.0.0 for chromeos.
[chromium-blink-merge.git] / chromeos / audio / audio_devices_pref_handler.h
blobdfa582e4e57de1bcb6e7e4e88876acefd892456a
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
3 // found in the LICENSE file.
5 #ifndef CHROMEOS_AUDIO_AUDIO_DEVICES_PREF_HANDLER_H_
6 #define CHROMEOS_AUDIO_AUDIO_DEVICES_PREF_HANDLER_H_
8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h"
10 #include "chromeos/audio/audio_pref_observer.h"
11 #include "chromeos/chromeos_export.h"
13 class PrefService;
15 namespace chromeos {
17 struct AudioDevice;
19 // Interface that handles audio preference related work, reads and writes
20 // audio preferences, and notifies AudioPrefObserver for audio preference
21 // changes.
22 class CHROMEOS_EXPORT AudioDevicesPrefHandler
23 : public base::RefCountedThreadSafe<AudioDevicesPrefHandler> {
24 public:
25 // Integer because C++ does not allow static const double in header files.
26 static const int kDefaultOutputVolumePercent = 75;
27 static const int kDefaultHdmiOutputVolumePercent = 100;
29 // Gets the audio output volume value from prefs for a device. Since we can
30 // only have either a gain or a volume for a device (depending on whether it
31 // is input or output), we don't really care which value it is.
32 virtual double GetOutputVolumeValue(const AudioDevice* device) = 0;
33 virtual double GetInputGainValue(const AudioDevice* device) = 0;
34 // Sets the audio volume or gain value to prefs for a device.
35 virtual void SetVolumeGainValue(const AudioDevice& device, double value) = 0;
37 // Reads the audio mute value from prefs for a device.
38 virtual bool GetMuteValue(const AudioDevice& device) = 0;
39 // Sets the audio mute value to prefs for a device.
40 virtual void SetMuteValue(const AudioDevice& device, bool mute_on) = 0;
42 // Reads the audio output allowed value from prefs.
43 virtual bool GetAudioOutputAllowedValue() = 0;
45 // Adds an audio preference observer.
46 virtual void AddAudioPrefObserver(AudioPrefObserver* observer) = 0;
47 // Removes an audio preference observer.
48 virtual void RemoveAudioPrefObserver(AudioPrefObserver* observer) = 0;
50 protected:
51 virtual ~AudioDevicesPrefHandler() {}
53 private:
54 friend class base::RefCountedThreadSafe<AudioDevicesPrefHandler>;
57 } // namespace chromeos
59 #endif // CHROMEOS_AUDIO_AUDIO_DEVICES_PREF_HANDLER_H_