dom/speakermanager/SpeakerManagerService.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
michael@0 2 /* vim: set ts=2 et sw=2 tw=80: */
michael@0 3 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
michael@0 5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #ifndef mozilla_dom_SpeakerManagerService_h__
michael@0 8 #define mozilla_dom_SpeakerManagerService_h__
michael@0 9
michael@0 10 #include "nsAutoPtr.h"
michael@0 11 #include "nsIObserver.h"
michael@0 12 #include "nsTArray.h"
michael@0 13 #include "SpeakerManager.h"
michael@0 14 #include "nsIAudioManager.h"
michael@0 15 #include "nsCheapSets.h"
michael@0 16 #include "nsHashKeys.h"
michael@0 17
michael@0 18 namespace mozilla {
michael@0 19 namespace dom {
michael@0 20
michael@0 21 class SpeakerManagerService : public nsIObserver
michael@0 22 {
michael@0 23 public:
michael@0 24 NS_DECL_ISUPPORTS
michael@0 25 NS_DECL_NSIOBSERVER
michael@0 26
michael@0 27 static SpeakerManagerService* GetSpeakerManagerService();
michael@0 28 virtual void ForceSpeaker(bool aEnable, bool aVisible);
michael@0 29 virtual bool GetSpeakerStatus();
michael@0 30 virtual void SetAudioChannelActive(bool aIsActive);
michael@0 31 // Called by child
michael@0 32 void ForceSpeaker(bool enable, uint64_t aChildid);
michael@0 33 // Register the SpeakerManager to service for notify the speakerforcedchange event
michael@0 34 void RegisterSpeakerManager(SpeakerManager* aSpeakerManager)
michael@0 35 {
michael@0 36 mRegisteredSpeakerManagers.AppendElement(aSpeakerManager);
michael@0 37 }
michael@0 38 void UnRegisterSpeakerManager(SpeakerManager* aSpeakerManager)
michael@0 39 {
michael@0 40 mRegisteredSpeakerManagers.RemoveElement(aSpeakerManager);
michael@0 41 }
michael@0 42 /**
michael@0 43 * Shutdown the singleton.
michael@0 44 */
michael@0 45 static void Shutdown();
michael@0 46
michael@0 47 protected:
michael@0 48 SpeakerManagerService();
michael@0 49
michael@0 50 virtual ~SpeakerManagerService();
michael@0 51 // Notify to UA if device speaker status changed
michael@0 52 virtual void Notify();
michael@0 53
michael@0 54 void TuruOnSpeaker(bool aEnable);
michael@0 55
michael@0 56 nsTArray<nsRefPtr<SpeakerManager> > mRegisteredSpeakerManagers;
michael@0 57 // Set for remember all the child speaker status
michael@0 58 nsCheapSet<nsUint64HashKey> mSpeakerStatusSet;
michael@0 59 // The Speaker status assign by UA
michael@0 60 bool mOrgSpeakerStatus;
michael@0 61
michael@0 62 bool mVisible;
michael@0 63 // This is needed for IPC communication between
michael@0 64 // SpeakerManagerServiceChild and this class.
michael@0 65 friend class ContentParent;
michael@0 66 friend class ContentChild;
michael@0 67 };
michael@0 68
michael@0 69 } // namespace dom
michael@0 70 } // namespace mozilla
michael@0 71
michael@0 72 #endif

mercurial