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

Unified Diff: third_party/WebKit/Source/core/dom/DocumentUserGestureToken.h

Issue 2467993002: Document user gesture state should be able to propagate over postMessage (Closed)
Patch Set: Created 4 years, 1 month 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/core/dom/DocumentUserGestureToken.h
diff --git a/third_party/WebKit/Source/core/dom/DocumentUserGestureToken.h b/third_party/WebKit/Source/core/dom/DocumentUserGestureToken.h
index a5e7ef5530edfc61c76becda8f691f7265065246..d4cd560b21112be05f6d9490d75fc9094af9825b 100644
--- a/third_party/WebKit/Source/core/dom/DocumentUserGestureToken.h
+++ b/third_party/WebKit/Source/core/dom/DocumentUserGestureToken.h
@@ -20,14 +20,22 @@ class DocumentUserGestureToken final : public UserGestureToken {
static PassRefPtr<UserGestureToken> create(
Document* document,
Status status = PossiblyExistingGesture) {
- return adoptRef(new DocumentUserGestureToken(document, status));
+ setHasReceivedUserGesture(document);
+ return adoptRef(new DocumentUserGestureToken(status));
}
- ~DocumentUserGestureToken() final {}
+ static PassRefPtr<UserGestureToken> adopt(Document* document,
+ UserGestureToken* token) {
+ if (!token || !token->hasGestures())
+ return nullptr;
+ setHasReceivedUserGesture(document);
+ return token;
+ }
private:
- DocumentUserGestureToken(Document* document, Status status)
- : UserGestureToken(status) {
+ DocumentUserGestureToken(Status status) : UserGestureToken(status) {}
+
+ static void setHasReceivedUserGesture(Document* document) {
if (!document || document->hasReceivedUserGesture())
return;
document->setHasReceivedUserGesture();

Powered by Google App Engine
This is Rietveld 408576698