Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/PermissionStatus.h
Line
Count
Source (jump to first uncovered line)
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_PermissionStatus_h_
8
#define mozilla_dom_PermissionStatus_h_
9
10
#include "mozilla/dom/PermissionsBinding.h"
11
#include "mozilla/dom/PermissionStatusBinding.h"
12
#include "mozilla/DOMEventTargetHelper.h"
13
14
namespace mozilla {
15
namespace dom {
16
17
class PermissionObserver;
18
19
class PermissionStatus final
20
  : public DOMEventTargetHelper
21
{
22
  friend class PermissionObserver;
23
24
public:
25
  static already_AddRefed<PermissionStatus> Create(nsPIDOMWindowInner* aWindow,
26
                                                   PermissionName aName,
27
                                                   ErrorResult& aRv);
28
29
  JSObject* WrapObject(JSContext* aCx,
30
                       JS::Handle<JSObject*> aGivenProto) override;
31
32
0
  PermissionState State() const { return mState; }
33
34
  IMPL_EVENT_HANDLER(change)
35
36
  void
37
  DisconnectFromOwner() override;
38
39
private:
40
  ~PermissionStatus();
41
42
  PermissionStatus(nsPIDOMWindowInner* aWindow, PermissionName aName);
43
44
  nsresult Init();
45
46
  nsresult UpdateState();
47
48
  already_AddRefed<nsIPrincipal> GetPrincipal() const;
49
50
  void PermissionChanged();
51
52
  PermissionName mName;
53
  PermissionState mState;
54
55
  RefPtr<PermissionObserver> mObserver;
56
};
57
58
} // namespace dom
59
} // namespace mozilla
60
61
#endif // mozilla_dom_permissionstatus_h_