author Mike Hommey <>
Thu, 26 Mar 2015 12:07:17 +0900
changeset 258314 fc1e894eec2fbd34b745cd94f505080427d24705
parent 222202 ac8948dcc1efab68f39b19e6ebc15d5085a2e7e1
child 263494 48e7d4065ae2b31a87f3827545d179b766a6da7e
permissions -rw-r--r--
Bug 1147207 - Add a ComposedFinder class that acts like a FileFinder proxy over multiple FileFinders. r=gps, a=sledru

/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at */

#ifndef mozilla_dom_SpeakerManagerService_h__
#define mozilla_dom_SpeakerManagerService_h__

#include "nsAutoPtr.h"
#include "nsIObserver.h"
#include "nsTArray.h"
#include "SpeakerManager.h"
#include "nsIAudioManager.h"
#include "nsCheapSets.h"
#include "nsHashKeys.h"

namespace mozilla {
namespace dom {

class SpeakerManagerService : public nsIObserver
   * Return null or instance which has been created.
  static SpeakerManagerService* GetSpeakerManagerService();
   * Return SpeakerManagerService instance.
   * If SpeakerManagerService is not exist, create and return new one.
  static SpeakerManagerService* GetOrCreateSpeakerManagerService();
  virtual void ForceSpeaker(bool aEnable, bool aVisible);
  virtual bool GetSpeakerStatus();
  virtual void SetAudioChannelActive(bool aIsActive);
  // Called by child
  void ForceSpeaker(bool enable, uint64_t aChildid);
  // Register the SpeakerManager to service for notify the speakerforcedchange event
  void RegisterSpeakerManager(SpeakerManager* aSpeakerManager)
  void UnRegisterSpeakerManager(SpeakerManager* aSpeakerManager)
   * Shutdown the singleton.
  static void Shutdown();


  virtual ~SpeakerManagerService();
  // Notify to UA if device speaker status changed
  virtual void Notify();

  void TuruOnSpeaker(bool aEnable);

  nsTArray<nsRefPtr<SpeakerManager> > mRegisteredSpeakerManagers;
  // Set for remember all the child speaker status
  nsCheapSet<nsUint64HashKey> mSpeakerStatusSet;
  // The Speaker status assign by UA
  bool mOrgSpeakerStatus;

  bool mVisible;
  // This is needed for IPC communication between
  // SpeakerManagerServiceChild and this class.
  friend class ContentParent;
  friend class ContentChild;

} // namespace dom
} // namespace mozilla