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/gestures/motion_event_aura.h" | 5 #include "ui/events/gestures/motion_event_aura.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ui/events/gesture_detection/gesture_configuration.h" | 8 #include "ui/events/gesture_detection/gesture_configuration.h" |
9 | 9 |
10 namespace ui { | 10 namespace ui { |
11 namespace { | 11 namespace { |
12 | 12 |
13 MotionEvent::ToolType EventPointerTypeToMotionEventToolType( | 13 MotionEvent::ToolType EventPointerTypeToMotionEventToolType( |
14 EventPointerType type) { | 14 EventPointerType type) { |
15 switch (type) { | 15 switch (type) { |
16 case EventPointerType::POINTER_TYPE_UNKNOWN: | 16 case EventPointerType::POINTER_TYPE_UNKNOWN: |
17 return MotionEvent::TOOL_TYPE_UNKNOWN; | 17 return MotionEvent::TOOL_TYPE_UNKNOWN; |
18 case EventPointerType::POINTER_TYPE_MOUSE: | 18 case EventPointerType::POINTER_TYPE_MOUSE: |
19 return MotionEvent::TOOL_TYPE_MOUSE; | 19 return MotionEvent::TOOL_TYPE_MOUSE; |
20 case EventPointerType::POINTER_TYPE_PEN: | 20 case EventPointerType::POINTER_TYPE_PEN: |
21 return MotionEvent::TOOL_TYPE_STYLUS; | 21 return MotionEvent::TOOL_TYPE_STYLUS; |
22 case EventPointerType::POINTER_TYPE_TOUCH: | 22 case EventPointerType::POINTER_TYPE_TOUCH: |
23 return MotionEvent::TOOL_TYPE_FINGER; | 23 return MotionEvent::TOOL_TYPE_FINGER; |
| 24 case EventPointerType::POINTER_TYPE_ERASER: |
| 25 return MotionEvent::TOOL_TYPE_ERASER; |
24 } | 26 } |
25 | 27 |
26 return MotionEvent::TOOL_TYPE_UNKNOWN; | 28 return MotionEvent::TOOL_TYPE_UNKNOWN; |
27 } | 29 } |
28 | 30 |
29 PointerProperties GetPointerPropertiesFromTouchEvent(const TouchEvent& touch) { | 31 PointerProperties GetPointerPropertiesFromTouchEvent(const TouchEvent& touch) { |
30 PointerProperties pointer_properties; | 32 PointerProperties pointer_properties; |
31 pointer_properties.x = touch.x(); | 33 pointer_properties.x = touch.x(); |
32 pointer_properties.y = touch.y(); | 34 pointer_properties.y = touch.y(); |
33 pointer_properties.raw_x = touch.root_location_f().x(); | 35 pointer_properties.raw_x = touch.root_location_f().x(); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 171 |
170 int MotionEventAura::GetIndexFromId(int id) const { | 172 int MotionEventAura::GetIndexFromId(int id) const { |
171 int index = FindPointerIndexOfId(id); | 173 int index = FindPointerIndexOfId(id); |
172 // TODO(tdresser): remove these checks once crbug.com/525189 is fixed. | 174 // TODO(tdresser): remove these checks once crbug.com/525189 is fixed. |
173 CHECK_GE(index, 0); | 175 CHECK_GE(index, 0); |
174 CHECK_LT(index, static_cast<int>(GetPointerCount())); | 176 CHECK_LT(index, static_cast<int>(GetPointerCount())); |
175 return index; | 177 return index; |
176 } | 178 } |
177 | 179 |
178 } // namespace ui | 180 } // namespace ui |
OLD | NEW |