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

Unified Diff: third_party/WebKit/Source/modules/notifications/Notification.cpp

Issue 2408333004: Move persistent gesture state to Document, add DocumentUserGestureToken (Closed)
Patch Set: Re-add dropped null check Created 4 years, 2 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
Index: third_party/WebKit/Source/modules/notifications/Notification.cpp
diff --git a/third_party/WebKit/Source/modules/notifications/Notification.cpp b/third_party/WebKit/Source/modules/notifications/Notification.cpp
index af9ad5b05de815721b36bc7ea43af3bf48a5b67a..980b5ac8521881772ebd762e78bf2cc255fc922d 100644
--- a/third_party/WebKit/Source/modules/notifications/Notification.cpp
+++ b/third_party/WebKit/Source/modules/notifications/Notification.cpp
@@ -35,6 +35,7 @@
#include "bindings/core/v8/SerializedScriptValueFactory.h"
#include "bindings/modules/v8/V8NotificationAction.h"
#include "core/dom/Document.h"
+#include "core/dom/DocumentUserGestureToken.h"
#include "core/dom/ExecutionContext.h"
#include "core/dom/ExecutionContextTask.h"
#include "core/dom/ScopedWindowFocusAllowedIndicator.h"
@@ -208,8 +209,10 @@ void Notification::dispatchShowEvent() {
}
void Notification::dispatchClickEvent() {
- UserGestureIndicator gestureIndicator(
- UserGestureToken::create(UserGestureToken::NewGesture));
+ ExecutionContext* context = getExecutionContext();
+ UserGestureIndicator gestureIndicator(DocumentUserGestureToken::create(
+ context->isDocument() ? toDocument(context) : nullptr,
+ UserGestureToken::NewGesture));
ScopedWindowFocusAllowedIndicator windowFocusAllowed(getExecutionContext());
dispatchEvent(Event::create(EventTypeNames::click));
}

Powered by Google App Engine
This is Rietveld 408576698