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_PermissionObserver_h_
8 #define mozilla_dom_PermissionObserver_h_
10 #include "mozilla/dom/PermissionsBinding.h"
12 #include "nsIObserver.h"
13 #include "nsIPrincipal.h"
15 #include "nsWeakReference.h"
17 namespace mozilla::dom
{
19 class PermissionStatus
;
21 // Singleton that watches for perm-changed notifications in order to notify
22 // PermissionStatus objects.
23 class PermissionObserver final
: public nsIObserver
,
24 public nsSupportsWeakReference
{
29 static already_AddRefed
<PermissionObserver
> GetInstance();
31 void AddSink(PermissionStatus
* aObs
);
32 void RemoveSink(PermissionStatus
* aObs
);
36 virtual ~PermissionObserver();
38 nsTArray
<PermissionStatus
*> mSinks
;
41 } // namespace mozilla::dom