| 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 default: |
| 25 return MotionEvent::TOOL_TYPE_UNKNOWN; |
| 24 } | 26 } |
| 25 | |
| 26 return MotionEvent::TOOL_TYPE_UNKNOWN; | |
| 27 } | 27 } |
| 28 | 28 |
| 29 PointerProperties GetPointerPropertiesFromTouchEvent(const TouchEvent& touch) { | 29 PointerProperties GetPointerPropertiesFromTouchEvent(const TouchEvent& touch) { |
| 30 PointerProperties pointer_properties; | 30 PointerProperties pointer_properties; |
| 31 pointer_properties.x = touch.x(); | 31 pointer_properties.x = touch.x(); |
| 32 pointer_properties.y = touch.y(); | 32 pointer_properties.y = touch.y(); |
| 33 pointer_properties.raw_x = touch.root_location_f().x(); | 33 pointer_properties.raw_x = touch.root_location_f().x(); |
| 34 pointer_properties.raw_y = touch.root_location_f().y(); | 34 pointer_properties.raw_y = touch.root_location_f().y(); |
| 35 pointer_properties.id = touch.touch_id(); | 35 pointer_properties.id = touch.touch_id(); |
| 36 pointer_properties.pressure = touch.pointer_details().force; | 36 pointer_properties.pressure = touch.pointer_details().force; |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 169 |
| 170 int MotionEventAura::GetIndexFromId(int id) const { | 170 int MotionEventAura::GetIndexFromId(int id) const { |
| 171 int index = FindPointerIndexOfId(id); | 171 int index = FindPointerIndexOfId(id); |
| 172 // TODO(tdresser): remove these checks once crbug.com/525189 is fixed. | 172 // TODO(tdresser): remove these checks once crbug.com/525189 is fixed. |
| 173 CHECK_GE(index, 0); | 173 CHECK_GE(index, 0); |
| 174 CHECK_LT(index, static_cast<int>(GetPointerCount())); | 174 CHECK_LT(index, static_cast<int>(GetPointerCount())); |
| 175 return index; | 175 return index; |
| 176 } | 176 } |
| 177 | 177 |
| 178 } // namespace ui | 178 } // namespace ui |
| OLD | NEW |