Chromium Code Reviews| Index: ui/base/ime/input_method_base.h |
| diff --git a/ui/base/ime/input_method_base.h b/ui/base/ime/input_method_base.h |
| index 432a80f2ab2e3922c1c30a914fe7531ddc85525d..c06e34422311420c11def6e659d5c2be28ab6834 100644 |
| --- a/ui/base/ime/input_method_base.h |
| +++ b/ui/base/ime/input_method_base.h |
| @@ -11,6 +11,7 @@ |
| #include "base/macros.h" |
| #include "base/memory/weak_ptr.h" |
| #include "base/observer_list.h" |
| +#include "ui/base/ime/ime_input_context_handler_interface.h" |
| #include "ui/base/ime/input_method.h" |
| #include "ui/base/ime/ui_base_ime_export.h" |
| #include "ui/events/event_dispatcher.h" |
| @@ -29,7 +30,8 @@ class TextInputClient; |
| // implementations. |
| class UI_BASE_IME_EXPORT InputMethodBase |
| : NON_EXPORTED_BASE(public InputMethod), |
| - public base::SupportsWeakPtr<InputMethodBase> { |
| + public base::SupportsWeakPtr<InputMethodBase>, |
| + public IMEInputContextHandlerInterface { |
| public: |
| InputMethodBase(); |
| ~InputMethodBase() override; |
| @@ -61,6 +63,17 @@ class UI_BASE_IME_EXPORT InputMethodBase |
| virtual void OnDidChangeFocusedClient(TextInputClient* focused_before, |
| TextInputClient* focused) {} |
| + // IMEInputContextHandlerInterface: |
| + void CommitText(const std::string& text) override; |
| + void UpdateCompositionText(const CompositionText& text, |
| + uint32_t cursor_pos, |
| + bool visible) override; |
| + void DeleteSurroundingText(int32_t offset, uint32_t length) override; |
| + |
| + // Sends a fake key event for IME composing without physical key events. |
| + // Returns true if the faked key event is stopped propagation. |
| + bool SendFakeProcessKeyEvent(bool pressed) const; |
| + |
| // Returns true if |client| is currently focused. |
| bool IsTextInputClientFocused(const TextInputClient* client); |
| @@ -89,6 +102,10 @@ class UI_BASE_IME_EXPORT InputMethodBase |
| // Gets the bounds of the composition text or cursor in |client|. |
| std::vector<gfx::Rect> GetCompositionBounds(const TextInputClient* client); |
| + // Indicates whether the IME extension is currently handling a physical key |
| + // event. This is used in CommitText/UpdateCompositionText/etc. |
| + bool handling_key_event_; |
|
Shu Chen
2016/02/03 09:22:29
Can this be moved to InputMethodEngineBase?
Shu Chen
2016/02/03 10:05:41
Per offline discussion, let improve the code struc
|
| + |
| private: |
| void SetFocusedTextInputClientInternal(TextInputClient* client); |