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

Side by Side Diff: extensions/shell/browser/input_method_event_handler.cc

Issue 2580733002: AppShell: Create input method and handle key events (Closed)
Patch Set: rebase Created 4 years 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 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 #include "extensions/shell/browser/input_method_event_handler.h"
6
7 #include "ui/base/ime/input_method.h"
8 #include "ui/events/event.h"
9
10 namespace extensions {
11
12 InputMethodEventHandler::InputMethodEventHandler(ui::InputMethod* input_method)
13 : input_method_(input_method), post_ime_(false) {}
James Cook 2016/12/16 19:00:50 nit: DCHECK(input_method_) so it's self documentin
michaelpg 2016/12/17 03:07:46 Done.
14
15 InputMethodEventHandler::~InputMethodEventHandler() {}
16
17 void InputMethodEventHandler::set_post_ime(bool post_ime) {
18 post_ime_ = post_ime;
19 }
20
21 void InputMethodEventHandler::OnKeyEvent(ui::KeyEvent* event) {
22 // Ignore events being dispatched back to the delegate from the input method.
23 if (post_ime_)
24 return;
25
26 if (event->flags() & ui::EF_IS_SYNTHESIZED)
27 return;
28
29 input_method_->DispatchKeyEvent(event);
30 event->StopPropagation();
31 }
32
33 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698