Index: components/keyboard_lock/keyboard_lock_types.h |
diff --git a/components/keyboard_lock/keyboard_lock_types.h b/components/keyboard_lock/keyboard_lock_types.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..04940f456f9bbf921b88a360e8e6ac48714b8330 |
--- /dev/null |
+++ b/components/keyboard_lock/keyboard_lock_types.h |
@@ -0,0 +1,28 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef COMPONENTS_KEYBOARD_LOCK_KEYBOARD_LOCK_TYPES_H_ |
+#define COMPONENTS_KEYBOARD_LOCK_KEYBOARD_LOCK_TYPES_H_ |
+ |
+#include <type_traits> |
+#include <utility> |
+ |
+#include "ui/events/keycodes/dom/keycode_converter.h" |
+ |
+namespace keyboard_lock { |
+ |
+// The type to represent a layout independent native keycode. |
+// https://cs.chromium.org/chromium/src/ui/events/keycodes/dom/keycode_converter.h?l=36&gs=cpp%253Aui%253A%253A%253Calias-of-KeycodeMapEntry%253E%253A%253Anative_keycode%2540chromium%252F..%252F..%252Fui%252Fevents%252Fkeycodes%252Fdom%252Fkeycode_converter.h%257Cdef&gsn=native_keycode&ct=xref_usages |
+// Though it equals to integer, most of the components in the keyboard_lock |
+// expects it to be in range [0, 256). Keyboard events out of this range will |
+// usually be ignored. |
+typedef decltype(std::declval<ui::KeycodeMapEntry>().native_keycode) |
+ NativeKeycode; |
+ |
+static_assert(std::is_same<NativeKeycode, int>::value, |
+ "Expect native_keycode to be int"); |
+ |
+} // namespace keyboard_lock |
+ |
+#endif // COMPONENTS_KEYBOARD_LOCK_KEYBOARD_LOCK_TYPES_H_ |