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"
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
29 void Init(nsPIDOMWindow
* aWindow
);
31 nsPIDOMWindow
* GetParentObject() const;
33 virtual JSObject
* WrapObject(JSContext
* aCx
) MOZ_OVERRIDE
;
37 // Get this api's force speaker setting.
39 // Force acoustic sound go through speaker. Don't force to speaker if application
40 // stay in the background and re-force when application
42 void SetForcespeaker(bool aEnable
);
43 // Get the device's speaker forced setting.
46 void SetAudioChannelActive(bool aIsActive
);
47 IMPL_EVENT_HANDLER(speakerforcedchange
)
49 static already_AddRefed
<SpeakerManager
>
50 Constructor(const GlobalObject
& aGlobal
, ErrorResult
& aRv
);
55 void DispatchSimpleEvent(const nsAString
& aStr
);
56 // This api's force speaker setting
62 } // namespace mozilla
64 #endif // mozilla_dom_SpeakerManager_h