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_ |