Index: third_party/WebKit/Source/core/dom/DocumentUserGestureToken.h |
diff --git a/third_party/WebKit/Source/platform/ContextMenu.cpp b/third_party/WebKit/Source/core/dom/DocumentUserGestureToken.h |
similarity index 66% |
copy from third_party/WebKit/Source/platform/ContextMenu.cpp |
copy to third_party/WebKit/Source/core/dom/DocumentUserGestureToken.h |
index 5b3c71404a8f2819072e5059d51ec57b333560f7..99668168e2c8ad4beed6fa1784654304a5d3edda 100644 |
--- a/third_party/WebKit/Source/platform/ContextMenu.cpp |
+++ b/third_party/WebKit/Source/core/dom/DocumentUserGestureToken.h |
@@ -23,29 +23,34 @@ |
* THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
-#include "platform/ContextMenu.h" |
+#ifndef DocumentUserGestureToken_h |
+#define DocumentUserGestureToken_h |
+ |
+#include "core/dom/Document.h" |
+#include "platform/UserGestureIndicator.h" |
namespace blink { |
-static const ContextMenuItem* findItemWithAction( |
- unsigned action, |
- const Vector<ContextMenuItem>& items) { |
- for (size_t i = 0; i < items.size(); ++i) { |
- const ContextMenuItem& item = items[i]; |
- if (item.action() == static_cast<ContextMenuAction>(action)) |
- return &item; |
- if (item.type() != SubmenuType) |
- continue; |
- if (const ContextMenuItem* subMenuItem = |
- findItemWithAction(action, item.subMenuItems())) |
- return subMenuItem; |
+class DocumentUserGestureToken final : public UserGestureToken { |
Rick Byers
2016/10/17 17:02:46
Add a short comment describing the purpose of the
Nate Chapin
2016/10/18 23:26:33
Done.
|
+ WTF_MAKE_NONCOPYABLE(DocumentUserGestureToken); |
+ |
+ public: |
+ static PassRefPtr<UserGestureToken> create( |
+ Document* document, |
+ Status status = PossiblyExistingGesture) { |
+ return adoptRef(new DocumentUserGestureToken(document, status)); |
} |
- return 0; |
-} |
+ ~DocumentUserGestureToken() final {} |
-const ContextMenuItem* ContextMenu::itemWithAction(unsigned action) const { |
- return findItemWithAction(action, m_items); |
-} |
+ private: |
+ DocumentUserGestureToken(Document* document, Status status) |
+ : UserGestureToken(status) { |
+ if (document) |
+ document->setHasReceivedUserGesture(); |
+ } |
+}; |
} // namespace blink |
+ |
+#endif // DocumentUserGestureToken_h |