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

Unified Diff: ui/aura/root_window.cc

Issue 8576005: IME (input method editor) support for Aura, part 3 of 3: Use ui::InputMethod in ash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, review Created 9 years 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/aura/root_window.cc
diff --git a/ui/aura/root_window.cc b/ui/aura/root_window.cc
index 7396ad685054625324455ac300d3ea4bd5365f8a..f62168a2eaa23c04c349f912afbe055fdcc35b6b 100644
--- a/ui/aura/root_window.cc
+++ b/ui/aura/root_window.cc
@@ -196,6 +196,14 @@ bool RootWindow::DispatchKeyEvent(KeyEvent* event) {
return false;
}
+bool RootWindow::DispatchTranslatedKeyEvent(TranslatedKeyEvent* event) {
+ if (focused_window_) {
+ TranslatedKeyEvent translated_event(*event);
+ return ProcessTranslatedKeyEvent(focused_window_, &translated_event);
+ }
+ return false;
+}
+
bool RootWindow::DispatchTouchEvent(TouchEvent* event) {
event->UpdateForTransform(layer()->transform());
bool handled = false;
@@ -421,6 +429,28 @@ bool RootWindow::ProcessKeyEvent(Window* target, KeyEvent* event) {
return true;
}
+ // Usually, an EventFilter bound to an IME (input method) will consume the
+ // |event|. If such EventFilter is not available, the event is dispatched to
+ // the |target|.
+ return target->delegate()->OnKeyEvent(event);
+}
+
+bool RootWindow::ProcessTranslatedKeyEvent(Window* target,
+ TranslatedKeyEvent* event) {
+ if (!target->IsVisible())
+ return false;
+
+ EventFilters filters;
+ GetEventFiltersToNotify(target, &filters);
+ for (EventFilters::const_reverse_iterator it = filters.rbegin();
+ it != filters.rend(); ++it) {
+ if ((*it)->PreHandleTranslatedKeyEvent(target, event))
+ return true;
+ }
+
+ // If the |filters|, such as a filter for handling global shortcut keys, do
+ // not consume the |event|, dispatch it to the |target| as a normal KeyEvent.
+ // Note that the target->delegate() interface is IME agnostic.
return target->delegate()->OnKeyEvent(event);
}
@@ -502,7 +532,7 @@ void RootWindow::SetFocusedWindow(Window* focused_window) {
return;
if (focused_window && !focused_window->CanFocus())
return;
- // The NULL-check of |focused)window| is essential here before asking the
+ // The NULL-check of |focused_window| is essential here before asking the
// activation client, since it is valid to clear the focus by calling
// SetFocusedWindow() to NULL.
if (focused_window && ActivationClient::GetActivationClient() &&
« ui/aura/event.h ('K') | « ui/aura/root_window.h ('k') | ui/aura/root_window_host_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698