Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Side by Side Diff: ui/events/event_utils.h

Issue 2007083002: Validate that ui::Event::time_stamp comes from the same clock as TimeTicks::Now (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@453559-use-timeticks-ui-event
Patch Set: Address feedback Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/events/cocoa/events_mac.mm ('k') | ui/events/event_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
11 11
12 #include "base/event_types.h" 12 #include "base/event_types.h"
13 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "ui/display/display.h" 15 #include "ui/display/display.h"
16 #include "ui/events/base_event_utils.h"
16 #include "ui/events/event.h" 17 #include "ui/events/event.h"
17 #include "ui/events/event_constants.h" 18 #include "ui/events/event_constants.h"
18 #include "ui/events/events_export.h" 19 #include "ui/events/events_export.h"
19 #include "ui/events/keycodes/keyboard_codes.h" 20 #include "ui/events/keycodes/keyboard_codes.h"
20 #include "ui/gfx/native_widget_types.h" 21 #include "ui/gfx/native_widget_types.h"
21 22
22 #if defined(OS_WIN) 23 #if defined(OS_WIN)
23 #include <windows.h> 24 #include <windows.h>
24 #endif 25 #endif
25 26
(...skipping 24 matching lines...) Expand all
50 51
51 // Get the EventFlags from a native event. 52 // Get the EventFlags from a native event.
52 EVENTS_EXPORT int EventFlagsFromNative(const base::NativeEvent& native_event); 53 EVENTS_EXPORT int EventFlagsFromNative(const base::NativeEvent& native_event);
53 54
54 // Get the timestamp from a native event. 55 // Get the timestamp from a native event.
55 // Note: This is not a pure function meaning that multiple applications on the 56 // Note: This is not a pure function meaning that multiple applications on the
56 // same native event may return different values. 57 // same native event may return different values.
57 EVENTS_EXPORT base::TimeTicks EventTimeFromNative( 58 EVENTS_EXPORT base::TimeTicks EventTimeFromNative(
58 const base::NativeEvent& native_event); 59 const base::NativeEvent& native_event);
59 60
60 // Create a timestamp based on the current time. 61 // Ensures that the event timestamp values are coming from the same underlying
61 // TODO(majidvp): Get rid of this in favor of call to TimeTicks::Now(). 62 // monotonic clock as base::TimeTicks::Now() and if it is not then falls
62 // crbug.com/453559 63 // back to using the current ticks for event timestamp.
63 EVENTS_EXPORT base::TimeTicks EventTimeForNow(); 64 EVENTS_EXPORT void ValidateEventTimeClock(base::TimeTicks* timestamp);
64 65
65 // Get the location from a native event. The coordinate system of the resultant 66 // Get the location from a native event. The coordinate system of the resultant
66 // |Point| has the origin at top-left of the "root window". The nature of 67 // |Point| has the origin at top-left of the "root window". The nature of
67 // this "root window" and how it maps to platform-specific drawing surfaces is 68 // this "root window" and how it maps to platform-specific drawing surfaces is
68 // defined in ui/aura/root_window.* and ui/aura/window_tree_host*. 69 // defined in ui/aura/root_window.* and ui/aura/window_tree_host*.
69 // TODO(tdresser): Return gfx::PointF here. See crbug.com/337827. 70 // TODO(tdresser): Return gfx::PointF here. See crbug.com/337827.
70 EVENTS_EXPORT gfx::Point EventLocationFromNative( 71 EVENTS_EXPORT gfx::Point EventLocationFromNative(
71 const base::NativeEvent& native_event); 72 const base::NativeEvent& native_event);
72 73
73 // Gets the location in native system coordinate space. 74 // Gets the location in native system coordinate space.
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 // Update the native X11 event to correspond to the new button flags. 176 // Update the native X11 event to correspond to the new button flags.
176 EVENTS_EXPORT void UpdateX11EventForChangedButtonFlags(MouseEvent* event); 177 EVENTS_EXPORT void UpdateX11EventForChangedButtonFlags(MouseEvent* event);
177 #endif 178 #endif
178 179
179 // Registers a custom event type. 180 // Registers a custom event type.
180 EVENTS_EXPORT int RegisterCustomEventType(); 181 EVENTS_EXPORT int RegisterCustomEventType();
181 182
182 } // namespace ui 183 } // namespace ui
183 184
184 #endif // UI_EVENTS_EVENT_UTILS_H_ 185 #endif // UI_EVENTS_EVENT_UTILS_H_
OLDNEW
« no previous file with comments | « ui/events/cocoa/events_mac.mm ('k') | ui/events/event_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698