OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/event.h" | 5 #include "ui/events/event.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 | 10 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 CASE_TYPE(ET_TOUCH_PRESSED); | 97 CASE_TYPE(ET_TOUCH_PRESSED); |
98 CASE_TYPE(ET_TOUCH_MOVED); | 98 CASE_TYPE(ET_TOUCH_MOVED); |
99 CASE_TYPE(ET_TOUCH_CANCELLED); | 99 CASE_TYPE(ET_TOUCH_CANCELLED); |
100 CASE_TYPE(ET_DROP_TARGET_EVENT); | 100 CASE_TYPE(ET_DROP_TARGET_EVENT); |
101 CASE_TYPE(ET_POINTER_DOWN); | 101 CASE_TYPE(ET_POINTER_DOWN); |
102 CASE_TYPE(ET_POINTER_MOVED); | 102 CASE_TYPE(ET_POINTER_MOVED); |
103 CASE_TYPE(ET_POINTER_UP); | 103 CASE_TYPE(ET_POINTER_UP); |
104 CASE_TYPE(ET_POINTER_CANCELLED); | 104 CASE_TYPE(ET_POINTER_CANCELLED); |
105 CASE_TYPE(ET_POINTER_ENTERED); | 105 CASE_TYPE(ET_POINTER_ENTERED); |
106 CASE_TYPE(ET_POINTER_EXITED); | 106 CASE_TYPE(ET_POINTER_EXITED); |
| 107 CASE_TYPE(ET_POINTER_WHEEL_CHANGED); |
| 108 CASE_TYPE(ET_POINTER_CAPTURE_CHANGED); |
107 CASE_TYPE(ET_GESTURE_SCROLL_BEGIN); | 109 CASE_TYPE(ET_GESTURE_SCROLL_BEGIN); |
108 CASE_TYPE(ET_GESTURE_SCROLL_END); | 110 CASE_TYPE(ET_GESTURE_SCROLL_END); |
109 CASE_TYPE(ET_GESTURE_SCROLL_UPDATE); | 111 CASE_TYPE(ET_GESTURE_SCROLL_UPDATE); |
110 CASE_TYPE(ET_GESTURE_SHOW_PRESS); | 112 CASE_TYPE(ET_GESTURE_SHOW_PRESS); |
111 CASE_TYPE(ET_GESTURE_TAP); | 113 CASE_TYPE(ET_GESTURE_TAP); |
112 CASE_TYPE(ET_GESTURE_TAP_DOWN); | 114 CASE_TYPE(ET_GESTURE_TAP_DOWN); |
113 CASE_TYPE(ET_GESTURE_TAP_CANCEL); | 115 CASE_TYPE(ET_GESTURE_TAP_CANCEL); |
114 CASE_TYPE(ET_GESTURE_BEGIN); | 116 CASE_TYPE(ET_GESTURE_BEGIN); |
115 CASE_TYPE(ET_GESTURE_END); | 117 CASE_TYPE(ET_GESTURE_END); |
116 CASE_TYPE(ET_GESTURE_TWO_FINGER_TAP); | 118 CASE_TYPE(ET_GESTURE_TWO_FINGER_TAP); |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 break; | 491 break; |
490 | 492 |
491 case ET_POINTER_EXITED: | 493 case ET_POINTER_EXITED: |
492 SetType(ET_MOUSE_EXITED); | 494 SetType(ET_MOUSE_EXITED); |
493 break; | 495 break; |
494 | 496 |
495 case ET_POINTER_UP: | 497 case ET_POINTER_UP: |
496 SetType(ET_MOUSE_RELEASED); | 498 SetType(ET_MOUSE_RELEASED); |
497 break; | 499 break; |
498 | 500 |
| 501 case ET_POINTER_WHEEL_CHANGED: |
| 502 SetType(ET_MOUSEWHEEL); |
| 503 break; |
| 504 |
| 505 case ET_POINTER_CAPTURE_CHANGED: |
| 506 SetType(ET_MOUSE_CAPTURE_CHANGED); |
| 507 break; |
| 508 |
499 default: | 509 default: |
500 NOTREACHED(); | 510 NOTREACHED(); |
501 } | 511 } |
502 } | 512 } |
503 | 513 |
504 MouseEvent::MouseEvent(EventType type, | 514 MouseEvent::MouseEvent(EventType type, |
505 const gfx::Point& location, | 515 const gfx::Point& location, |
506 const gfx::Point& root_location, | 516 const gfx::Point& root_location, |
507 base::TimeTicks time_stamp, | 517 base::TimeTicks time_stamp, |
508 int flags, | 518 int flags, |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 // PointerEvent | 850 // PointerEvent |
841 | 851 |
842 bool PointerEvent::CanConvertFrom(const Event& event) { | 852 bool PointerEvent::CanConvertFrom(const Event& event) { |
843 switch (event.type()) { | 853 switch (event.type()) { |
844 case ET_MOUSE_PRESSED: | 854 case ET_MOUSE_PRESSED: |
845 case ET_MOUSE_DRAGGED: | 855 case ET_MOUSE_DRAGGED: |
846 case ET_MOUSE_MOVED: | 856 case ET_MOUSE_MOVED: |
847 case ET_MOUSE_ENTERED: | 857 case ET_MOUSE_ENTERED: |
848 case ET_MOUSE_EXITED: | 858 case ET_MOUSE_EXITED: |
849 case ET_MOUSE_RELEASED: | 859 case ET_MOUSE_RELEASED: |
| 860 case ET_MOUSEWHEEL: |
| 861 case ET_MOUSE_CAPTURE_CHANGED: |
850 case ET_TOUCH_PRESSED: | 862 case ET_TOUCH_PRESSED: |
851 case ET_TOUCH_MOVED: | 863 case ET_TOUCH_MOVED: |
852 case ET_TOUCH_RELEASED: | 864 case ET_TOUCH_RELEASED: |
853 case ET_TOUCH_CANCELLED: | 865 case ET_TOUCH_CANCELLED: |
854 return true; | 866 return true; |
855 default: | 867 default: |
856 return false; | 868 return false; |
857 } | 869 } |
858 } | 870 } |
859 | 871 |
(...skipping 22 matching lines...) Expand all Loading... |
882 break; | 894 break; |
883 | 895 |
884 case ET_MOUSE_EXITED: | 896 case ET_MOUSE_EXITED: |
885 SetType(ET_POINTER_EXITED); | 897 SetType(ET_POINTER_EXITED); |
886 break; | 898 break; |
887 | 899 |
888 case ET_MOUSE_RELEASED: | 900 case ET_MOUSE_RELEASED: |
889 SetType(ET_POINTER_UP); | 901 SetType(ET_POINTER_UP); |
890 break; | 902 break; |
891 | 903 |
| 904 case ET_MOUSEWHEEL: |
| 905 SetType(ET_POINTER_WHEEL_CHANGED); |
| 906 details_ = PointerDetails(EventPointerType::POINTER_TYPE_MOUSE, |
| 907 mouse_event.AsMouseWheelEvent()->offset()); |
| 908 break; |
| 909 |
| 910 case ET_MOUSE_CAPTURE_CHANGED: |
| 911 SetType(ET_POINTER_CAPTURE_CHANGED); |
| 912 break; |
| 913 |
892 default: | 914 default: |
893 NOTREACHED(); | 915 NOTREACHED(); |
894 } | 916 } |
895 } | 917 } |
896 | 918 |
897 PointerEvent::PointerEvent(const TouchEvent& touch_event) | 919 PointerEvent::PointerEvent(const TouchEvent& touch_event) |
898 : LocatedEvent(touch_event), | 920 : LocatedEvent(touch_event), |
899 pointer_id_(touch_event.touch_id()), | 921 pointer_id_(touch_event.touch_id()), |
900 details_(touch_event.pointer_details()) { | 922 details_(touch_event.pointer_details()) { |
901 DCHECK(CanConvertFrom(touch_event)); | 923 DCHECK(CanConvertFrom(touch_event)); |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1274 gfx::PointF(x, y), | 1296 gfx::PointF(x, y), |
1275 time_stamp, | 1297 time_stamp, |
1276 flags | EF_FROM_TOUCH), | 1298 flags | EF_FROM_TOUCH), |
1277 details_(details), | 1299 details_(details), |
1278 unique_touch_event_id_(unique_touch_event_id) {} | 1300 unique_touch_event_id_(unique_touch_event_id) {} |
1279 | 1301 |
1280 GestureEvent::~GestureEvent() { | 1302 GestureEvent::~GestureEvent() { |
1281 } | 1303 } |
1282 | 1304 |
1283 } // namespace ui | 1305 } // namespace ui |
OLD | NEW |