Chromium Code Reviews| Index: ui/aura/mus/window_tree_host_mus.cc |
| diff --git a/ui/aura/mus/window_tree_host_mus.cc b/ui/aura/mus/window_tree_host_mus.cc |
| index 2c6f3b2dd4321994dd07a7f0c902d7e939ed1945..2e7f9e5da536278203ed14d70f9340ffc29ffea3 100644 |
| --- a/ui/aura/mus/window_tree_host_mus.cc |
| +++ b/ui/aura/mus/window_tree_host_mus.cc |
| @@ -19,6 +19,10 @@ |
| #include "ui/events/event.h" |
| #include "ui/platform_window/stub/stub_window.h" |
| +#if defined(OS_CHROMEOS) |
| +#include "ui/base/ime/input_method_chromeos.h" |
| +#endif |
| + |
| DECLARE_UI_CLASS_PROPERTY_TYPE(aura::WindowTreeHostMus*); |
| namespace aura { |
| @@ -80,10 +84,7 @@ WindowTreeHostMus::WindowTreeHostMus(WindowTreeHostMusInitParams init_params) |
| SetPlatformWindow( |
| base::MakeUnique<ui::StubWindow>(this, use_default_accelerated_widget)); |
| - input_method_ = base::MakeUnique<InputMethodMus>(this, window()); |
| - input_method_->Init(init_params.window_tree_client->connector()); |
| - SetSharedInputMethod(input_method_.get()); |
| - |
| + InitInputMethod(&init_params); |
| compositor()->SetHostHasTransparentBackground(true); |
| // Mus windows are assumed hidden. |
| @@ -119,6 +120,19 @@ void WindowTreeHostMus::SetBoundsFromServer(const gfx::Rect& bounds_in_pixels) { |
| SetBoundsInPixels(bounds_in_pixels); |
| } |
| +void WindowTreeHostMus::DispatchEventToInputMethod( |
| + ui::KeyEvent* event, |
| + std::unique_ptr<base::Callback<void(bool)>> ack_callback) { |
| +#if defined(OS_CHROMEOS) |
| + if (input_method_chromeos_) { |
| + input_method_chromeos_->DispatchKeyEvent(event, std::move(ack_callback)); |
| + return; |
| + } |
| +#endif |
| + DCHECK(input_method_mus_); |
| + input_method_mus_->DispatchKeyEvent(event, std::move(ack_callback)); |
| +} |
| + |
| void WindowTreeHostMus::SetClientArea( |
| const gfx::Insets& insets, |
| const std::vector<gfx::Rect>& additional_client_area) { |
| @@ -209,4 +223,19 @@ void WindowTreeHostMus::MoveCursorToScreenLocationInPixels( |
| Env::GetInstance()->set_last_mouse_location(location_in_pixels); |
| } |
| +void WindowTreeHostMus::InitInputMethod( |
| + WindowTreeHostMusInitParams* init_params) { |
| +#if defined(OS_CHROMEOS) |
| + if (init_params->use_classic_ime) { |
| + input_method_chromeos_ = base::MakeUnique<ui::InputMethodChromeOS>(this); |
|
sky
2017/04/20 20:18:49
Are you sure we need to set the input method at al
|
| + SetSharedInputMethod(input_method_chromeos_.get()); |
| + return; |
| + } |
| +#endif // defined(OS_CHROMEOS) |
| + |
| + input_method_mus_ = base::MakeUnique<InputMethodMus>(this, window()); |
| + input_method_mus_->Init(init_params->window_tree_client->connector()); |
| + SetSharedInputMethod(input_method_mus_.get()); |
| +} |
| + |
| } // namespace aura |