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_INSTALLER_H_ | |
6 #define COMPONENTS_KEYBOARD_LOCK_KEY_EVENT_INTERCEPTOR_INSTALLER_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "components/keyboard_lock/key_event_interceptor.h" | |
10 | |
11 namespace keyboard_lock { | |
12 | |
13 class KeyboardLockHost; | |
14 | |
15 // Installs itself as the default implementation of KeyEventInterceptor in | |
16 // KeyboardLockHost. | |
17 class KeyEventInterceptorInstaller : public KeyEventInterceptor { | |
Wez
2017/04/28 00:22:44
So this class installs itself as the current KeyEv
Hzj_jie
2017/04/28 20:02:03
Yes, but technically speaking, it won't be destruc
| |
18 public: | |
19 ~KeyEventInterceptorInstaller() override; | |
20 | |
21 protected: | |
22 // |host| should outlive this instance. The ownership of an instance of | |
23 // KeyEventInterceptorInstaller should be taken by KeyboardLockHost but not | |
24 // consumers. A typical derived class should provide a Create() function, | |
25 // calls Installer() function and returns a raw pointer from it. | |
Wez
2017/04/28 00:22:44
Why do we need this complexity? Couldn't the impl
Hzj_jie
2017/04/28 20:02:03
That's too dangerous, the setter is not accessible
| |
26 explicit KeyEventInterceptorInstaller(KeyboardLockHost* host); | |
27 void Install(); | |
28 | |
29 private: | |
30 KeyboardLockHost* const host_; | |
31 | |
32 DISALLOW_COPY_AND_ASSIGN(KeyEventInterceptorInstaller); | |
33 }; | |
34 | |
35 } // namespace keyboard_lock | |
36 | |
37 #endif // COMPONENTS_KEYBOARD_LOCK_KEY_EVENT_INTERCEPTOR_INSTALLER_H_ | |
OLD | NEW |