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

Side by Side Diff: components/keyboard_lock/key_event_interceptor.h

Issue 2815023002: [System-Keyboard-Lock] Add KeyboardLockHost and KeyEventInterceptor (Closed)
Patch Set: More comments Created 3 years, 8 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 unified diff | Download patch
OLDNEW
(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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698