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_INTERCEPTOR_H_ |
| 6 #define COMPONENTS_KEYBOARD_LOCK_KEY_EVENT_INTERCEPTOR_H_ |
| 7 |
| 8 #include "ui/events/keycodes/keyboard_codes.h" |
| 9 |
| 10 namespace keyboard_lock { |
| 11 |
| 12 // An interface to receive and process a key event. |
| 13 class KeyEventInterceptor { |
| 14 public: |
| 15 KeyEventInterceptor() = default; |
| 16 virtual ~KeyEventInterceptor() = default; |
| 17 |
| 18 virtual bool OnKeyDown(ui::KeyboardCode code) = 0; |
| 19 virtual bool OnKeyUp(ui::KeyboardCode code) = 0; |
| 20 |
| 21 // An interface to retrieve a KeyEventInterceptor instance. This class is used |
| 22 // to avoid the dependency of the singleton object of KeyboardLockHost, and to |
| 23 // ensure late installed KeyEventInterceptor can be retrieved. |
| 24 class Retriever { |
| 25 public: |
| 26 Retriever() = default; |
| 27 virtual ~Retriever() = default; |
| 28 |
| 29 // May return nullptr. |
| 30 virtual KeyEventInterceptor* Get() = 0; |
| 31 }; |
| 32 }; |
| 33 |
| 34 } // namespace keyboard_lock |
| 35 |
| 36 #endif // COMPONENTS_KEYBOARD_LOCK_KEY_EVENT_INTERCEPTOR_H_ |
OLD | NEW |