MediaDeviceInfo.cpp (1583B)
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/. */ 4 5 #include "mozilla/dom/MediaDeviceInfo.h" 6 7 #include "mozilla/MediaManager.h" 8 #include "mozilla/dom/MediaStreamBinding.h" 9 #include "nsIScriptGlobalObject.h" 10 11 namespace mozilla::dom { 12 13 MediaDeviceInfo::MediaDeviceInfo(const nsAString& aDeviceId, 14 MediaDeviceKind aKind, const nsAString& aLabel, 15 const nsAString& aGroupId) 16 : mKind(aKind), mDeviceId(aDeviceId), mLabel(aLabel), mGroupId(aGroupId) {} 17 18 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(MediaDeviceInfo) 19 NS_IMPL_CYCLE_COLLECTING_ADDREF(MediaDeviceInfo) 20 NS_IMPL_CYCLE_COLLECTING_RELEASE(MediaDeviceInfo) 21 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(MediaDeviceInfo) 22 NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY 23 NS_INTERFACE_MAP_ENTRY(nsISupports) 24 NS_INTERFACE_MAP_END 25 26 JSObject* MediaDeviceInfo::WrapObject(JSContext* aCx, 27 JS::Handle<JSObject*> aGivenProto) { 28 return MediaDeviceInfo_Binding::Wrap(aCx, this, aGivenProto); 29 } 30 31 nsISupports* MediaDeviceInfo::GetParentObject() { return nullptr; } 32 33 void MediaDeviceInfo::GetDeviceId(nsString& retval) { retval = mDeviceId; } 34 35 MediaDeviceKind MediaDeviceInfo::Kind() { return mKind; } 36 37 void MediaDeviceInfo::GetGroupId(nsString& retval) { retval = mGroupId; } 38 39 void MediaDeviceInfo::GetLabel(nsString& retval) { retval = mLabel; } 40 41 MediaDeviceKind Kind(); 42 43 } // namespace mozilla::dom