Chromium Code Reviews| 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. The implementation needs to | |
| 13 // guarantee the thread-safety of OnKeyDown() and OnKeyUp() functions, which may | |
| 14 // be executed in a unpredictable thread. | |
| 15 class KeyEventInterceptor { | |
|
Wez
2017/04/28 00:22:44
"interceptor" sounds like this is the thing that i
Hzj_jie
2017/04/28 20:02:03
Yes, it does intercept the events, it controls whe
| |
| 16 public: | |
| 17 KeyEventInterceptor() = default; | |
| 18 virtual ~KeyEventInterceptor() = default; | |
| 19 | |
| 20 virtual bool OnKeyDown(ui::KeyboardCode code) = 0; | |
| 21 virtual bool OnKeyUp(ui::KeyboardCode code) = 0; | |
|
Wez
2017/04/28 00:22:44
ui::KeyboardCode is evil and deprecated. :P
Is it
Hzj_jie
2017/04/28 20:02:03
That's too bad. I suppose there is always a replac
| |
| 22 | |
| 23 // An interface to retrieve a KeyEventInterceptor instance. This class is used | |
| 24 // to avoid the dependency of the singleton object of KeyboardLockHost, and to | |
| 25 // ensure late installed KeyEventInterceptor can be retrieved. | |
| 26 class Retriever { | |
| 27 public: | |
| 28 Retriever() = default; | |
| 29 virtual ~Retriever() = default; | |
| 30 | |
| 31 // May return nullptr. | |
| 32 virtual KeyEventInterceptor* Get() = 0; | |
| 33 }; | |
| 34 }; | |
| 35 | |
| 36 } // namespace keyboard_lock | |
| 37 | |
| 38 #endif // COMPONENTS_KEYBOARD_LOCK_KEY_EVENT_INTERCEPTOR_H_ | |
| OLD | NEW |