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

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

Issue 2408333004: Move persistent gesture state to Document, add DocumentUserGestureToken (Closed)
Patch Set: Switch back to checkign context->isDocument() 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/core/dom/DocumentUserGestureToken.h
diff --git a/third_party/WebKit/Source/core/dom/DocumentUserGestureToken.h b/third_party/WebKit/Source/core/dom/DocumentUserGestureToken.h
new file mode 100644
index 0000000000000000000000000000000000000000..7c11d48b330f556bda9db34a79c28fe7384bf0aa
--- /dev/null
+++ b/third_party/WebKit/Source/core/dom/DocumentUserGestureToken.h
@@ -0,0 +1,39 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef DocumentUserGestureToken_h
+#define DocumentUserGestureToken_h
+
+#include "core/dom/Document.h"
+#include "platform/UserGestureIndicator.h"
+
+namespace blink {
+
+// Associates a UserGestureToken with a Document, if a non-null Document*
+// is provided in the constructor.
+class DocumentUserGestureToken final : public UserGestureToken {
+ WTF_MAKE_NONCOPYABLE(DocumentUserGestureToken);
+
+ public:
+ static PassRefPtr<UserGestureToken> create(
+ Document* document,
+ Status status = PossiblyExistingGesture) {
+ return adoptRef(new DocumentUserGestureToken(document, status));
+ }
+
+ ~DocumentUserGestureToken() final {}
+
+ private:
+ DocumentUserGestureToken(Document* document, Status status)
+ : UserGestureToken(status) {
+ for (; document; document = document->parentDocument()) {
Rick Byers 2016/10/24 18:30:47 Any thoughts about what should be done for OOPIF?
Nate Chapin 2016/10/24 18:45:18 Added TODO, filed https://bugs.chromium.org/p/chro
+ if (document)
ojan 2016/10/21 21:33:06 This can early return if the document->hasReceived
Nate Chapin 2016/10/21 21:36:49 Technically it's not guaranteed that, if a Documen
Rick Byers 2016/10/24 18:30:46 If there's no good way to avoid this then I'm not
+ document->setHasReceivedUserGesture();
+ }
+ }
+};
+
+} // namespace blink
+
+#endif // DocumentUserGestureToken_h
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | third_party/WebKit/Source/core/dom/DocumentUserGestureTokenTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698