Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1618)

Unified Diff: Source/modules/permissions/PermissionStatus.h

Issue 1054663002: Implement Permission change observing in Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: relax assert Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/modules/permissions/PermissionStatus.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/permissions/PermissionStatus.h
diff --git a/Source/modules/permissions/PermissionStatus.h b/Source/modules/permissions/PermissionStatus.h
index 74d0af3cd0a1995cf0862f7dd161e3b731ee0703..956c5ad5ab018a8dc374b135be52eee7c56eb522 100644
--- a/Source/modules/permissions/PermissionStatus.h
+++ b/Source/modules/permissions/PermissionStatus.h
@@ -5,9 +5,10 @@
#ifndef PermissionStatus_h
#define PermissionStatus_h
-#include "core/dom/ContextLifecycleObserver.h"
+#include "core/dom/ActiveDOMObject.h"
#include "core/events/EventTarget.h"
#include "platform/heap/Handle.h"
+#include "public/platform/modules/permissions/WebPermissionObserver.h"
#include "public/platform/modules/permissions/WebPermissionStatus.h"
#include "public/platform/modules/permissions/WebPermissionType.h"
#include "wtf/text/AtomicString.h"
@@ -22,7 +23,8 @@ class ScriptPromiseResolver;
// ExecutionContext.
class PermissionStatus final
: public RefCountedGarbageCollectedEventTargetWithInlineData<PermissionStatus>
- , public ContextLifecycleObserver {
+ , public ActiveDOMObject
+ , public WebPermissionObserver {
DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<PermissionStatus>);
WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PermissionStatus);
DEFINE_WRAPPERTYPEINFO();
@@ -30,21 +32,37 @@ public:
static PermissionStatus* take(ScriptPromiseResolver*, WebPermissionStatus*, WebPermissionType);
static void dispose(WebPermissionStatus*);
- PermissionStatus(ExecutionContext*, WebPermissionStatus);
+ static PermissionStatus* create(ExecutionContext*, WebPermissionStatus, WebPermissionType);
~PermissionStatus() override;
// EventTarget implementation.
const AtomicString& interfaceName() const override;
ExecutionContext* executionContext() const override;
- DECLARE_VIRTUAL_TRACE();
+ // WebPermissionObserver implementation.
+ void permissionChanged(WebPermissionType, WebPermissionStatus) override;
+
+ // ActiveDOMObject implementation.
+ bool hasPendingActivity() const override;
+ void suspend() override;
+ void resume() override;
+ void stop() override;
String status() const;
DEFINE_ATTRIBUTE_EVENT_LISTENER(change);
+ DECLARE_VIRTUAL_TRACE();
+
private:
+ PermissionStatus(ExecutionContext*, WebPermissionStatus, WebPermissionType);
+
+ void startListening();
+ void stopListening();
+
WebPermissionStatus m_status;
+ WebPermissionType m_type;
+ bool m_listening;
};
} // namespace blink
« no previous file with comments | « no previous file | Source/modules/permissions/PermissionStatus.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698