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

Unified Diff: components/keyboard_lock/key_event_filter.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/OWNERS ('k') | components/keyboard_lock/keyboard_lock_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/keyboard_lock/key_event_filter.h
diff --git a/components/keyboard_lock/key_event_filter.h b/components/keyboard_lock/key_event_filter.h
new file mode 100644
index 0000000000000000000000000000000000000000..702d4754a3cf49b8249afd35cde6f5c8ec5c23c2
--- /dev/null
+++ b/components/keyboard_lock/key_event_filter.h
@@ -0,0 +1,29 @@
+// 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_KEY_EVENT_FILTER_H_
+#define COMPONENTS_KEYBOARD_LOCK_KEY_EVENT_FILTER_H_
+
+#include "components/keyboard_lock/keyboard_lock_types.h"
+
+namespace keyboard_lock {
+
+// An interface to receive and process a key event. The implementation needs to
+// guarantee the thread-safety of OnKeyDown() and OnKeyUp() functions, which may
+// be executed in an unpredictable thread.
+class KeyEventFilter {
+ public:
+ KeyEventFilter() = default;
+ virtual ~KeyEventFilter() = default;
+
+ // Returns true if the |code| should be suppressed.
+ virtual bool OnKeyDown(NativeKeycode code) = 0;
+
+ // REturns true if the |code| should be suppressed.
+ virtual bool OnKeyUp(NativeKeycode code) = 0;
+};
+
+} // namespace keyboard_lock
+
+#endif // COMPONENTS_KEYBOARD_LOCK_KEY_EVENT_FILTER_H_
« no previous file with comments | « components/keyboard_lock/OWNERS ('k') | components/keyboard_lock/keyboard_lock_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698