OLD | NEW |
| (Empty) |
1 // Copyright 2015 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 #include "ash/ime/input_method_event_handler.h" | |
6 | |
7 #include "ui/base/ime/input_method.h" | |
8 #include "ui/events/event.h" | |
9 | |
10 namespace ash { | |
11 | |
12 //////////////////////////////////////////////////////////////////////////////// | |
13 // InputMethodEventHandler, public: | |
14 | |
15 InputMethodEventHandler::InputMethodEventHandler(ui::InputMethod* input_method) | |
16 : input_method_(input_method), post_ime_(false) {} | |
17 | |
18 InputMethodEventHandler::~InputMethodEventHandler() {} | |
19 | |
20 void InputMethodEventHandler::SetPostIME(bool post_ime) { | |
21 post_ime_ = post_ime; | |
22 } | |
23 | |
24 //////////////////////////////////////////////////////////////////////////////// | |
25 // InputMethodEventHandler, EventFilter implementation: | |
26 | |
27 void InputMethodEventHandler::OnKeyEvent(ui::KeyEvent* event) { | |
28 // Never send synthesized key event. | |
29 if (event->flags() & ui::EF_IS_SYNTHESIZED) | |
30 return; | |
31 if (post_ime_) | |
32 return; | |
33 input_method_->DispatchKeyEvent(event); | |
34 event->StopPropagation(); | |
35 } | |
36 | |
37 } // namespace ash | |
OLD | NEW |