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

Unified Diff: ui/keyboard/keyboard_util.cc

Issue 1155013005: Refactoring the ownership of ui::InputMethod. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pls be green! Created 5 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
Index: ui/keyboard/keyboard_util.cc
diff --git a/ui/keyboard/keyboard_util.cc b/ui/keyboard/keyboard_util.cc
index 00b9f9e99d779d17319039c4fea5c0f638da0fca..25e7d42b69f8c49d76da4713b0a2fb38898fcc25 100644
--- a/ui/keyboard/keyboard_util.cc
+++ b/ui/keyboard/keyboard_util.cc
@@ -38,7 +38,6 @@ void SendProcessKeyEvent(ui::EventType type,
aura::WindowTreeHost* host) {
ui::KeyEvent event(type, ui::VKEY_PROCESSKEY, ui::DomCode::NONE, ui::EF_NONE,
ui::DomKey::PROCESS, 0, ui::EventTimeForNow());
- event.SetTranslated(true);
ui::EventDispatchDetails details =
host->event_processor()->OnEventFromSource(&event);
CHECK(!details.dispatcher_destroyed);
@@ -284,12 +283,11 @@ bool SendKeyEvent(const std::string type,
ui::KeyboardCode code = static_cast<ui::KeyboardCode>(key_code);
+ ui::InputMethod* input_method = host->GetInputMethod();
if (code == ui::VKEY_UNKNOWN) {
// Handling of special printable characters (e.g. accented characters) for
// which there is no key code.
if (event_type == ui::ET_KEY_RELEASED) {
- ui::InputMethod* input_method = host->window()->GetProperty(
- aura::client::kRootWindowInputMethodKey);
if (!input_method)
return false;
@@ -326,9 +324,13 @@ bool SendKeyEvent(const std::string type,
code,
dom_code,
modifiers);
- ui::EventDispatchDetails details =
- host->event_processor()->OnEventFromSource(&event);
- CHECK(!details.dispatcher_destroyed);
+ if (input_method) {
+ input_method->DispatchKeyEvent(event);
+ } else {
+ ui::EventDispatchDetails details =
+ host->event_processor()->OnEventFromSource(&event);
+ CHECK(!details.dispatcher_destroyed);
+ }
}
return true;
}

Powered by Google App Engine
This is Rietveld 408576698