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() && |