Bumping manifests a=b2g-bump
[gecko.git] / dom / speakermanager / SpeakerManager.h
blobb9c687003d3e125818c80c3a5e24744c66ab520e
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef mozilla_dom_SpeakerManager_h
6 #define mozilla_dom_SpeakerManager_h
8 #include "mozilla/DOMEventTargetHelper.h"
9 #include "mozilla/dom/MozSpeakerManagerBinding.h"
11 namespace mozilla {
12 namespace dom {
13 /* This class is used for UA to control devices's speaker status.
14 * After UA set the speaker status, the UA should handle the
15 * forcespeakerchange event and change the speaker status in UI.
16 * The device's speaker status would set back to normal when UA close the application.
18 class SpeakerManager MOZ_FINAL
19 : public DOMEventTargetHelper
20 , public nsIDOMEventListener
22 friend class SpeakerManagerService;
23 friend class SpeakerManagerServiceChild;
25 NS_DECL_ISUPPORTS_INHERITED
26 NS_DECL_NSIDOMEVENTLISTENER
28 public:
29 void Init(nsPIDOMWindow* aWindow);
31 nsPIDOMWindow* GetParentObject() const;
33 virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
34 /**
35 * WebIDL Interface
37 // Get this api's force speaker setting.
38 bool Forcespeaker();
39 // Force acoustic sound go through speaker. Don't force to speaker if application
40 // stay in the background and re-force when application
41 // go to foreground
42 void SetForcespeaker(bool aEnable);
43 // Get the device's speaker forced setting.
44 bool Speakerforced();
46 void SetAudioChannelActive(bool aIsActive);
47 IMPL_EVENT_HANDLER(speakerforcedchange)
49 static already_AddRefed<SpeakerManager>
50 Constructor(const GlobalObject& aGlobal, ErrorResult& aRv);
52 protected:
53 SpeakerManager();
54 ~SpeakerManager();
55 void DispatchSimpleEvent(const nsAString& aStr);
56 // This api's force speaker setting
57 bool mForcespeaker;
58 bool mVisible;
61 } // namespace dom
62 } // namespace mozilla
64 #endif // mozilla_dom_SpeakerManager_h