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

Unified Diff: components/keyboard_lock/keyboard_lock_types.h

Issue 2815023002: [System-Keyboard-Lock] Add KeyboardLockHost and KeyEventInterceptor (Closed)
Patch Set: Use NativeKeycode instead of ui::KeyboardCode Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/keyboard_lock/keyboard_lock_host_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_
« no previous file with comments | « components/keyboard_lock/keyboard_lock_host_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698