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

Unified Diff: ui/aura/test/input_method_glue.cc

Issue 2166863002: aura: Fix IME interaction in content-shell in chromeos build. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
Index: ui/aura/test/input_method_glue.cc
diff --git a/ui/aura/test/input_method_glue.cc b/ui/aura/test/input_method_glue.cc
new file mode 100644
index 0000000000000000000000000000000000000000..10d0f647b75e685b609e1b2965db66443e267844
--- /dev/null
+++ b/ui/aura/test/input_method_glue.cc
@@ -0,0 +1,37 @@
+// Copyright 2016 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 "ui/aura/test/input_method_glue.h"
+
+#include "ui/aura/env.h"
+#include "ui/aura/window_tree_host.h"
+#include "ui/base/ime/input_method.h"
+#include "ui/events/event.h"
+
+namespace aura {
+
+InputMethodGlue::InputMethodGlue(aura::WindowTreeHost* host) : host_(host) {
+ aura::Env::GetInstance()->AddPreTargetHandler(this);
+ host_->GetInputMethod()->SetDelegate(this);
+}
+
+InputMethodGlue::~InputMethodGlue() {
+ host_->GetInputMethod()->SetDelegate(host_);
+ aura::Env::GetInstance()->RemovePreTargetHandler(this);
+}
+
+void InputMethodGlue::OnKeyEvent(ui::KeyEvent* key) {
+ if (processing_ime_event_)
+ return;
+ host_->GetInputMethod()->DispatchKeyEvent(key);
+ key->StopPropagation();
+}
+
+ui::EventDispatchDetails InputMethodGlue::DispatchKeyEventPostIME(
+ ui::KeyEvent* key) {
+ base::AutoReset<bool> reset(&processing_ime_event_, true);
+ return host_->DispatchKeyEventPostIME(key);
+}
+
+} // namespace aura

Powered by Google App Engine
This is Rietveld 408576698