2015-07-28 16:33:46 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_PermissionStatus_h_
|
|
|
|
#define mozilla_dom_PermissionStatus_h_
|
|
|
|
|
2015-08-22 05:53:29 +03:00
|
|
|
#include "mozilla/dom/PermissionsBinding.h"
|
2015-07-28 16:33:46 +03:00
|
|
|
#include "mozilla/dom/PermissionStatusBinding.h"
|
|
|
|
#include "mozilla/DOMEventTargetHelper.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2015-08-22 05:53:29 +03:00
|
|
|
class PermissionObserver;
|
|
|
|
|
2015-07-28 16:33:46 +03:00
|
|
|
class PermissionStatus final
|
|
|
|
: public DOMEventTargetHelper
|
|
|
|
{
|
2015-08-22 05:53:29 +03:00
|
|
|
friend class PermissionObserver;
|
|
|
|
|
2015-07-28 16:33:46 +03:00
|
|
|
public:
|
2016-01-30 20:05:36 +03:00
|
|
|
static already_AddRefed<PermissionStatus> Create(nsPIDOMWindowInner* aWindow,
|
2015-08-01 00:56:59 +03:00
|
|
|
PermissionName aName,
|
|
|
|
ErrorResult& aRv);
|
2015-07-28 16:33:46 +03:00
|
|
|
|
|
|
|
JSObject* WrapObject(JSContext* aCx,
|
|
|
|
JS::Handle<JSObject*> aGivenProto) override;
|
|
|
|
|
|
|
|
PermissionState State() const { return mState; }
|
|
|
|
|
|
|
|
IMPL_EVENT_HANDLER(change)
|
|
|
|
|
|
|
|
private:
|
2015-08-01 00:56:59 +03:00
|
|
|
~PermissionStatus();
|
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
PermissionStatus(nsPIDOMWindowInner* aWindow, PermissionName aName);
|
2015-08-22 05:53:29 +03:00
|
|
|
|
2015-08-22 05:53:29 +03:00
|
|
|
nsresult Init();
|
|
|
|
|
2015-08-22 05:53:29 +03:00
|
|
|
nsresult UpdateState();
|
2015-07-28 16:33:46 +03:00
|
|
|
|
2016-11-08 13:53:11 +03:00
|
|
|
already_AddRefed<nsIPrincipal> GetPrincipal() const;
|
2015-08-22 05:53:29 +03:00
|
|
|
|
2015-08-22 05:53:29 +03:00
|
|
|
void PermissionChanged();
|
2015-08-22 05:53:29 +03:00
|
|
|
|
2015-08-22 05:53:29 +03:00
|
|
|
PermissionName mName;
|
2015-07-28 16:33:46 +03:00
|
|
|
PermissionState mState;
|
2015-08-22 05:53:29 +03:00
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<PermissionObserver> mObserver;
|
2015-07-28 16:33:46 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_permissionstatus_h_
|