Index: ash/shell.cc |
diff --git a/ash/shell.cc b/ash/shell.cc |
index 3e132d5884c661ea49b92e73210a00f1b5fc3b8b..25834a2f32f0d68b9f026481dffac0f601c2fa0e 100644 |
--- a/ash/shell.cc |
+++ b/ash/shell.cc |
@@ -11,6 +11,7 @@ |
#include "ash/app_list/app_list.h" |
#include "ash/ash_switches.h" |
#include "ash/drag_drop/drag_drop_controller.h" |
+#include "ash/ime/input_method_event_filter.h" |
#include "ash/launcher/launcher.h" |
#include "ash/shell_delegate.h" |
#include "ash/shell_factory.h" |
@@ -33,8 +34,9 @@ |
#include "ash/wm/workspace_controller.h" |
#include "base/bind.h" |
#include "base/command_line.h" |
-#include "ui/aura/root_window.h" |
+#include "ui/aura/client/aura_constants.h" |
#include "ui/aura/layout_manager.h" |
+#include "ui/aura/root_window.h" |
#include "ui/aura/window.h" |
#include "ui/gfx/compositor/layer.h" |
#include "ui/gfx/compositor/layer_animator.h" |
@@ -132,6 +134,7 @@ Shell::Shell(ShellDelegate* delegate) |
} |
Shell::~Shell() { |
+ RemoveRootWindowEventFilter(input_method_filter_.get()); |
RemoveRootWindowEventFilter(accelerator_filter_.get()); |
// TooltipController needs a valid shell instance. We delete it before |
@@ -217,6 +220,12 @@ void Shell::Init() { |
// Force a layout. |
root_window->layout_manager()->OnWindowResized(); |
+ // Initialize InputMethodEventFilter. The filter must be added first since it |
+ // has the highest priority. |
+ DCHECK(!GetRootWindowEventFilterCount()); |
+ input_method_filter_.reset(new internal::InputMethodEventFilter); |
+ AddRootWindowEventFilter(input_method_filter_.get()); |
+ |
// Initialize AcceleratorFilter. |
accelerator_filter_.reset(new internal::AcceleratorFilter); |
AddRootWindowEventFilter(accelerator_filter_.get()); |
@@ -323,6 +332,11 @@ void Shell::RemoveRootWindowEventFilter(aura::EventFilter* filter) { |
aura::RootWindow::GetInstance()->event_filter())->RemoveFilter(filter); |
} |
+size_t Shell::GetRootWindowEventFilterCount() const { |
+ return static_cast<internal::RootWindowEventFilter*>( |
+ aura::RootWindow::GetInstance()->event_filter())->GetFilterCount(); |
+} |
+ |
void Shell::ToggleOverview() { |
if (workspace_controller_.get()) |
workspace_controller_->ToggleOverview(); |