OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef GestureManager_h |
| 6 #define GestureManager_h |
| 7 |
| 8 #include "core/CoreExport.h" |
| 9 #include "core/frame/LocalFrame.h" |
| 10 #include "core/layout/HitTestRequest.h" |
| 11 #include "core/page/EventWithHitTestResults.h" |
| 12 #include "platform/PlatformEvent.h" |
| 13 #include "public/platform/WebInputEventResult.h" |
| 14 |
| 15 namespace blink { |
| 16 |
| 17 class ScrollManager; |
| 18 class SelectionController; |
| 19 class PointerEventManager; |
| 20 |
| 21 // This class takes care of gestures and delegating the action based on the |
| 22 // gesture to the responsible class. |
| 23 class CORE_EXPORT GestureManager { |
| 24 WTF_MAKE_NONCOPYABLE(GestureManager); |
| 25 DISALLOW_NEW(); |
| 26 |
| 27 public: |
| 28 GestureManager(LocalFrame*, ScrollManager*, PointerEventManager*, |
| 29 SelectionController*); |
| 30 ~GestureManager(); |
| 31 DECLARE_TRACE(); |
| 32 |
| 33 void clear(); |
| 34 |
| 35 HitTestRequest::HitTestRequestType getHitTypeForGestureType(PlatformEvent::E
ventType); |
| 36 WebInputEventResult handleGestureEventInFrame(const GestureEventWithHitTestR
esults&); |
| 37 |
| 38 // TODO(nzolghadr): This can probably be hidden and the related logic |
| 39 // be moved to this class (see crrev.com/112023010). Since that might cause |
| 40 // regression it's better to move that logic in another change. |
| 41 double getLastShowPressTimestamp() const; |
| 42 |
| 43 private: |
| 44 WebInputEventResult handleGestureShowPress(); |
| 45 WebInputEventResult handleGestureTapDown(const GestureEventWithHitTestResult
s&); |
| 46 WebInputEventResult handleGestureTap(const GestureEventWithHitTestResults&); |
| 47 WebInputEventResult handleGestureLongPress(const GestureEventWithHitTestResu
lts&); |
| 48 WebInputEventResult handleGestureLongTap(const GestureEventWithHitTestResult
s&); |
| 49 |
| 50 FrameHost* frameHost() const; |
| 51 |
| 52 // NOTE: If adding a new field to this class please ensure that it is |
| 53 // cleared if needed in |GestureManager::clear()|. |
| 54 |
| 55 const Member<LocalFrame> m_frame; |
| 56 |
| 57 ScrollManager* m_scrollManager; |
| 58 PointerEventManager* m_pointerEventManager; |
| 59 |
| 60 // Set on GestureTapDown if the |pointerdown| event corresponding to the |
| 61 // triggering |touchstart| event was canceled. This suppresses mouse event |
| 62 // firing for the current gesture sequence (i.e. until next GestureTapDown). |
| 63 bool m_suppressMouseEventsFromGestures; |
| 64 |
| 65 bool m_longTapShouldInvokeContextMenu; |
| 66 |
| 67 const Member<SelectionController> m_selectionController; |
| 68 |
| 69 double m_lastShowPressTimestamp; |
| 70 }; |
| 71 |
| 72 } // namespace blink |
| 73 |
| 74 #endif // GestureManager_h |
OLD | NEW |