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 #include "ui/events/gesture_detection/gesture_event_data_packet.h" | 5 #include "ui/events/gesture_detection/gesture_event_data_packet.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ui/events/gesture_detection/motion_event.h" | 8 #include "ui/events/gesture_detection/motion_event.h" |
9 | 9 |
10 namespace ui { | 10 namespace ui { |
11 namespace { | 11 namespace { |
12 | 12 |
13 GestureEventDataPacket::GestureSource ToGestureSource( | 13 GestureEventDataPacket::GestureSource ToGestureSource( |
14 const ui::MotionEvent& event) { | 14 const ui::MotionEvent& event) { |
15 switch (event.GetAction()) { | 15 switch (event.GetAction()) { |
16 case ui::MotionEvent::ACTION_DOWN: | 16 case ui::MotionEvent::ACTION_DOWN: |
17 return GestureEventDataPacket::TOUCH_SEQUENCE_START; | 17 return GestureEventDataPacket::TOUCH_SEQUENCE_START; |
18 case ui::MotionEvent::ACTION_UP: | 18 case ui::MotionEvent::ACTION_UP: |
19 return GestureEventDataPacket::TOUCH_SEQUENCE_END; | 19 return GestureEventDataPacket::TOUCH_SEQUENCE_END; |
20 case ui::MotionEvent::ACTION_MOVE: | 20 case ui::MotionEvent::ACTION_MOVE: |
21 return GestureEventDataPacket::TOUCH_MOVE; | 21 return GestureEventDataPacket::TOUCH_MOVE; |
22 case ui::MotionEvent::ACTION_CANCEL: | 22 case ui::MotionEvent::ACTION_CANCEL: |
23 return GestureEventDataPacket::TOUCH_SEQUENCE_CANCEL; | 23 return GestureEventDataPacket::TOUCH_SEQUENCE_CANCEL; |
24 case ui::MotionEvent::ACTION_POINTER_DOWN: | 24 case ui::MotionEvent::ACTION_POINTER_DOWN: |
25 return GestureEventDataPacket::TOUCH_START; | 25 return GestureEventDataPacket::TOUCH_START; |
26 case ui::MotionEvent::ACTION_POINTER_UP: | 26 case ui::MotionEvent::ACTION_POINTER_UP: |
27 return GestureEventDataPacket::TOUCH_END; | 27 return GestureEventDataPacket::TOUCH_END; |
28 case ui::MotionEvent::ACTION_NONE: | 28 case ui::MotionEvent::ACTION_NONE: |
| 29 case ui::MotionEvent::ACTION_HOVER_ENTER: |
| 30 case ui::MotionEvent::ACTION_HOVER_EXIT: |
| 31 case ui::MotionEvent::ACTION_HOVER_MOVE: |
| 32 case ui::MotionEvent::ACTION_BUTTON_PRESS: |
| 33 case ui::MotionEvent::ACTION_BUTTON_RELEASE: |
29 NOTREACHED(); | 34 NOTREACHED(); |
30 return GestureEventDataPacket::INVALID; | 35 return GestureEventDataPacket::INVALID; |
31 }; | 36 }; |
32 NOTREACHED(); | 37 NOTREACHED(); |
33 return GestureEventDataPacket::INVALID; | 38 return GestureEventDataPacket::INVALID; |
34 } | 39 } |
35 | 40 |
36 } // namespace | 41 } // namespace |
37 | 42 |
38 GestureEventDataPacket::GestureEventDataPacket() | 43 GestureEventDataPacket::GestureEventDataPacket() |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 packet.Push(gesture); | 111 packet.Push(gesture); |
107 return packet; | 112 return packet; |
108 } | 113 } |
109 | 114 |
110 void GestureEventDataPacket::Ack(bool event_consumed) { | 115 void GestureEventDataPacket::Ack(bool event_consumed) { |
111 DCHECK_EQ(static_cast<int>(ack_state_), static_cast<int>(AckState::PENDING)); | 116 DCHECK_EQ(static_cast<int>(ack_state_), static_cast<int>(AckState::PENDING)); |
112 ack_state_ = event_consumed ? AckState::CONSUMED : AckState::UNCONSUMED; | 117 ack_state_ = event_consumed ? AckState::CONSUMED : AckState::UNCONSUMED; |
113 } | 118 } |
114 | 119 |
115 } // namespace ui | 120 } // namespace ui |
OLD | NEW |