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

Unified Diff: extensions/shell/browser/shell_desktop_controller_aura.cc

Issue 2909603002: Revert of Remove InputMethodEventHandler. (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « extensions/shell/browser/shell_desktop_controller_aura.h ('k') | ui/aura/test/aura_test_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ffcb51178e7977e3a073f6e6c647064e6c6914cd..2ac6389b2e54d5a33f68f88dc663728142dd2139 100644
--- a/extensions/shell/browser/shell_desktop_controller_aura.cc
+++ b/extensions/shell/browser/shell_desktop_controller_aura.cc
@@ -18,6 +18,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"
@@ -274,7 +275,19 @@
ui::EventDispatchDetails ShellDesktopControllerAura::DispatchKeyEventPostIME(
ui::KeyEvent* key_event) {
- return host_->DispatchKeyEventPostIME(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_sink()->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() {
@@ -333,6 +346,8 @@
// 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();
@@ -350,6 +365,9 @@
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());
root_window_event_filter_.reset();
« no previous file with comments | « extensions/shell/browser/shell_desktop_controller_aura.h ('k') | ui/aura/test/aura_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698