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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 break; | 489 break; |
488 | 490 |
489 case ET_POINTER_EXITED: | 491 case ET_POINTER_EXITED: |
490 SetType(ET_MOUSE_EXITED); | 492 SetType(ET_MOUSE_EXITED); |
491 break; | 493 break; |
492 | 494 |
493 case ET_POINTER_UP: | 495 case ET_POINTER_UP: |
494 SetType(ET_MOUSE_RELEASED); | 496 SetType(ET_MOUSE_RELEASED); |
495 break; | 497 break; |
496 | 498 |
| 499 case ET_POINTER_WHEEL_CHANGED: |
| 500 SetType(ET_MOUSEWHEEL); |
| 501 break; |
| 502 |
| 503 case ET_POINTER_CAPTURE_CHANGED: |
| 504 SetType(ET_MOUSE_CAPTURE_CHANGED); |
| 505 break; |
| 506 |
497 default: | 507 default: |
498 NOTREACHED(); | 508 NOTREACHED(); |
499 } | 509 } |
500 } | 510 } |
501 | 511 |
502 MouseEvent::MouseEvent(EventType type, | 512 MouseEvent::MouseEvent(EventType type, |
503 const gfx::Point& location, | 513 const gfx::Point& location, |
504 const gfx::Point& root_location, | 514 const gfx::Point& root_location, |
505 base::TimeTicks time_stamp, | 515 base::TimeTicks time_stamp, |
506 int flags, | 516 int flags, |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 // PointerEvent | 848 // PointerEvent |
839 | 849 |
840 bool PointerEvent::CanConvertFrom(const Event& event) { | 850 bool PointerEvent::CanConvertFrom(const Event& event) { |
841 switch (event.type()) { | 851 switch (event.type()) { |
842 case ET_MOUSE_PRESSED: | 852 case ET_MOUSE_PRESSED: |
843 case ET_MOUSE_DRAGGED: | 853 case ET_MOUSE_DRAGGED: |
844 case ET_MOUSE_MOVED: | 854 case ET_MOUSE_MOVED: |
845 case ET_MOUSE_ENTERED: | 855 case ET_MOUSE_ENTERED: |
846 case ET_MOUSE_EXITED: | 856 case ET_MOUSE_EXITED: |
847 case ET_MOUSE_RELEASED: | 857 case ET_MOUSE_RELEASED: |
| 858 case ET_MOUSEWHEEL: |
| 859 case ET_MOUSE_CAPTURE_CHANGED: |
848 case ET_TOUCH_PRESSED: | 860 case ET_TOUCH_PRESSED: |
849 case ET_TOUCH_MOVED: | 861 case ET_TOUCH_MOVED: |
850 case ET_TOUCH_RELEASED: | 862 case ET_TOUCH_RELEASED: |
851 case ET_TOUCH_CANCELLED: | 863 case ET_TOUCH_CANCELLED: |
852 return true; | 864 return true; |
853 default: | 865 default: |
854 return false; | 866 return false; |
855 } | 867 } |
856 } | 868 } |
857 | 869 |
(...skipping 22 matching lines...) Expand all Loading... |
880 break; | 892 break; |
881 | 893 |
882 case ET_MOUSE_EXITED: | 894 case ET_MOUSE_EXITED: |
883 SetType(ET_POINTER_EXITED); | 895 SetType(ET_POINTER_EXITED); |
884 break; | 896 break; |
885 | 897 |
886 case ET_MOUSE_RELEASED: | 898 case ET_MOUSE_RELEASED: |
887 SetType(ET_POINTER_UP); | 899 SetType(ET_POINTER_UP); |
888 break; | 900 break; |
889 | 901 |
| 902 case ET_MOUSEWHEEL: |
| 903 SetType(ET_POINTER_WHEEL_CHANGED); |
| 904 details_ = PointerDetails(EventPointerType::POINTER_TYPE_MOUSE, |
| 905 mouse_event.AsMouseWheelEvent()->offset()); |
| 906 break; |
| 907 |
| 908 case ET_MOUSE_CAPTURE_CHANGED: |
| 909 SetType(ET_POINTER_CAPTURE_CHANGED); |
| 910 break; |
| 911 |
890 default: | 912 default: |
891 NOTREACHED(); | 913 NOTREACHED(); |
892 } | 914 } |
893 } | 915 } |
894 | 916 |
895 PointerEvent::PointerEvent(const TouchEvent& touch_event) | 917 PointerEvent::PointerEvent(const TouchEvent& touch_event) |
896 : LocatedEvent(touch_event), | 918 : LocatedEvent(touch_event), |
897 pointer_id_(touch_event.touch_id()), | 919 pointer_id_(touch_event.touch_id()), |
898 details_(touch_event.pointer_details()) { | 920 details_(touch_event.pointer_details()) { |
899 DCHECK(CanConvertFrom(touch_event)); | 921 DCHECK(CanConvertFrom(touch_event)); |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1272 gfx::PointF(x, y), | 1294 gfx::PointF(x, y), |
1273 time_stamp, | 1295 time_stamp, |
1274 flags | EF_FROM_TOUCH), | 1296 flags | EF_FROM_TOUCH), |
1275 details_(details), | 1297 details_(details), |
1276 unique_touch_event_id_(unique_touch_event_id) {} | 1298 unique_touch_event_id_(unique_touch_event_id) {} |
1277 | 1299 |
1278 GestureEvent::~GestureEvent() { | 1300 GestureEvent::~GestureEvent() { |
1279 } | 1301 } |
1280 | 1302 |
1281 } // namespace ui | 1303 } // namespace ui |
OLD | NEW |