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

Side by Side Diff: ui/events/cocoa/events_mac.mm

Issue 1975533002: Change ui::Event::time_stamp from TimeDelta to TimeTicks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updates Created 4 years, 7 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
OLDNEW
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/event_utils.h" 5 #include "ui/events/event_utils.h"
6 6
7 #include <Cocoa/Cocoa.h> 7 #include <Cocoa/Cocoa.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 break; 70 break;
71 } 71 }
72 return ET_UNKNOWN; 72 return ET_UNKNOWN;
73 } 73 }
74 74
75 int EventFlagsFromNative(const base::NativeEvent& event) { 75 int EventFlagsFromNative(const base::NativeEvent& event) {
76 NSUInteger modifiers = [event modifierFlags]; 76 NSUInteger modifiers = [event modifierFlags];
77 return EventFlagsFromNSEventWithModifiers(event, modifiers); 77 return EventFlagsFromNSEventWithModifiers(event, modifiers);
78 } 78 }
79 79
80 base::TimeDelta EventTimeFromNative(const base::NativeEvent& native_event) { 80 base::TimeTicks EventTimeFromNative(const base::NativeEvent& native_event) {
81 NSTimeInterval since_system_startup = [native_event timestamp]; 81 NSTimeInterval since_system_startup = [native_event timestamp];
82 // Truncate to extract seconds before doing floating point arithmetic. 82 // Truncate to extract seconds before doing floating point arithmetic.
83 int64_t seconds = since_system_startup; 83 int64_t seconds = since_system_startup;
84 since_system_startup -= seconds; 84 since_system_startup -= seconds;
85 int64_t microseconds = since_system_startup * 1000000; 85 int64_t microseconds = since_system_startup * 1000000;
86 return base::TimeDelta::FromSeconds(seconds) + 86 return base::TimeTicks() + base::TimeDelta::FromSeconds(seconds) +
87 base::TimeDelta::FromMicroseconds(microseconds); 87 base::TimeDelta::FromMicroseconds(microseconds);
88 } 88 }
89 89
90 gfx::Point EventLocationFromNative(const base::NativeEvent& native_event) { 90 gfx::Point EventLocationFromNative(const base::NativeEvent& native_event) {
91 NSWindow* window = [native_event window]; 91 NSWindow* window = [native_event window];
92 if (!window) { 92 if (!window) {
93 NOTIMPLEMENTED(); // Point will be in screen coordinates. 93 NOTIMPLEMENTED(); // Point will be in screen coordinates.
94 return gfx::Point(); 94 return gfx::Point();
95 } 95 }
96 NSPoint location = [native_event locationInWindow]; 96 NSPoint location = [native_event locationInWindow];
97 NSRect content_rect = [window contentRectForFrameRect:[window frame]]; 97 NSRect content_rect = [window contentRectForFrameRect:[window frame]];
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 uint16_t return_value; 258 uint16_t return_value;
259 [text getCharacters:&return_value]; 259 [text getCharacters:&return_value];
260 return return_value; 260 return return_value;
261 } 261 }
262 262
263 bool IsCharFromNative(const base::NativeEvent& native_event) { 263 bool IsCharFromNative(const base::NativeEvent& native_event) {
264 return false; 264 return false;
265 } 265 }
266 266
267 } // namespace ui 267 } // namespace ui
OLDNEW
« base/time/time.h ('K') | « ui/events/blink/blink_event_util.cc ('k') | ui/events/event.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698