Bug 1839170 - Refactor Snap pulling, Add Firefox Snap Core22 and GNOME 42 SDK symbols...
[gecko.git] / dom / media / MediaDeviceInfo.cpp
blob4183da2865f85983a21af324cf012f682371e77c
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 #include "mozilla/dom/MediaDeviceInfo.h"
6 #include "mozilla/dom/MediaStreamBinding.h"
7 #include "mozilla/MediaManager.h"
8 #include "nsIScriptGlobalObject.h"
10 namespace mozilla::dom {
12 MediaDeviceInfo::MediaDeviceInfo(const nsAString& aDeviceId,
13 MediaDeviceKind aKind, const nsAString& aLabel,
14 const nsAString& aGroupId)
15 : mKind(aKind), mDeviceId(aDeviceId), mLabel(aLabel), mGroupId(aGroupId) {}
17 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(MediaDeviceInfo)
18 NS_IMPL_CYCLE_COLLECTING_ADDREF(MediaDeviceInfo)
19 NS_IMPL_CYCLE_COLLECTING_RELEASE(MediaDeviceInfo)
20 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(MediaDeviceInfo)
21 NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
22 NS_INTERFACE_MAP_ENTRY(nsISupports)
23 NS_INTERFACE_MAP_END
25 JSObject* MediaDeviceInfo::WrapObject(JSContext* aCx,
26 JS::Handle<JSObject*> aGivenProto) {
27 return MediaDeviceInfo_Binding::Wrap(aCx, this, aGivenProto);
30 nsISupports* MediaDeviceInfo::GetParentObject() { return nullptr; }
32 void MediaDeviceInfo::GetDeviceId(nsString& retval) { retval = mDeviceId; }
34 MediaDeviceKind MediaDeviceInfo::Kind() { return mKind; }
36 void MediaDeviceInfo::GetGroupId(nsString& retval) { retval = mGroupId; }
38 void MediaDeviceInfo::GetLabel(nsString& retval) { retval = mLabel; }
40 MediaDeviceKind Kind();
42 } // namespace mozilla::dom