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.

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

mercurial