Bug 1880558: Allow PnP windows to enter macOS native fullscreen. r=pip-reviewers...
[gecko.git] / dom / media / GetUserMediaRequest.h
bloba2b69bf1d646a0eab8296eace6642beac391abd9
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 GetUserMediaRequest_h__
6 #define GetUserMediaRequest_h__
8 #include <cstdint>
9 #include "js/TypeDecls.h"
10 #include "mozilla/Assertions.h"
11 #include "mozilla/UniquePtr.h"
12 #include "nsCycleCollectionParticipant.h"
13 #include "nsISupports.h"
14 #include "nsString.h"
15 #include "nsWrapperCache.h"
17 class nsIMediaDevice;
18 class nsPIDOMWindowInner;
20 namespace mozilla {
22 class LocalMediaDevice;
24 namespace media {
25 template <typename T>
26 class Refcountable;
29 namespace dom {
31 struct AudioOutputOptions;
32 struct MediaStreamConstraints;
33 enum class GetUserMediaRequestType : uint8_t;
35 class GetUserMediaRequest : public nsISupports, public nsWrapperCache {
36 public:
37 using LocalMediaDeviceSetRefCnt =
38 media::Refcountable<nsTArray<RefPtr<LocalMediaDevice>>>;
40 // For getUserMedia "getUserMedia:request"
41 GetUserMediaRequest(nsPIDOMWindowInner* aInnerWindow,
42 const nsAString& aCallID,
43 RefPtr<LocalMediaDeviceSetRefCnt> aMediaDeviceSet,
44 const MediaStreamConstraints& aConstraints,
45 bool aIsSecure, bool aIsHandlingUserInput);
46 // For selectAudioOutput "getUserMedia:request"
47 GetUserMediaRequest(nsPIDOMWindowInner* aInnerWindow,
48 const nsAString& aCallID,
49 RefPtr<LocalMediaDeviceSetRefCnt> aMediaDeviceSet,
50 const AudioOutputOptions& aAudioOutputOptions,
51 bool aIsSecure, bool aIsHandlingUserInput);
52 // For "recording-device-stopped"
53 GetUserMediaRequest(nsPIDOMWindowInner* aInnerWindow, const nsAString& aRawId,
54 const nsAString& aMediaSource, bool aIsHandlingUserInput);
56 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
57 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(GetUserMediaRequest)
59 JSObject* WrapObject(JSContext* cx,
60 JS::Handle<JSObject*> aGivenProto) override;
61 nsISupports* GetParentObject();
63 GetUserMediaRequestType Type();
64 uint64_t WindowID();
65 uint64_t InnerWindowID();
66 bool IsSecure();
67 bool IsHandlingUserInput() const;
68 void GetCallID(nsString& retval);
69 void GetRawID(nsString& retval);
70 void GetMediaSource(nsString& retval);
71 void GetDevices(nsTArray<RefPtr<nsIMediaDevice>>& retval) const;
72 void GetConstraints(MediaStreamConstraints& result);
73 void GetAudioOutputOptions(AudioOutputOptions& result);
75 private:
76 virtual ~GetUserMediaRequest();
78 uint64_t mInnerWindowID, mOuterWindowID;
79 const nsString mCallID;
80 const nsString mRawID;
81 const nsString mMediaSource;
82 const RefPtr<LocalMediaDeviceSetRefCnt> mMediaDeviceSet;
83 UniquePtr<MediaStreamConstraints> mConstraints;
84 UniquePtr<AudioOutputOptions> mAudioOutputOptions;
85 GetUserMediaRequestType mType;
86 bool mIsSecure;
87 bool mIsHandlingUserInput;
90 } // namespace dom
91 } // namespace mozilla
93 #endif // GetUserMediaRequest_h__