Index: ui/aura_shell/input_method_event_filter.h |
diff --git a/ui/aura_shell/input_method_event_filter.h b/ui/aura_shell/input_method_event_filter.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8f910a792b6be4d78a2d83db9eb4f2a7bf7cbd2b |
--- /dev/null |
+++ b/ui/aura_shell/input_method_event_filter.h |
@@ -0,0 +1,62 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef UI_AURA_INPUT_METHOD_EVENT_FILTER_ |
+#define UI_AURA_INPUT_METHOD_EVENT_FILTER_ |
+#pragma once |
+ |
+#include "base/basictypes.h" |
+#include "base/compiler_specific.h" |
+#include "base/memory/scoped_ptr.h" |
+#include "ui/aura/event_filter.h" |
+#include "ui/aura/window_observer.h" |
+#include "ui/aura_shell/aura_shell_export.h" |
+#include "ui/base/ime/input_method_delegate.h" |
+ |
+namespace ui { |
+class InputMethod; |
+} |
+ |
+namespace aura_shell { |
+namespace internal { |
+ |
+// An event filter that forwards a KeyEvent to a system IME, and dispatches a |
+// TranslatedKeyEvent to the root window as needed. |
+class AURA_SHELL_EXPORT InputMethodEventFilter |
+ : public aura::EventFilter, |
+ public ui::internal::InputMethodDelegate, |
+ public aura::WindowObserver { |
+ public: |
+ InputMethodEventFilter(); |
+ virtual ~InputMethodEventFilter(); |
+ |
+ private: |
+ // Overridden from aura::EventFilter: |
+ virtual bool PreHandleKeyEvent(aura::Window* target, |
+ aura::KeyEvent* event) OVERRIDE; |
+ virtual bool PreHandleMouseEvent(aura::Window* target, |
+ aura::MouseEvent* event) OVERRIDE; |
+ virtual ui::TouchStatus PreHandleTouchEvent( |
+ aura::Window* target, |
+ aura::TouchEvent* event) OVERRIDE; |
+ |
+ // Overridden from ui::internal::InputMethodDelegate. |
+ virtual void DispatchKeyEventPostIME(const base::NativeEvent& event) OVERRIDE; |
+ virtual void DispatchFabricatedKeyEventPostIME(ui::EventType type, |
+ ui::KeyboardCode key_code, |
+ int flags) OVERRIDE; |
+ |
+ // Overridden from aura::WindowObserver. |
+ virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; |
+ |
+ scoped_ptr<ui::InputMethod> input_method_; |
+ bool root_window_destroyed_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(InputMethodEventFilter); |
+}; |
+ |
+} // namespace internal |
+} // namespace aura_shell |
+ |
+#endif // UI_AURA_SHELL_INPUT_METHOD_EVENT_FILTER_ |