OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURE_EVENT_QUEUE_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURE_EVENT_QUEUE_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURE_EVENT_QUEUE_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURE_EVENT_QUEUE_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <queue> | 9 #include <queue> |
10 | 10 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 void UpdateState(InputEventAckState ack_state); | 56 void UpdateState(InputEventAckState ack_state); |
57 bool IsGesturePrevented() const; | 57 bool IsGesturePrevented() const; |
58 bool IsEmpty() const; | 58 bool IsEmpty() const; |
59 | 59 |
60 private: | 60 private: |
61 std::queue<GestureEventPacket> packets_; | 61 std::queue<GestureEventPacket> packets_; |
62 enum GestureHandlingState { | 62 enum GestureHandlingState { |
63 PENDING, // The sequence has yet to receive an ack. | 63 PENDING, // The sequence has yet to receive an ack. |
64 ALLOWED_UNTIL_PREVENTED, // Gestures in the sequence are allowed until | 64 ALLOWED_UNTIL_PREVENTED, // Gestures in the sequence are allowed until |
65 // a source touch is preventDefault'ed. | 65 // a source touch is preventDefault'ed. |
66 ALWAYS_ALLOWED, // All remaining sequence gestures are forwarded. | 66 ALWAYS_ALLOWED, // All remaining sequence gestures are forwarded |
| 67 // except for independent packets whose |
| 68 // corresponding touch was consumed. |
67 ALWAYS_PREVENTED // All remaining sequence gestures are dropped. | 69 ALWAYS_PREVENTED // All remaining sequence gestures are dropped. |
68 }; | 70 }; |
69 GestureHandlingState state_; | 71 GestureHandlingState state_; |
70 }; | 72 }; |
71 void UpdateAndDispatchPackets(GestureSequence* sequence, | 73 void UpdateAndDispatchPackets(GestureSequence* sequence, |
72 InputEventAckState ack_result); | 74 InputEventAckState ack_result); |
73 void SendPacket(const GestureEventPacket& packet); | 75 void SendPacket(const GestureEventPacket& packet); |
74 void SendGesture(const blink::WebGestureEvent& gesture); | 76 void SendGesture(const blink::WebGestureEvent& gesture); |
75 void CancelTapIfNecessary(); | 77 void CancelTapIfNecessary(); |
76 void CancelFlingIfNecessary(); | 78 void CancelFlingIfNecessary(); |
77 GestureSequence& Head(); | 79 GestureSequence& Head(); |
78 GestureSequence& Tail(); | 80 GestureSequence& Tail(); |
79 | 81 |
80 GestureEventQueueClient* client_; | 82 GestureEventQueueClient* client_; |
81 std::queue<GestureSequence> sequences_; | 83 std::queue<GestureSequence> sequences_; |
82 | 84 |
83 // Bookkeeping for inserting synthetic Gesture{Tap,Fling}Cancel events | 85 // Bookkeeping for inserting synthetic Gesture{Tap,Fling}Cancel events |
84 // when necessary, e.g., GestureTapCancel when scrolling begins, or | 86 // when necessary, e.g., GestureTapCancel when scrolling begins, or |
85 // GestureFlingCancel when a user taps following a GestureFlingStart. | 87 // GestureFlingCancel when a user taps following a GestureFlingStart. |
86 bool needs_tap_ending_event_; | 88 bool needs_tap_ending_event_; |
87 bool needs_fling_ending_event_; | 89 bool needs_fling_ending_event_; |
88 | 90 |
89 DISALLOW_COPY_AND_ASSIGN(GestureEventQueue); | 91 DISALLOW_COPY_AND_ASSIGN(GestureEventQueue); |
90 }; | 92 }; |
91 | 93 |
92 } // namespace content | 94 } // namespace content |
93 | 95 |
94 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURE_EVENT_QUEUE_H_ | 96 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURE_EVENT_QUEUE_H_ |
OLD | NEW |