Chromium Code Reviews| Index: components/arc/ime/arc_ime_bridge.cc |
| diff --git a/components/arc/ime/arc_ime_bridge.cc b/components/arc/ime/arc_ime_bridge.cc |
| index 669cdd23b16b0e0163a44d9c642188a0fe326d43..50b024aa55b75ad6e8f1c88fc38bc388e3d97986 100644 |
| --- a/components/arc/ime/arc_ime_bridge.cc |
| +++ b/components/arc/ime/arc_ime_bridge.cc |
| @@ -35,7 +35,8 @@ ArcImeBridge::ArcImeBridge(ArcBridgeService* bridge_service) |
| : ArcService(bridge_service), |
| ipc_host_(new ArcImeIpcHostImpl(this, bridge_service)), |
| ime_type_(ui::TEXT_INPUT_TYPE_NONE), |
| - has_composition_text_(false) { |
| + has_composition_text_(false), |
| + test_input_method_(nullptr) { |
| aura::Env* env = aura::Env::GetInstanceDontCreate(); |
| if (env) |
| env->AddObserver(this); |
| @@ -60,7 +61,14 @@ void ArcImeBridge::SetIpcHostForTesting( |
| ipc_host_ = std::move(test_ipc_host); |
| } |
| +void ArcImeBridge::SetInputMethodForTesting( |
| + ui::InputMethod* test_input_method) { |
| + test_input_method_ = test_input_method; |
| +} |
| + |
| ui::InputMethod* ArcImeBridge::GetInputMethod() { |
| + if (test_input_method_) |
| + return test_input_method_; |
| if (!focused_arc_window_.has_windows()) |
| return nullptr; |
| return focused_arc_window_.windows().front()->GetHost()->GetInputMethod(); |
| @@ -114,8 +122,13 @@ void ArcImeBridge::OnTextInputTypeChanged(ui::TextInputType type) { |
| ime_type_ = type; |
| ui::InputMethod* const input_method = GetInputMethod(); |
| - if (input_method) |
| + if (input_method) { |
| input_method->OnTextInputTypeChanged(this); |
| + if (input_method->GetTextInputClient() == this && |
|
hidehiko
2016/01/26 08:05:53
IMHO, this should work, and practically cover most
kinaba
2016/01/26 08:28:59
You're right. Added the TODO comment as suggested.
|
| + ime_type_ != ui::TEXT_INPUT_TYPE_NONE) { |
| + input_method->ShowImeIfNeeded(); |
| + } |
| + } |
| } |
| void ArcImeBridge::OnCursorRectChanged(const gfx::Rect& rect) { |