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

Unified Diff: ui/wm/core/input_method_event_filter.cc

Issue 298893003: Supports fake key events for setComposition/commitText by on-screen keyboards. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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/wm/core/input_method_event_filter.cc
diff --git a/ui/wm/core/input_method_event_filter.cc b/ui/wm/core/input_method_event_filter.cc
index 65bd5b506460b61d7dbe6c43a43f13f15882fe3f..10e5e5ad286685f3fb54df0de0711483324efac3 100644
--- a/ui/wm/core/input_method_event_filter.cc
+++ b/ui/wm/core/input_method_event_filter.cc
@@ -63,16 +63,16 @@ void InputMethodEventFilter::OnKeyEvent(ui::KeyEvent* event) {
// IME again. Just let the event dispatcher continue to dispatch the event.
event->SetTranslated(false);
} else {
- // If the focused window is changed, all requests to IME will be
- // discarded so it's safe to update the target_dispatcher_ here.
- aura::Window* target = static_cast<aura::Window*>(event->target());
- target_dispatcher_ = target->GetRootWindow()->GetHost()->event_processor();
- DCHECK(target_dispatcher_);
if (input_method_->DispatchKeyEvent(*event))
event->StopPropagation();
}
}
+void InputMethodEventFilter::UpdateTargetDispatcher(
+ ui::EventProcessor* dispatcher) {
+ target_dispatcher_ = dispatcher;
+}
+
////////////////////////////////////////////////////////////////////////////////
// InputMethodEventFilter, ui::InputMethodDelegate implementation:
@@ -86,6 +86,8 @@ bool InputMethodEventFilter::DispatchKeyEventPostIME(
// This time we have to skip dispatching the event to the IME, we mark the
// event as TRANSLATED so we can distinguish this event as a second time
// dispatched event.
+ if (!target_dispatcher_)
+ return false;
ui::KeyEvent aura_event(event);
aura_event.SetTranslated(true);
ui::EventDispatchDetails details =

Powered by Google App Engine
This is Rietveld 408576698