| 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.h" | 5 #include "ui/events/gesture_detection/gesture_event_data.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 | 8 |
| 9 namespace ui { | 9 namespace ui { |
| 10 | 10 |
| 11 GestureEventData::GestureEventData(EventType type, | 11 GestureEventData::GestureEventData(EventType type, |
| 12 int motion_event_id, | 12 int motion_event_id, |
| 13 base::TimeTicks time, | 13 base::TimeTicks time, |
| 14 float x, | 14 float x, |
| 15 float y, | 15 float y, |
| 16 int touch_point_count, |
| 16 const GestureEventDetails& details) | 17 const GestureEventDetails& details) |
| 17 : type(type), | 18 : type(type), |
| 18 motion_event_id(motion_event_id), | 19 motion_event_id(motion_event_id), |
| 19 time(time), | 20 time(time), |
| 20 x(x), | 21 x(x), |
| 21 y(y), | 22 y(y), |
| 22 details(details) { | 23 details(details) { |
| 23 DCHECK(motion_event_id >= 0); | 24 DCHECK(motion_event_id >= 0); |
| 25 DCHECK_NE(0, touch_point_count); |
| 24 DCHECK(ET_GESTURE_TYPE_START <= type && type <= ET_GESTURE_TYPE_END); | 26 DCHECK(ET_GESTURE_TYPE_START <= type && type <= ET_GESTURE_TYPE_END); |
| 27 this->details.set_touch_points(touch_point_count); |
| 25 } | 28 } |
| 26 | 29 |
| 27 GestureEventData::GestureEventData(EventType type, | 30 GestureEventData::GestureEventData(EventType type, |
| 28 int motion_event_id, | 31 int motion_event_id, |
| 29 base::TimeTicks time, | 32 base::TimeTicks time, |
| 30 float x, | 33 float x, |
| 31 float y) | 34 float y, |
| 35 int touch_point_count) |
| 32 : type(type), | 36 : type(type), |
| 33 motion_event_id(motion_event_id), | 37 motion_event_id(motion_event_id), |
| 34 time(time), | 38 time(time), |
| 35 x(x), | 39 x(x), |
| 36 y(y), | 40 y(y), |
| 37 details(GestureEventDetails(type, 0, 0)) { | 41 details(GestureEventDetails(type, 0, 0)) { |
| 38 DCHECK(motion_event_id >= 0); | 42 DCHECK(motion_event_id >= 0); |
| 43 DCHECK_NE(0, touch_point_count); |
| 39 DCHECK(ET_GESTURE_TYPE_START <= type && type <= ET_GESTURE_TYPE_END); | 44 DCHECK(ET_GESTURE_TYPE_START <= type && type <= ET_GESTURE_TYPE_END); |
| 45 details.set_touch_points(touch_point_count); |
| 40 } | 46 } |
| 41 | 47 |
| 42 GestureEventData::GestureEventData() : type(ET_UNKNOWN), x(0), y(0) {} | 48 GestureEventData::GestureEventData() : type(ET_UNKNOWN), x(0), y(0) {} |
| 43 | 49 |
| 44 } // namespace ui | 50 } // namespace ui |
| OLD | NEW |