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

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: fixed bot failure: cast_shell_linux Created 5 years, 6 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 e49e1be9ecac483a8623418b6ce8c9e5a3630bab..4348dfb0ec06c186195812d9f3cb62d8a905e2f1 100644
--- a/ui/keyboard/keyboard_util.cc
+++ b/ui/keyboard/keyboard_util.cc
@@ -14,7 +14,6 @@
#include "base/strings/string16.h"
#include "grit/keyboard_resources.h"
#include "grit/keyboard_resources_map.h"
-#include "ui/aura/client/aura_constants.h"
#include "ui/aura/window_tree_host.h"
#include "ui/base/ime/input_method.h"
#include "ui/base/ime/text_input_client.h"
@@ -38,7 +37,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);
@@ -291,12 +289,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;
@@ -333,9 +330,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