Bug 1526591 - Remove devtools.inspector.shapesHighlighter.enabled pref. r=rcaliman
[gecko.git] / dom / media / MediaDevices.h
blobad2da954aaf425c87e17682373cc747c12e6fdfb
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_MediaDevices_h
6 #define mozilla_dom_MediaDevices_h
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"
15 namespace mozilla {
16 namespace dom {
18 class Promise;
19 struct MediaStreamConstraints;
20 struct DisplayMediaStreamConstraints;
21 struct MediaTrackSupportedConstraints;
23 #define MOZILLA_DOM_MEDIADEVICES_IMPLEMENTATION_IID \
24 { \
25 0x2f784d8a, 0x7485, 0x4280, { \
26 0x9a, 0x36, 0x74, 0xa4, 0xd6, 0x71, 0xa6, 0xc8 \
27 } \
30 class MediaDevices final : public DOMEventTargetHelper,
31 public DeviceChangeCallback {
32 public:
33 explicit MediaDevices(nsPIDOMWindowInner* aWindow)
34 : DOMEventTargetHelper(aWindow) {}
36 NS_DECL_ISUPPORTS_INHERITED
37 NS_DECLARE_STATIC_IID_ACCESSOR(MOZILLA_DOM_MEDIADEVICES_IMPLEMENTATION_IID)
39 JSObject* WrapObject(JSContext* cx,
40 JS::Handle<JSObject*> aGivenProto) override;
42 // No code needed, as MediaTrackSupportedConstraints members default to true.
43 void GetSupportedConstraints(MediaTrackSupportedConstraints& aResult){};
45 already_AddRefed<Promise> GetUserMedia(
46 const MediaStreamConstraints& aConstraints, CallerType aCallerType,
47 ErrorResult& aRv);
49 already_AddRefed<Promise> EnumerateDevices(CallerType aCallerType,
50 ErrorResult& aRv);
52 already_AddRefed<Promise> GetDisplayMedia(
53 const DisplayMediaStreamConstraints& aConstraints, CallerType aCallerType,
54 ErrorResult& aRv);
56 virtual void OnDeviceChange() override;
58 mozilla::dom::EventHandlerNonNull* GetOndevicechange();
60 void SetOndevicechange(mozilla::dom::EventHandlerNonNull* aCallback);
62 void EventListenerAdded(nsAtom* aType) override;
63 using DOMEventTargetHelper::EventListenerAdded;
65 private:
66 class GumResolver;
67 class EnumDevResolver;
68 class GumRejecter;
70 virtual ~MediaDevices();
71 nsCOMPtr<nsITimer> mFuzzTimer;
74 NS_DEFINE_STATIC_IID_ACCESSOR(MediaDevices,
75 MOZILLA_DOM_MEDIADEVICES_IMPLEMENTATION_IID)
77 } // namespace dom
78 } // namespace mozilla
80 #endif // mozilla_dom_MediaDevices_h