Chromium Code Reviews| Index: chrome/browser/chromeos/audio/audio_handler.h |
| diff --git a/chrome/browser/chromeos/audio/audio_handler.h b/chrome/browser/chromeos/audio/audio_handler.h |
| index a66ea4d104e39385ebd036003cee3e60811c36f5..08d5d49b545b68ccb88f348abed4dfa6a3afd284 100644 |
| --- a/chrome/browser/chromeos/audio/audio_handler.h |
| +++ b/chrome/browser/chromeos/audio/audio_handler.h |
| @@ -9,16 +9,22 @@ |
| #include "base/observer_list.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "base/threading/thread.h" |
| +#include "chrome/browser/api/prefs/pref_change_registrar.h" |
| +#include "content/public/browser/notification_details.h" |
| +#include "content/public/browser/notification_observer.h" |
| +#include "content/public/browser/notification_registrar.h" |
| +#include "content/public/browser/notification_source.h" |
| template <typename T> struct DefaultSingletonTraits; |
| +class PrefChangeRegistrar; |
| class PrefService; |
| namespace chromeos { |
| class AudioMixer; |
| -class AudioHandler { |
| +class AudioHandler : content::NotificationObserver { |
| public: |
| class VolumeObserver { |
| public: |
| @@ -42,6 +48,10 @@ class AudioHandler { |
| // Registers volume and mute preferences. |
| static void RegisterPrefs(PrefService* local_state); |
|
Mattias Nissler (ping if slow)
2012/08/28 12:24:24
Rename to disambiguate?
pastarmovj
2012/08/28 15:11:50
Done.
|
| + static void RegisterUserPrefs(PrefService* user_prefs); |
| + |
| + // Initializes the observers for the policy prefs. |
| + void InitializePrefObservers(PrefService* user_prefs); |
| // Gets volume level in our internal 0-100% range, 0 being pure silence. |
| double GetVolumePercent(); |
| @@ -58,9 +68,20 @@ class AudioHandler { |
| // Mutes or unmutes all audio. |
| void SetMuted(bool do_mute); |
| + // Is the mic volume currently muted? |
| + bool IsMicMuted(); |
| + |
| + // Mutes or unmutes all mics. |
| + void SetMicMuted(bool do_mute); |
| + |
| void AddVolumeObserver(VolumeObserver* observer); |
| void RemoveVolumeObserver(VolumeObserver* observer); |
| + // Overridden from content::NotificationObserver: |
| + virtual void Observe(int type, |
| + const content::NotificationSource& source, |
| + const content::NotificationDetails& details) OVERRIDE; |
| + |
| private: |
| // Defines the delete on exit Singleton traits we like. Best to have this |
| // and constructor/destructor private as recommended for Singletons. |
| @@ -70,11 +91,19 @@ class AudioHandler { |
| explicit AudioHandler(AudioMixer* mixer); |
| virtual ~AudioHandler(); |
| + // Applies the audio muting policies whenever the user logs in or policy |
| + // change notification is received. |
| + void ApplyAudioPolicy(); |
| + |
| scoped_ptr<AudioMixer> mixer_; |
| ObserverList<VolumeObserver> volume_observers_; |
| - PrefService* prefs_; // not owned |
| + PrefService* local_state_; // not owned |
| + PrefService* user_prefs_; |
| + |
| + PrefChangeRegistrar pref_change_registrar_; |
| + content::NotificationRegistrar registrar_; |
| DISALLOW_COPY_AND_ASSIGN(AudioHandler); |
| }; |