OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_ARC_IME_ARC_IME_SERVICE_H_ | 5 #ifndef COMPONENTS_ARC_IME_ARC_IME_SERVICE_H_ |
6 #define COMPONENTS_ARC_IME_ARC_IME_SERVICE_H_ | 6 #define COMPONENTS_ARC_IME_ARC_IME_SERVICE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 // Overridden from exo::WMHelper::FocusObserver: | 74 // Overridden from exo::WMHelper::FocusObserver: |
75 void OnWindowFocused(aura::Window* gained_focus, | 75 void OnWindowFocused(aura::Window* gained_focus, |
76 aura::Window* lost_focus) override; | 76 aura::Window* lost_focus) override; |
77 | 77 |
78 // Overridden from ArcImeBridge::Delegate: | 78 // Overridden from ArcImeBridge::Delegate: |
79 void OnTextInputTypeChanged(ui::TextInputType type) override; | 79 void OnTextInputTypeChanged(ui::TextInputType type) override; |
80 void OnCursorRectChanged(const gfx::Rect& rect) override; | 80 void OnCursorRectChanged(const gfx::Rect& rect) override; |
81 void OnCancelComposition() override; | 81 void OnCancelComposition() override; |
82 void ShowImeIfNeeded() override; | 82 void ShowImeIfNeeded() override; |
| 83 void OnCursorRectChangedWithSurroundingText( |
| 84 const gfx::Rect& rect, |
| 85 const gfx::Range& text_range, |
| 86 const base::string16& text_in_range, |
| 87 const gfx::Range& selection_range) override; |
83 | 88 |
84 // Overridden from keyboard::KeyboardControllerObserver. | 89 // Overridden from keyboard::KeyboardControllerObserver. |
85 void OnKeyboardBoundsChanging(const gfx::Rect& rect) override; | 90 void OnKeyboardBoundsChanging(const gfx::Rect& rect) override; |
86 void OnKeyboardClosed() override; | 91 void OnKeyboardClosed() override; |
87 | 92 |
88 // Overridden from ui::TextInputClient: | 93 // Overridden from ui::TextInputClient: |
89 void SetCompositionText(const ui::CompositionText& composition) override; | 94 void SetCompositionText(const ui::CompositionText& composition) override; |
90 void ConfirmCompositionText() override; | 95 void ConfirmCompositionText() override; |
91 void ClearCompositionText() override; | 96 void ClearCompositionText() override; |
92 void InsertText(const base::string16& text) override; | 97 void InsertText(const base::string16& text) override; |
93 void InsertChar(const ui::KeyEvent& event) override; | 98 void InsertChar(const ui::KeyEvent& event) override; |
94 ui::TextInputType GetTextInputType() const override; | 99 ui::TextInputType GetTextInputType() const override; |
95 gfx::Rect GetCaretBounds() const override; | 100 gfx::Rect GetCaretBounds() const override; |
| 101 bool GetTextRange(gfx::Range* range) const override; |
| 102 bool GetSelectionRange(gfx::Range* range) const override; |
| 103 bool GetTextFromRange(const gfx::Range& range, |
| 104 base::string16* text) const override; |
96 | 105 |
97 // Overridden from ui::TextInputClient (with default implementation): | 106 // Overridden from ui::TextInputClient (with default implementation): |
98 // TODO(kinaba): Support each of these methods to the extent possible in | 107 // TODO(kinaba): Support each of these methods to the extent possible in |
99 // Android input method API. | 108 // Android input method API. |
100 ui::TextInputMode GetTextInputMode() const override; | 109 ui::TextInputMode GetTextInputMode() const override; |
101 base::i18n::TextDirection GetTextDirection() const override; | 110 base::i18n::TextDirection GetTextDirection() const override; |
102 int GetTextInputFlags() const override; | 111 int GetTextInputFlags() const override; |
103 bool CanComposeInline() const override; | 112 bool CanComposeInline() const override; |
104 bool GetCompositionCharacterBounds(uint32_t index, | 113 bool GetCompositionCharacterBounds(uint32_t index, |
105 gfx::Rect* rect) const override; | 114 gfx::Rect* rect) const override; |
106 bool HasCompositionText() const override; | 115 bool HasCompositionText() const override; |
107 bool GetTextRange(gfx::Range* range) const override; | |
108 bool GetCompositionTextRange(gfx::Range* range) const override; | 116 bool GetCompositionTextRange(gfx::Range* range) const override; |
109 bool GetSelectionRange(gfx::Range* range) const override; | |
110 bool SetSelectionRange(const gfx::Range& range) override; | 117 bool SetSelectionRange(const gfx::Range& range) override; |
111 bool DeleteRange(const gfx::Range& range) override; | 118 bool DeleteRange(const gfx::Range& range) override; |
112 bool GetTextFromRange(const gfx::Range& range, | |
113 base::string16* text) const override; | |
114 void OnInputMethodChanged() override {} | 119 void OnInputMethodChanged() override {} |
115 bool ChangeTextDirectionAndLayoutAlignment( | 120 bool ChangeTextDirectionAndLayoutAlignment( |
116 base::i18n::TextDirection direction) override; | 121 base::i18n::TextDirection direction) override; |
117 void ExtendSelectionAndDelete(size_t before, size_t after) override; | 122 void ExtendSelectionAndDelete(size_t before, size_t after) override; |
118 void EnsureCaretNotInRect(const gfx::Rect& rect) override {} | 123 void EnsureCaretNotInRect(const gfx::Rect& rect) override {} |
119 bool IsTextEditCommandEnabled(ui::TextEditCommand command) const override; | 124 bool IsTextEditCommandEnabled(ui::TextEditCommand command) const override; |
120 void SetTextEditCommandForNextKeyEvent(ui::TextEditCommand command) override { | 125 void SetTextEditCommandForNextKeyEvent(ui::TextEditCommand command) override { |
121 } | 126 } |
122 | 127 |
123 private: | 128 private: |
124 ui::InputMethod* GetInputMethod(); | 129 ui::InputMethod* GetInputMethod(); |
125 | 130 |
| 131 void InvalidateSurroundingTextAndSelectionRange(); |
| 132 |
126 std::unique_ptr<ArcImeBridge> ime_bridge_; | 133 std::unique_ptr<ArcImeBridge> ime_bridge_; |
127 std::unique_ptr<ArcWindowDelegate> arc_window_delegate_; | 134 std::unique_ptr<ArcWindowDelegate> arc_window_delegate_; |
128 ui::TextInputType ime_type_; | 135 ui::TextInputType ime_type_; |
129 gfx::Rect cursor_rect_; | 136 gfx::Rect cursor_rect_; |
130 bool has_composition_text_; | 137 bool has_composition_text_; |
| 138 gfx::Range text_range_; |
| 139 base::string16 text_in_range_; |
| 140 gfx::Range selection_range_; |
131 | 141 |
132 aura::Window* focused_arc_window_ = nullptr; | 142 aura::Window* focused_arc_window_ = nullptr; |
133 | 143 |
134 keyboard::KeyboardController* keyboard_controller_; | 144 keyboard::KeyboardController* keyboard_controller_; |
135 | 145 |
136 ui::InputMethod* test_input_method_; | 146 ui::InputMethod* test_input_method_; |
137 bool is_focus_observer_installed_; | 147 bool is_focus_observer_installed_; |
138 | 148 |
139 DISALLOW_COPY_AND_ASSIGN(ArcImeService); | 149 DISALLOW_COPY_AND_ASSIGN(ArcImeService); |
140 }; | 150 }; |
141 | 151 |
142 } // namespace arc | 152 } // namespace arc |
143 | 153 |
144 #endif // COMPONENTS_ARC_IME_ARC_IME_SERVICE_H_ | 154 #endif // COMPONENTS_ARC_IME_ARC_IME_SERVICE_H_ |
OLD | NEW |