Line data Source code
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 : #include "mozilla/dom/MediaStreamBinding.h"
7 : #include "mozilla/MediaManager.h"
8 : #include "nsIScriptGlobalObject.h"
9 :
10 : namespace mozilla {
11 : namespace dom {
12 :
13 0 : MediaDeviceInfo::MediaDeviceInfo(const nsAString& aDeviceId,
14 : MediaDeviceKind aKind,
15 : const nsAString& aLabel,
16 0 : const nsAString& aGroupId)
17 : : mKind(aKind)
18 : , mDeviceId(aDeviceId)
19 : , mLabel(aLabel)
20 0 : , mGroupId(aGroupId) {}
21 :
22 0 : NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(MediaDeviceInfo)
23 0 : NS_IMPL_CYCLE_COLLECTING_ADDREF(MediaDeviceInfo)
24 0 : NS_IMPL_CYCLE_COLLECTING_RELEASE(MediaDeviceInfo)
25 0 : NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(MediaDeviceInfo)
26 0 : NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
27 0 : NS_INTERFACE_MAP_ENTRY(nsISupports)
28 0 : NS_INTERFACE_MAP_END
29 :
30 : JSObject*
31 0 : MediaDeviceInfo::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
32 : {
33 0 : return MediaDeviceInfoBinding::Wrap(aCx, this, aGivenProto);
34 : }
35 :
36 0 : nsISupports* MediaDeviceInfo::GetParentObject()
37 : {
38 0 : return nullptr;
39 : }
40 :
41 0 : void MediaDeviceInfo::GetDeviceId(nsString& retval)
42 : {
43 0 : retval = mDeviceId;
44 0 : }
45 :
46 : MediaDeviceKind
47 0 : MediaDeviceInfo::Kind()
48 : {
49 0 : return mKind;
50 : }
51 :
52 0 : void MediaDeviceInfo::GetGroupId(nsString& retval)
53 : {
54 0 : retval = mGroupId;
55 0 : }
56 :
57 0 : void MediaDeviceInfo::GetLabel(nsString& retval)
58 : {
59 0 : retval = mLabel;
60 0 : }
61 :
62 : MediaDeviceKind Kind();
63 : void GetLabel(nsString& retval);
64 : void GetGroupId(nsString& retval);
65 :
66 : } // namespace dom
67 9 : } // namespace mozilla
|