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_event_details.h" | 5 #include "ui/events/gesture_event_details.h" |
6 | 6 |
7 namespace ui { | 7 namespace ui { |
8 | 8 |
9 GestureEventDetails::GestureEventDetails() : type_(ET_UNKNOWN) {} | 9 GestureEventDetails::GestureEventDetails() : type_(ET_UNKNOWN) {} |
10 | 10 |
11 GestureEventDetails::GestureEventDetails(ui::EventType type, | 11 GestureEventDetails::GestureEventDetails(ui::EventType type, |
12 float delta_x, | 12 float delta_x, |
13 float delta_y) | 13 float delta_y) |
14 : type_(type), | 14 : type_(type), |
15 touch_points_(1) { | 15 touch_points_(1) { |
| 16 DCHECK_GE(type, ET_GESTURE_TYPE_START); |
| 17 DCHECK_LE(type, ET_GESTURE_TYPE_END); |
16 switch (type_) { | 18 switch (type_) { |
17 case ui::ET_GESTURE_SCROLL_BEGIN: | 19 case ui::ET_GESTURE_SCROLL_BEGIN: |
18 data.scroll_begin.x_hint = delta_x; | 20 data.scroll_begin.x_hint = delta_x; |
19 data.scroll_begin.y_hint = delta_y; | 21 data.scroll_begin.y_hint = delta_y; |
20 break; | 22 break; |
21 | 23 |
22 case ui::ET_GESTURE_SCROLL_UPDATE: | 24 case ui::ET_GESTURE_SCROLL_UPDATE: |
23 data.scroll_update.x = delta_x; | 25 data.scroll_update.x = delta_x; |
24 data.scroll_update.y = delta_y; | 26 data.scroll_update.y = delta_y; |
25 break; | 27 break; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 } | 62 } |
61 break; | 63 break; |
62 } | 64 } |
63 } | 65 } |
64 | 66 |
65 GestureEventDetails::Details::Details() { | 67 GestureEventDetails::Details::Details() { |
66 memset(this, 0, sizeof(Details)); | 68 memset(this, 0, sizeof(Details)); |
67 } | 69 } |
68 | 70 |
69 } // namespace ui | 71 } // namespace ui |
OLD | NEW |