| 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
|
|
|