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

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

Issue 2408333004: Move persistent gesture state to Document, add DocumentUserGestureToken (Closed)
Patch Set: Address comments 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 eea467bd9b203d395bc38da3b5069f346412e0af..27d3dc36a4f0cb4d3cd9b28bc1e4ce38fda5203b 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"
@@ -219,9 +220,10 @@ void Notification::didShowNotification(const WebString& notificationId) {
}
void Notification::didClickNotification() {
- UserGestureIndicator gestureIndicator(
- UserGestureToken::create(UserGestureToken::NewGesture));
-
+ ExecutionContext* context = getExecutionContext();
+ UserGestureIndicator gestureIndicator(DocumentUserGestureToken::create(
+ context->isDocument() ? toDocument(context) : nullptr,
Peter Beverloo 2016/10/19 16:36:48 Prefer DCHECK(context->isDocument()) for this code
Nate Chapin 2016/10/21 18:11:04 Done.
Nate Chapin 2016/10/21 20:43:28 ...actually, the layout tests disagree. Switched b
+ UserGestureToken::NewGesture));
ScopedWindowFocusAllowedIndicator windowFocusAllowed(getExecutionContext());
dispatchEvent(Event::create(EventTypeNames::click));
}

Powered by Google App Engine
This is Rietveld 408576698