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_MediaDeviceInfo_h
6 #define mozilla_dom_MediaDeviceInfo_h
8 #include "js/RootingAPI.h"
9 #include "mozilla/Assertions.h"
10 #include "mozilla/dom/MediaDeviceInfoBinding.h"
11 #include "nsCycleCollectionParticipant.h"
13 #include "nsISupports.h"
14 #include "nsStringFwd.h"
15 #include "nsWrapperCache.h"
17 namespace mozilla::dom
{
19 #define MOZILLA_DOM_MEDIADEVICEINFO_IMPLEMENTATION_IID \
21 0x25091870, 0x84d6, 0x4acf, { \
22 0xaf, 0x97, 0x6e, 0xd5, 0x5b, 0xe0, 0x47, 0xb2 \
26 class MediaDeviceInfo final
: public nsISupports
, public nsWrapperCache
{
28 explicit MediaDeviceInfo(const nsAString
& aDeviceId
, MediaDeviceKind aKind
,
29 const nsAString
& aLabel
, const nsAString
& aGroupId
);
31 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
32 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(MediaDeviceInfo
)
33 NS_DECLARE_STATIC_IID_ACCESSOR(MOZILLA_DOM_MEDIADEVICEINFO_IMPLEMENTATION_IID
)
35 JSObject
* WrapObject(JSContext
* cx
,
36 JS::Handle
<JSObject
*> aGivenProto
) override
;
38 nsISupports
* GetParentObject();
40 void GetDeviceId(nsString
& retval
);
41 MediaDeviceKind
Kind();
42 void GetLabel(nsString
& retval
);
43 void GetGroupId(nsString
& retval
);
46 MediaDeviceKind mKind
;
51 virtual ~MediaDeviceInfo() = default;
54 NS_DEFINE_STATIC_IID_ACCESSOR(MediaDeviceInfo
,
55 MOZILLA_DOM_MEDIADEVICEINFO_IMPLEMENTATION_IID
)
57 } // namespace mozilla::dom
59 #endif // mozilla_dom_MediaDeviceInfo_h