OLD | NEW |
| (Empty) |
1 // Copyright 2016 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 EXTENSIONS_SHELL_BROWSER_INPUT_METHOD_EVENT_HANDLER_H_ | |
6 #define EXTENSIONS_SHELL_BROWSER_INPUT_METHOD_EVENT_HANDLER_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "ui/events/event_handler.h" | |
10 | |
11 namespace ui { | |
12 class InputMethod; | |
13 class KeyEvent; | |
14 } | |
15 | |
16 namespace extensions { | |
17 | |
18 // Basic EventHandler for dispatching key events. | |
19 class InputMethodEventHandler : public ui::EventHandler { | |
20 public: | |
21 explicit InputMethodEventHandler(ui::InputMethod* input_method); | |
22 ~InputMethodEventHandler() override; | |
23 | |
24 void set_post_ime(bool post_ime); | |
25 | |
26 private: | |
27 // ui::EventHandler: | |
28 void OnKeyEvent(ui::KeyEvent* event) override; | |
29 | |
30 // The input method to pass events. Should outlive this handler. | |
31 ui::InputMethod* input_method_; | |
32 | |
33 // True when an event is dispatched within DispatchKeyEventPostIME(), meaning | |
34 // it has already been processed by the input method. | |
35 bool post_ime_; | |
36 | |
37 DISALLOW_COPY_AND_ASSIGN(InputMethodEventHandler); | |
38 }; | |
39 | |
40 } // namespace extensions | |
41 | |
42 #endif // EXTENSIONS_SHELL_BROWSER_INPUT_METHOD_EVENT_HANDLER_H_ | |
OLD | NEW |