| 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 #ifndef UI_EVENTS_EVENT_UTILS_H_ | 5 #ifndef UI_EVENTS_EVENT_UTILS_H_ |
| 6 #define UI_EVENTS_EVENT_UTILS_H_ | 6 #define UI_EVENTS_EVENT_UTILS_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #if defined(OS_WIN) | 22 #if defined(OS_WIN) |
| 23 #include <windows.h> | 23 #include <windows.h> |
| 24 #endif | 24 #endif |
| 25 | 25 |
| 26 namespace gfx { | 26 namespace gfx { |
| 27 class Point; | 27 class Point; |
| 28 class Vector2d; | 28 class Vector2d; |
| 29 } | 29 } |
| 30 | 30 |
| 31 namespace base { | 31 namespace base { |
| 32 class TimeDelta; | 32 class TimeTicks; |
| 33 } | 33 } |
| 34 | 34 |
| 35 // Common functions to be used for all platforms except Android. | 35 // Common functions to be used for all platforms except Android. |
| 36 namespace ui { | 36 namespace ui { |
| 37 | 37 |
| 38 class Event; | 38 class Event; |
| 39 class MouseEvent; | 39 class MouseEvent; |
| 40 enum class DomCode; | 40 enum class DomCode; |
| 41 | 41 |
| 42 // Returns a ui::Event wrapping a native event. Ownership of the returned value | 42 // Returns a ui::Event wrapping a native event. Ownership of the returned value |
| 43 // is transferred to the caller. | 43 // is transferred to the caller. |
| 44 EVENTS_EXPORT std::unique_ptr<Event> EventFromNative( | 44 EVENTS_EXPORT std::unique_ptr<Event> EventFromNative( |
| 45 const base::NativeEvent& native_event); | 45 const base::NativeEvent& native_event); |
| 46 | 46 |
| 47 // Get the EventType from a native event. | 47 // Get the EventType from a native event. |
| 48 EVENTS_EXPORT EventType EventTypeFromNative( | 48 EVENTS_EXPORT EventType EventTypeFromNative( |
| 49 const base::NativeEvent& native_event); | 49 const base::NativeEvent& native_event); |
| 50 | 50 |
| 51 // Get the EventFlags from a native event. | 51 // Get the EventFlags from a native event. |
| 52 EVENTS_EXPORT int EventFlagsFromNative(const base::NativeEvent& native_event); | 52 EVENTS_EXPORT int EventFlagsFromNative(const base::NativeEvent& native_event); |
| 53 | 53 |
| 54 // Get the timestamp from a native event. | 54 // Get the timestamp from a native event. |
| 55 // Note: This is not a pure function meaning that multiple applications on the | 55 // Note: This is not a pure function meaning that multiple applications on the |
| 56 // same native event may return different values. | 56 // same native event may return different values. |
| 57 EVENTS_EXPORT base::TimeDelta EventTimeFromNative( | 57 EVENTS_EXPORT base::TimeTicks EventTimeFromNative( |
| 58 const base::NativeEvent& native_event); | 58 const base::NativeEvent& native_event); |
| 59 | 59 |
| 60 // Create a timestamp based on the current time. | 60 // Create a timestamp based on the current time. |
| 61 EVENTS_EXPORT base::TimeDelta EventTimeForNow(); | 61 // TODO(majidvp): Get rid of this in favor of call to TimeTicks::Now(). |
| 62 // crbug.com/453559 |
| 63 EVENTS_EXPORT base::TimeTicks EventTimeForNow(); |
| 62 | 64 |
| 63 // Get the location from a native event. The coordinate system of the resultant | 65 // Get the location from a native event. The coordinate system of the resultant |
| 64 // |Point| has the origin at top-left of the "root window". The nature of | 66 // |Point| has the origin at top-left of the "root window". The nature of |
| 65 // this "root window" and how it maps to platform-specific drawing surfaces is | 67 // this "root window" and how it maps to platform-specific drawing surfaces is |
| 66 // defined in ui/aura/root_window.* and ui/aura/window_tree_host*. | 68 // defined in ui/aura/root_window.* and ui/aura/window_tree_host*. |
| 67 // TODO(tdresser): Return gfx::PointF here. See crbug.com/337827. | 69 // TODO(tdresser): Return gfx::PointF here. See crbug.com/337827. |
| 68 EVENTS_EXPORT gfx::Point EventLocationFromNative( | 70 EVENTS_EXPORT gfx::Point EventLocationFromNative( |
| 69 const base::NativeEvent& native_event); | 71 const base::NativeEvent& native_event); |
| 70 | 72 |
| 71 // Gets the location in native system coordinate space. | 73 // Gets the location in native system coordinate space. |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 // Update the native X11 event to correspond to the new button flags. | 175 // Update the native X11 event to correspond to the new button flags. |
| 174 EVENTS_EXPORT void UpdateX11EventForChangedButtonFlags(MouseEvent* event); | 176 EVENTS_EXPORT void UpdateX11EventForChangedButtonFlags(MouseEvent* event); |
| 175 #endif | 177 #endif |
| 176 | 178 |
| 177 // Registers a custom event type. | 179 // Registers a custom event type. |
| 178 EVENTS_EXPORT int RegisterCustomEventType(); | 180 EVENTS_EXPORT int RegisterCustomEventType(); |
| 179 | 181 |
| 180 } // namespace ui | 182 } // namespace ui |
| 181 | 183 |
| 182 #endif // UI_EVENTS_EVENT_UTILS_H_ | 184 #endif // UI_EVENTS_EVENT_UTILS_H_ |
| OLD | NEW |