Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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.
17 */
18 class SpeakerManager MOZ_FINAL
19 : public DOMEventTargetHelper
20 , public nsIDOMEventListener
21 {
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
36 */
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;
59 };
61 } // namespace dom
62 } // namespace mozilla
64 #endif // mozilla_dom_SpeakerManager_h