/work/obj-fuzz/dist/include/mozilla/dom/MediaDevices.h
Line | Count | Source (jump to first uncovered line) |
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 | | #ifndef mozilla_dom_MediaDevices_h |
6 | | #define mozilla_dom_MediaDevices_h |
7 | | |
8 | | #include "mozilla/ErrorResult.h" |
9 | | #include "nsISupportsImpl.h" |
10 | | #include "mozilla/DOMEventTargetHelper.h" |
11 | | #include "mozilla/dom/BindingUtils.h" |
12 | | #include "nsPIDOMWindow.h" |
13 | | #include "mozilla/media/DeviceChangeCallback.h" |
14 | | |
15 | | namespace mozilla { |
16 | | namespace dom { |
17 | | |
18 | | class Promise; |
19 | | struct MediaStreamConstraints; |
20 | | struct MediaTrackSupportedConstraints; |
21 | | |
22 | | #define MOZILLA_DOM_MEDIADEVICES_IMPLEMENTATION_IID \ |
23 | | { 0x2f784d8a, 0x7485, 0x4280, \ |
24 | | { 0x9a, 0x36, 0x74, 0xa4, 0xd6, 0x71, 0xa6, 0xc8 } } |
25 | | |
26 | | class MediaDevices final : public DOMEventTargetHelper |
27 | | ,public DeviceChangeCallback |
28 | | { |
29 | | public: |
30 | | explicit MediaDevices(nsPIDOMWindowInner* aWindow) : |
31 | 0 | DOMEventTargetHelper(aWindow) {} |
32 | | |
33 | | NS_DECL_ISUPPORTS_INHERITED |
34 | | NS_DECLARE_STATIC_IID_ACCESSOR(MOZILLA_DOM_MEDIADEVICES_IMPLEMENTATION_IID) |
35 | | |
36 | | JSObject* WrapObject(JSContext* cx, JS::Handle<JSObject*> aGivenProto) override; |
37 | | |
38 | | // No code needed, as MediaTrackSupportedConstraints members default to true. |
39 | 0 | void GetSupportedConstraints(MediaTrackSupportedConstraints& aResult) {}; |
40 | | |
41 | | already_AddRefed<Promise> |
42 | | GetUserMedia(const MediaStreamConstraints& aConstraints, |
43 | | CallerType aCallerType, ErrorResult &aRv); |
44 | | |
45 | | already_AddRefed<Promise> |
46 | | EnumerateDevices(CallerType aCallerType, ErrorResult &aRv); |
47 | | |
48 | | virtual void OnDeviceChange() override; |
49 | | |
50 | | mozilla::dom::EventHandlerNonNull* GetOndevicechange(); |
51 | | |
52 | | void SetOndevicechange(mozilla::dom::EventHandlerNonNull* aCallback); |
53 | | |
54 | | void EventListenerAdded(nsAtom* aType) override; |
55 | | using DOMEventTargetHelper::EventListenerAdded; |
56 | | |
57 | | private: |
58 | | class GumResolver; |
59 | | class EnumDevResolver; |
60 | | class GumRejecter; |
61 | | |
62 | | virtual ~MediaDevices(); |
63 | | nsCOMPtr<nsITimer> mFuzzTimer; |
64 | | }; |
65 | | |
66 | | NS_DEFINE_STATIC_IID_ACCESSOR(MediaDevices, |
67 | | MOZILLA_DOM_MEDIADEVICES_IMPLEMENTATION_IID) |
68 | | |
69 | | } // namespace dom |
70 | | } // namespace mozilla |
71 | | |
72 | | #endif // mozilla_dom_MediaDevices_h |