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

Unified Diff: ash/ime/input_method_event_handler.cc

Issue 1209663002: Use EventHandler for IME (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/ime/input_method_event_handler.h ('k') | ash/shell.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/ime/input_method_event_handler.cc
diff --git a/ash/ime/input_method_event_handler.cc b/ash/ime/input_method_event_handler.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6cac9bba9798341eab45abd9b333062342a51634
--- /dev/null
+++ b/ash/ime/input_method_event_handler.cc
@@ -0,0 +1,36 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/ime/input_method_event_handler.h"
+
+#include "ui/base/ime/input_method.h"
+#include "ui/events/event.h"
+
+namespace ash {
+
+////////////////////////////////////////////////////////////////////////////////
+// InputMethodEventHandler, public:
+
+InputMethodEventHandler::InputMethodEventHandler(ui::InputMethod* input_method)
+ : input_method_(input_method), post_ime_(false) {
+}
+
+InputMethodEventHandler::~InputMethodEventHandler() {
+}
+
+void InputMethodEventHandler::SetPostIME(bool post_ime) {
+ post_ime_ = post_ime;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// InputMethodEventHandler, EventFilter implementation:
+
+void InputMethodEventHandler::OnKeyEvent(ui::KeyEvent* event) {
+ // Never send synthesized key event.
+ if (event->flags() & ui::EF_IS_SYNTHESIZED)
+ return;
+ if (!post_ime_ && input_method_->DispatchKeyEvent(*event))
+ event->StopPropagation();
+}
+}
« no previous file with comments | « ash/ime/input_method_event_handler.h ('k') | ash/shell.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698