Chromium Code Reviews| 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/logging.h" | 8 #include "base/logging.h" |
| 9 #include "ui/events/event_constants.h" | |
| 9 | 10 |
| 10 namespace ui { | 11 namespace ui { |
| 11 | 12 |
| 13 namespace { | |
| 14 | |
| 15 #if defined(OS_CHROMEOS) | |
| 16 const int kModifierMask = EF_ALT_DOWN | EF_COMMAND_DOWN; | |
|
kpschoedel
2015/09/04 18:06:13
nit: kSystemKeyModifierMask for consistency
afakhry
2015/09/04 18:26:35
Done.
| |
| 17 #else | |
| 18 const int kModifierMask = EF_ALT_DOWN; | |
| 19 #endif // defined(OS_CHROMEOS) | |
| 20 | |
| 21 | |
| 22 } // namespace | |
| 23 | |
| 12 base::StaticAtomicSequenceNumber g_next_event_id; | 24 base::StaticAtomicSequenceNumber g_next_event_id; |
| 13 | 25 |
| 14 uint32 GetNextTouchEventId() { | 26 uint32 GetNextTouchEventId() { |
| 15 // Set the first touch event ID to 1 because we set id to 0 for other types | 27 // Set the first touch event ID to 1 because we set id to 0 for other types |
| 16 // of events. | 28 // of events. |
| 17 uint32 id = g_next_event_id.GetNext(); | 29 uint32 id = g_next_event_id.GetNext(); |
| 18 if (id == 0) | 30 if (id == 0) |
| 19 id = g_next_event_id.GetNext(); | 31 id = g_next_event_id.GetNext(); |
| 20 DCHECK_NE(0U, id); | 32 DCHECK_NE(0U, id); |
| 21 return id; | 33 return id; |
| 22 } | 34 } |
| 23 | 35 |
| 36 bool IsSystemKeyModifier(int flags, bool allow_altgr) { | |
| 37 return (allow_altgr || (flags & EF_ALTGR_DOWN) == 0) && | |
| 38 (kModifierMask & flags) != 0; | |
| 39 } | |
| 40 | |
| 24 } // namespace ui | 41 } // namespace ui |
| 25 | 42 |
| OLD | NEW |