Bug 1686668 [wpt PR 27185] - Update wpt metadata, a=testonly
[gecko.git] / dom / permission / Permissions.h
blob7642f6c0f5338e403bdfccfe62973a6607eda556
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/. */
7 #ifndef mozilla_dom_Permissions_h_
8 #define mozilla_dom_Permissions_h_
10 #include "nsISupports.h"
11 #include "nsPIDOMWindow.h"
12 #include "nsWrapperCache.h"
14 namespace mozilla {
16 class ErrorResult;
18 namespace dom {
20 class Promise;
22 class Permissions final : public nsISupports, public nsWrapperCache {
23 public:
24 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
25 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Permissions)
27 explicit Permissions(nsPIDOMWindowInner* aWindow);
29 nsPIDOMWindowInner* GetParentObject() const { return mWindow; }
31 JSObject* WrapObject(JSContext* aCx,
32 JS::Handle<JSObject*> aGivenProto) override;
34 already_AddRefed<Promise> Query(JSContext* aCx,
35 JS::Handle<JSObject*> aPermission,
36 ErrorResult& aRv);
38 static nsresult RemovePermission(nsIPrincipal* aPrincipal,
39 const nsACString& aPermissionType);
41 already_AddRefed<Promise> Revoke(JSContext* aCx,
42 JS::Handle<JSObject*> aPermission,
43 ErrorResult& aRv);
45 private:
46 ~Permissions();
48 nsCOMPtr<nsPIDOMWindowInner> mWindow;
51 } // namespace dom
52 } // namespace mozilla
54 #endif // mozilla_dom_permissions_h_