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/ozone/events_ozone.h" | |
6 | |
7 #include "ui/events/event.h" | 5 #include "ui/events/event.h" |
8 #include "ui/events/event_constants.h" | 6 #include "ui/events/event_constants.h" |
9 #include "ui/events/event_utils.h" | 7 #include "ui/events/event_utils.h" |
10 | 8 |
11 namespace ui { | 9 namespace ui { |
12 | 10 |
13 void UpdateDeviceList() { NOTIMPLEMENTED(); } | 11 void UpdateDeviceList() { NOTIMPLEMENTED(); } |
14 | 12 |
15 base::TimeDelta EventTimeFromNative(const base::NativeEvent& native_event) { | 13 base::TimeDelta EventTimeFromNative(const base::NativeEvent& native_event) { |
16 const ui::Event* event = static_cast<const ui::Event*>(native_event); | 14 const ui::Event* event = static_cast<const ui::Event*>(native_event); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 if (vx_ordinal) | 155 if (vx_ordinal) |
158 *vx_ordinal = event->x_offset_ordinal(); | 156 *vx_ordinal = event->x_offset_ordinal(); |
159 if (vy_ordinal) | 157 if (vy_ordinal) |
160 *vy_ordinal = event->y_offset_ordinal(); | 158 *vy_ordinal = event->y_offset_ordinal(); |
161 if (is_cancel) | 159 if (is_cancel) |
162 *is_cancel = event->type() == ET_SCROLL_FLING_CANCEL; | 160 *is_cancel = event->type() == ET_SCROLL_FLING_CANCEL; |
163 | 161 |
164 return true; | 162 return true; |
165 } | 163 } |
166 | 164 |
167 int GetModifiersFromKeyState() { | |
168 NOTIMPLEMENTED(); | |
169 return 0; | |
170 } | |
171 | |
172 void DispatchEventFromNativeUiEvent(const base::NativeEvent& native_event, | |
173 base::Callback<void(ui::Event*)> callback) { | |
174 ui::Event* native_ui_event = static_cast<ui::Event*>(native_event); | |
175 if (native_ui_event->IsKeyEvent()) { | |
176 ui::KeyEvent key_event(native_event); | |
177 callback.Run(&key_event); | |
178 } else if (native_ui_event->IsMouseWheelEvent()) { | |
179 ui::MouseWheelEvent wheel_event(native_event); | |
180 callback.Run(&wheel_event); | |
181 } else if (native_ui_event->IsMouseEvent()) { | |
182 ui::MouseEvent mouse_event(native_event); | |
183 callback.Run(&mouse_event); | |
184 } else if (native_ui_event->IsTouchEvent()) { | |
185 ui::TouchEvent touch_event(native_event); | |
186 callback.Run(&touch_event); | |
187 } else if (native_ui_event->IsScrollEvent()) { | |
188 ui::ScrollEvent scroll_event(native_event); | |
189 callback.Run(&scroll_event); | |
190 } else if (native_ui_event->IsGestureEvent()) { | |
191 callback.Run(native_ui_event); | |
192 // TODO(mohsen): Use the same pattern for scroll/touch/wheel events. | |
193 // Apparently, there is no need for them to wrap the |native_event|. | |
194 } else { | |
195 NOTREACHED(); | |
196 } | |
197 } | |
198 | |
199 } // namespace ui | 165 } // namespace ui |
OLD | NEW |