Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4877)

Unified Diff: chrome/browser/chromeos/audio/audio_handler.h

Issue 10873085: Implement two new policies to control muting the audio I/O. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
};

Powered by Google App Engine
This is Rietveld 408576698