MediaDeviceInfo.h (1573B)
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_MediaDeviceInfo_h 6 #define mozilla_dom_MediaDeviceInfo_h 7 8 #include "js/RootingAPI.h" 9 #include "mozilla/dom/MediaDeviceInfoBinding.h" 10 #include "nsCycleCollectionParticipant.h" 11 #include "nsID.h" 12 #include "nsISupports.h" 13 #include "nsStringFwd.h" 14 #include "nsWrapperCache.h" 15 16 namespace mozilla::dom { 17 18 #define MOZILLA_DOM_MEDIADEVICEINFO_IMPLEMENTATION_IID \ 19 {0x25091870, 0x84d6, 0x4acf, {0xaf, 0x97, 0x6e, 0xd5, 0x5b, 0xe0, 0x47, 0xb2}} 20 21 class MediaDeviceInfo final : public nsISupports, public nsWrapperCache { 22 public: 23 explicit MediaDeviceInfo(const nsAString& aDeviceId, MediaDeviceKind aKind, 24 const nsAString& aLabel, const nsAString& aGroupId); 25 26 NS_DECL_CYCLE_COLLECTING_ISUPPORTS 27 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(MediaDeviceInfo) 28 NS_INLINE_DECL_STATIC_IID(MOZILLA_DOM_MEDIADEVICEINFO_IMPLEMENTATION_IID) 29 30 JSObject* WrapObject(JSContext* cx, 31 JS::Handle<JSObject*> aGivenProto) override; 32 33 nsISupports* GetParentObject(); 34 35 void GetDeviceId(nsString& retval); 36 MediaDeviceKind Kind(); 37 void GetLabel(nsString& retval); 38 void GetGroupId(nsString& retval); 39 40 private: 41 MediaDeviceKind mKind; 42 nsString mDeviceId; 43 nsString mLabel; 44 nsString mGroupId; 45 46 virtual ~MediaDeviceInfo() = default; 47 }; 48 49 } // namespace mozilla::dom 50 51 #endif // mozilla_dom_MediaDeviceInfo_h