Permissions.h (1612B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 5 * You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef mozilla_dom_Permissions_h_ 8 #define mozilla_dom_Permissions_h_ 9 10 #include "mozilla/GlobalTeardownObserver.h" 11 #include "nsISupports.h" 12 #include "nsWrapperCache.h" 13 14 class nsIGlobalObject; 15 16 namespace mozilla { 17 18 class ErrorResult; 19 20 namespace dom { 21 22 class Promise; 23 class PermissionStatus; 24 struct PermissionSetParameters; 25 26 class Permissions final : public GlobalTeardownObserver, public nsWrapperCache { 27 public: 28 NS_DECL_CYCLE_COLLECTING_ISUPPORTS 29 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(Permissions) 30 31 explicit Permissions(nsIGlobalObject* aGlobal); 32 33 nsIGlobalObject* GetParentObject() const { return GetOwnerGlobal(); } 34 35 JSObject* WrapObject(JSContext* aCx, 36 JS::Handle<JSObject*> aGivenProto) override; 37 38 already_AddRefed<Promise> Query(JSContext* aCx, 39 JS::Handle<JSObject*> aPermission, 40 ErrorResult& aRv); 41 42 // The IDL conversion steps of 43 // https://w3c.github.io/permissions/#webdriver-command-set-permission 44 already_AddRefed<PermissionStatus> ParseSetParameters( 45 JSContext* aCx, const PermissionSetParameters& aParameters, 46 ErrorResult& aRv); 47 48 private: 49 ~Permissions(); 50 }; 51 52 } // namespace dom 53 } // namespace mozilla 54 55 #endif // mozilla_dom_permissions_h_