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

Side by Side Diff: ui/events/base_event_utils.cc

Issue 1975533002: Change ui::Event::time_stamp from TimeDelta to TimeTicks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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/base_event_utils.h ('k') | ui/events/blink/blink_event_util.h » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/base_event_utils.h" 5 #include "ui/events/base_event_utils.h"
6 6
7 #include "base/atomic_sequence_num.h" 7 #include "base/atomic_sequence_num.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/time/time.h"
10 #include "build/build_config.h" 11 #include "build/build_config.h"
11 #include "ui/events/event_constants.h" 12 #include "ui/events/event_constants.h"
12 #include "ui/events/event_switches.h" 13 #include "ui/events/event_switches.h"
13 14
14 namespace ui { 15 namespace ui {
15 16
16 namespace { 17 namespace {
17 18
18 #if defined(OS_CHROMEOS) 19 #if defined(OS_CHROMEOS)
19 const int kSystemKeyModifierMask = EF_ALT_DOWN | EF_COMMAND_DOWN; 20 const int kSystemKeyModifierMask = EF_ALT_DOWN | EF_COMMAND_DOWN;
(...skipping 15 matching lines...) Expand all
35 return id; 36 return id;
36 } 37 }
37 38
38 bool IsSystemKeyModifier(int flags) { 39 bool IsSystemKeyModifier(int flags) {
39 // AltGr modifier is used to type alternative keys on certain keyboard layouts 40 // AltGr modifier is used to type alternative keys on certain keyboard layouts
40 // so we don't consider keys with the AltGr modifier as a system key. 41 // so we don't consider keys with the AltGr modifier as a system key.
41 return (kSystemKeyModifierMask & flags) != 0 && 42 return (kSystemKeyModifierMask & flags) != 0 &&
42 (EF_ALTGR_DOWN & flags) == 0; 43 (EF_ALTGR_DOWN & flags) == 0;
43 } 44 }
44 45
46 double EventTimeStampToSeconds(base::TimeTicks time_stamp) {
47 return (time_stamp - base::TimeTicks()).InSecondsF();
48 }
49
50 base::TimeTicks EventTimeStampFromSeconds(double time_stamp_seconds) {
51 return base::TimeTicks() + base::TimeDelta::FromSecondsD(time_stamp_seconds);
52 }
53
45 } // namespace ui 54 } // namespace ui
46 55
OLDNEW
« no previous file with comments | « ui/events/base_event_utils.h ('k') | ui/events/blink/blink_event_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698