Chromium Code Reviews| Index: extensions/shell/browser/shell_desktop_controller_aura.cc |
| diff --git a/extensions/shell/browser/shell_desktop_controller_aura.cc b/extensions/shell/browser/shell_desktop_controller_aura.cc |
| index 70b19aa28ea8f7345fb814a311375cdfcfae4aa5..de30d821ac6561e9c53ab4a55096d5bd7a61e622 100644 |
| --- a/extensions/shell/browser/shell_desktop_controller_aura.cc |
| +++ b/extensions/shell/browser/shell_desktop_controller_aura.cc |
| @@ -16,6 +16,7 @@ |
| #include "build/build_config.h" |
| #include "extensions/browser/app_window/app_window.h" |
| #include "extensions/browser/app_window/native_app_window.h" |
| +#include "extensions/shell/browser/input_method_event_handler.h" |
| #include "extensions/shell/browser/shell_app_delegate.h" |
| #include "extensions/shell/browser/shell_app_window_client.h" |
| #include "extensions/shell/browser/shell_screen.h" |
| @@ -28,7 +29,7 @@ |
| #include "ui/aura/window_tree_host.h" |
| #include "ui/base/cursor/cursor.h" |
| #include "ui/base/cursor/image_cursors.h" |
| -#include "ui/base/ime/input_method_initializer.h" |
| +#include "ui/base/ime/input_method.h" |
| #include "ui/base/user_activity/user_activity_detector.h" |
| #include "ui/display/screen.h" |
| #include "ui/gfx/geometry/size.h" |
| @@ -271,6 +272,23 @@ void ShellDesktopControllerAura::OnHostCloseRequested( |
| FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); |
| } |
| +ui::EventDispatchDetails ShellDesktopControllerAura::DispatchKeyEventPostIME( |
| + ui::KeyEvent* key_event) { |
| + // The input method has processed this event, so prevent the handler from |
| + // dispatching it again. |
| + input_method_event_handler_->set_post_ime(true); |
| + |
| + // Send the event on to the host. |
| + ui::EventDispatchDetails details = |
| + host_->event_processor()->OnEventFromSource(key_event); |
| + |
| + // Clear the handler's PostIME flag for the next event. |
| + if (!details.dispatcher_destroyed) |
| + input_method_event_handler_->set_post_ime(false); |
| + |
| + return details; |
| +} |
| + |
| void ShellDesktopControllerAura::InitWindowManager() { |
| wm::FocusController* focus_controller = |
| new wm::FocusController(new AppsFocusRules()); |
| @@ -318,12 +336,18 @@ void ShellDesktopControllerAura::CreateRootWindow() { |
| screen_.reset(new ShellScreen(size)); |
| display::Screen::SetScreenInstance(screen_.get()); |
| - // TODO(mukai): Set up input method. |
| host_.reset(screen_->CreateHostForPrimaryDisplay()); |
| aura::client::SetWindowParentingClient(host_->window(), this); |
| root_window_event_filter_.reset(new wm::CompoundEventFilter); |
| host_->window()->AddPreTargetHandler(root_window_event_filter_.get()); |
| + |
| + // Trigger creation of an input method and become its delegate. |
| + ui::InputMethod* input_method = host_->GetInputMethod(); |
| + input_method->SetDelegate(this); |
| + input_method_event_handler_.reset(new InputMethodEventHandler(input_method)); |
| + host_->window()->AddPreTargetHandler(input_method_event_handler_.get()); |
| + |
| InitWindowManager(); |
| host_->AddObserver(this); |
| @@ -340,7 +364,13 @@ void ShellDesktopControllerAura::DestroyRootWindow() { |
| host_->window()->RemovePreTargetHandler(focus_controller); |
| aura::client::SetActivationClient(host_->window(), NULL); |
| } |
| + |
| + host_->window()->RemovePreTargetHandler(input_method_event_handler_.get()); |
| + input_method_event_handler_.reset(); |
| + |
| + host_->window()->RemovePreTargetHandler(root_window_event_filter_.get()); |
|
James Cook
2016/12/16 19:00:50
good catch
|
| root_window_event_filter_.reset(); |
| + |
| capture_client_.reset(); |
| focus_client_.reset(); |
| cursor_manager_.reset(); |