Chromium Code Reviews| Index: ui/aura/window_tree_host.h |
| diff --git a/ui/aura/window_tree_host.h b/ui/aura/window_tree_host.h |
| index 0d09093bca14112928d511225b89288b22dd973c..0f1510f8148dd45489a8c32f58306e47eedf4196 100644 |
| --- a/ui/aura/window_tree_host.h |
| +++ b/ui/aura/window_tree_host.h |
| @@ -11,6 +11,7 @@ |
| #include "base/message_loop/message_loop.h" |
| #include "ui/aura/aura_export.h" |
| #include "ui/base/cursor/cursor.h" |
| +#include "ui/base/ime/input_method_delegate.h" |
| #include "ui/events/event_source.h" |
| #include "ui/gfx/native_widget_types.h" |
| @@ -25,6 +26,7 @@ class Transform; |
| namespace ui { |
| class Compositor; |
| class EventProcessor; |
| +class InputMethod; |
| class ViewProp; |
| } |
| @@ -39,9 +41,10 @@ class WindowTreeHostObserver; |
| // WindowTreeHost bridges between a native window and the embedded RootWindow. |
| // It provides the accelerated widget and maps events from the native os to |
| // aura. |
| -class AURA_EXPORT WindowTreeHost { |
| +class AURA_EXPORT WindowTreeHost : public ui::internal::InputMethodDelegate, |
| + public ui::EventSource { |
| public: |
| - virtual ~WindowTreeHost(); |
| + ~WindowTreeHost() override; |
| // Creates a new WindowTreeHost. The caller owns the returned value. |
| static WindowTreeHost* Create(const gfx::Rect& bounds); |
| @@ -116,6 +119,17 @@ class AURA_EXPORT WindowTreeHost { |
| gfx::NativeCursor last_cursor() const { return last_cursor_; } |
| + // Gets the InputMethod instance, if NULL, creates & owns it. |
| + ui::InputMethod* GetInputMethod(); |
| + |
| + // Sets the InputMethod instance, and it is not owned by this WindowTreeHost. |
|
sky
2015/06/04 13:40:28
Sets a shared unowned InputMethod. This is used wh
Shu Chen
2015/06/04 15:59:25
Revised the comment.
To make it protected, a new
sky
2015/06/04 19:42:52
Fair enough.
|
| + // This is to let some environment can have the singleton InputMethod |
| + // instance cross multiple WindowTreeHost's (e.g. Ash). |
| + void SetInputMethod(ui::InputMethod* input_method); |
| + |
| + // Overridden from ui::internal::InputMethodDelegate: |
| + bool DispatchKeyEventPostIME(const ui::KeyEvent& event) override; |
| + |
| // Returns the EventSource responsible for dispatching events to the window |
| // tree. |
| virtual ui::EventSource* GetEventSource() = 0; |
| @@ -166,6 +180,10 @@ class AURA_EXPORT WindowTreeHost { |
| // kCalled when the cursor visibility has changed. |
| virtual void OnCursorVisibilityChangedNative(bool show) = 0; |
| + // Overridden from ui::EventSource: |
| + ui::EventProcessor* GetEventProcessor() override; |
| + ui::EventDispatchDetails DeliverEventToProcessor(ui::Event* event) override; |
| + |
| private: |
| friend class test::WindowTreeHostTestApi; |
| @@ -192,6 +210,16 @@ class AURA_EXPORT WindowTreeHost { |
| scoped_ptr<ui::ViewProp> prop_; |
| + // The InputMethod instance used to process key events. |
| + // If owned it, it is created in GetInputMethod() method; |
| + // If not owned it, it is passed in through SetInputMethod() method. |
| + ui::InputMethod* input_method_; |
| + |
| + // Whether the InputMethod instance is owned by this WindowTreeHost. |
| + // So that the destructor can determine whether to release the InputMethod |
|
sky
2015/06/04 13:40:28
Nuke second sentence.
Shu Chen
2015/06/04 15:59:25
Done.
|
| + // instance. |
| + bool owned_input_method_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(WindowTreeHost); |
| }; |