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 { |
(...skipping 14 matching lines...) Expand all Loading... |
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 }; | 28 }; |
29 NOTREACHED() << "Invalid ui::MotionEvent action: " << event.GetAction(); | 29 NOTREACHED() << "Invalid ui::MotionEvent action: " << event.GetAction(); |
30 return GestureEventDataPacket::INVALID; | 30 return GestureEventDataPacket::INVALID; |
31 } | 31 } |
32 | 32 |
33 } // namespace | 33 } // namespace |
34 | 34 |
35 GestureEventDataPacket::GestureEventDataPacket() | |
36 : gesture_source_(UNDEFINED) { | |
37 } | |
38 | |
39 GestureEventDataPacket::GestureEventDataPacket( | 35 GestureEventDataPacket::GestureEventDataPacket( |
40 base::TimeTicks timestamp, | 36 base::TimeTicks timestamp, |
41 GestureSource source, | 37 GestureSource source, |
42 const gfx::PointF& touch_location, | 38 const gfx::PointF& touch_location, |
43 const gfx::PointF& raw_touch_location) | 39 const gfx::PointF& raw_touch_location) |
44 : timestamp_(timestamp), | 40 : timestamp_(timestamp), |
45 touch_location_(touch_location), | 41 touch_location_(touch_location), |
46 raw_touch_location_(raw_touch_location), | 42 raw_touch_location_(raw_touch_location), |
47 gesture_source_(source) { | 43 gesture_source_(source), |
48 DCHECK_NE(gesture_source_, UNDEFINED); | 44 ack_state_(AckState::PENDING) { |
| 45 } |
| 46 |
| 47 GestureEventDataPacket::GestureEventDataPacket() |
| 48 : GestureEventDataPacket(base::TimeTicks(), |
| 49 UNDEFINED, |
| 50 gfx::PointF(), |
| 51 gfx::PointF()) { |
49 } | 52 } |
50 | 53 |
51 GestureEventDataPacket::GestureEventDataPacket( | 54 GestureEventDataPacket::GestureEventDataPacket( |
52 const GestureEventDataPacket& other) | 55 const GestureEventDataPacket& other) |
53 : timestamp_(other.timestamp_), | 56 : GestureEventDataPacket(other.timestamp_, |
54 gestures_(other.gestures_), | 57 other.gesture_source_, |
55 touch_location_(other.touch_location_), | 58 other.touch_location_, |
56 raw_touch_location_(other.raw_touch_location_), | 59 other.raw_touch_location_) { |
57 gesture_source_(other.gesture_source_) { | 60 gestures_ = other.gestures_; |
| 61 ack_state_ = other.ack_state_; |
58 } | 62 } |
59 | 63 |
60 GestureEventDataPacket::~GestureEventDataPacket() { | 64 GestureEventDataPacket::~GestureEventDataPacket() { |
61 } | 65 } |
62 | 66 |
63 GestureEventDataPacket& GestureEventDataPacket::operator=( | 67 GestureEventDataPacket& GestureEventDataPacket::operator=( |
64 const GestureEventDataPacket& other) { | 68 const GestureEventDataPacket& other) { |
65 timestamp_ = other.timestamp_; | 69 timestamp_ = other.timestamp_; |
66 gesture_source_ = other.gesture_source_; | 70 gesture_source_ = other.gesture_source_; |
67 touch_location_ = other.touch_location_; | 71 touch_location_ = other.touch_location_; |
(...skipping 19 matching lines...) Expand all Loading... |
87 const GestureEventData& gesture) { | 91 const GestureEventData& gesture) { |
88 GestureEventDataPacket packet(gesture.time, | 92 GestureEventDataPacket packet(gesture.time, |
89 TOUCH_TIMEOUT, | 93 TOUCH_TIMEOUT, |
90 gfx::PointF(gesture.x, gesture.y), | 94 gfx::PointF(gesture.x, gesture.y), |
91 gfx::PointF(gesture.raw_x, gesture.raw_y)); | 95 gfx::PointF(gesture.raw_x, gesture.raw_y)); |
92 packet.Push(gesture); | 96 packet.Push(gesture); |
93 return packet; | 97 return packet; |
94 } | 98 } |
95 | 99 |
96 } // namespace ui | 100 } // namespace ui |
OLD | NEW |