OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_KEYBOARD_LOCK_KEY_EVENT_FILTER_H_ |
| 6 #define COMPONENTS_KEYBOARD_LOCK_KEY_EVENT_FILTER_H_ |
| 7 |
| 8 #include "components/keyboard_lock/keyboard_lock_types.h" |
| 9 |
| 10 namespace keyboard_lock { |
| 11 |
| 12 // An interface to receive and process a key event. The implementation needs to |
| 13 // guarantee the thread-safety of OnKeyDown() and OnKeyUp() functions, which may |
| 14 // be executed in an unpredictable thread. |
| 15 class KeyEventFilter { |
| 16 public: |
| 17 KeyEventFilter() = default; |
| 18 virtual ~KeyEventFilter() = default; |
| 19 |
| 20 // Returns true if the |code| should be suppressed. |
| 21 virtual bool OnKeyDown(NativeKeycode code) = 0; |
| 22 |
| 23 // REturns true if the |code| should be suppressed. |
| 24 virtual bool OnKeyUp(NativeKeycode code) = 0; |
| 25 }; |
| 26 |
| 27 } // namespace keyboard_lock |
| 28 |
| 29 #endif // COMPONENTS_KEYBOARD_LOCK_KEY_EVENT_FILTER_H_ |
OLD | NEW |