| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "ui/events/event_constants.h" | 6 #include "ui/events/event_constants.h" |
| 7 #include "ui/events/event_utils.h" | 7 #include "ui/events/event_utils.h" |
| 8 | 8 |
| 9 namespace ui { | 9 namespace ui { |
| 10 | 10 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 } | 39 } |
| 40 | 40 |
| 41 int GetChangedMouseButtonFlagsFromNative( | 41 int GetChangedMouseButtonFlagsFromNative( |
| 42 const base::NativeEvent& native_event) { | 42 const base::NativeEvent& native_event) { |
| 43 const ui::MouseEvent* event = | 43 const ui::MouseEvent* event = |
| 44 static_cast<const ui::MouseEvent*>(native_event); | 44 static_cast<const ui::MouseEvent*>(native_event); |
| 45 DCHECK(event->IsMouseEvent() || event->IsScrollEvent()); | 45 DCHECK(event->IsMouseEvent() || event->IsScrollEvent()); |
| 46 return event->changed_button_flags(); | 46 return event->changed_button_flags(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 PointerDetails GetMousePointerDetailsFromNative( |
| 50 const base::NativeEvent& native_event) { |
| 51 const ui::MouseEvent* event = |
| 52 static_cast<const ui::MouseEvent*>(native_event); |
| 53 DCHECK(event->IsMouseEvent() || event->IsScrollEvent()); |
| 54 return event->pointer_details(); |
| 55 } |
| 56 |
| 49 KeyboardCode KeyboardCodeFromNative(const base::NativeEvent& native_event) { | 57 KeyboardCode KeyboardCodeFromNative(const base::NativeEvent& native_event) { |
| 50 const ui::KeyEvent* event = static_cast<const ui::KeyEvent*>(native_event); | 58 const ui::KeyEvent* event = static_cast<const ui::KeyEvent*>(native_event); |
| 51 DCHECK(event->IsKeyEvent()); | 59 DCHECK(event->IsKeyEvent()); |
| 52 return event->key_code(); | 60 return event->key_code(); |
| 53 } | 61 } |
| 54 | 62 |
| 55 DomCode CodeFromNative(const base::NativeEvent& native_event) { | 63 DomCode CodeFromNative(const base::NativeEvent& native_event) { |
| 56 const ui::KeyEvent* event = static_cast<const ui::KeyEvent*>(native_event); | 64 const ui::KeyEvent* event = static_cast<const ui::KeyEvent*>(native_event); |
| 57 DCHECK(event->IsKeyEvent()); | 65 DCHECK(event->IsKeyEvent()); |
| 58 return event->code(); | 66 return event->code(); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 *vx_ordinal = event->x_offset_ordinal(); | 164 *vx_ordinal = event->x_offset_ordinal(); |
| 157 if (vy_ordinal) | 165 if (vy_ordinal) |
| 158 *vy_ordinal = event->y_offset_ordinal(); | 166 *vy_ordinal = event->y_offset_ordinal(); |
| 159 if (is_cancel) | 167 if (is_cancel) |
| 160 *is_cancel = event->type() == ET_SCROLL_FLING_CANCEL; | 168 *is_cancel = event->type() == ET_SCROLL_FLING_CANCEL; |
| 161 | 169 |
| 162 return true; | 170 return true; |
| 163 } | 171 } |
| 164 | 172 |
| 165 } // namespace ui | 173 } // namespace ui |
| OLD | NEW |