OLD | NEW |
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 Loading... |
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 |
OLD | NEW |