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 #include "components/arc/ime/arc_ime_service.h" | 5 #include "components/arc/ime/arc_ime_service.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "components/arc/ime/arc_ime_bridge_impl.h" | 8 #include "components/arc/ime/arc_ime_bridge_impl.h" |
9 #include "components/exo/shell_surface.h" | 9 #include "components/exo/shell_surface.h" |
10 #include "components/exo/surface.h" | 10 #include "components/exo/surface.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
126 // Overridden from arc::ArcImeBridge::Delegate | 126 // Overridden from arc::ArcImeBridge::Delegate |
127 | 127 |
128 void ArcImeService::OnTextInputTypeChanged(ui::TextInputType type) { | 128 void ArcImeService::OnTextInputTypeChanged(ui::TextInputType type) { |
129 if (ime_type_ == type) | 129 if (ime_type_ == type) |
130 return; | 130 return; |
131 ime_type_ = type; | 131 ime_type_ = type; |
132 | 132 |
133 ui::InputMethod* const input_method = GetInputMethod(); | 133 ui::InputMethod* const input_method = GetInputMethod(); |
134 if (input_method) { | 134 if (input_method) { |
135 input_method->OnTextInputTypeChanged(this); | 135 input_method->OnTextInputTypeChanged(this); |
136 // TODO(crbug.com/581282): Remove this piggyback call when | |
137 // ImeInstance::ShowImeIfNeeded is wired to ARC. | |
136 if (input_method->GetTextInputClient() == this && | 138 if (input_method->GetTextInputClient() == this && |
137 ime_type_ != ui::TEXT_INPUT_TYPE_NONE) { | 139 ime_type_ != ui::TEXT_INPUT_TYPE_NONE) { |
dcheng
2016/06/14 08:39:52
So the final intent is to remove this once all the
takaoka
2016/06/14 09:04:25
Yes.
This can be removed once the corresponding CL
| |
138 // TODO(kinaba): crbug.com/581282. This is tentative short-term solution. | |
139 // | |
140 // For fully correct implementation, rather than to piggyback the "show" | |
141 // request with the input type change, we need dedicated IPCs to share the | |
142 // virtual keyboard show/hide states between Chromium and ARC. | |
143 input_method->ShowImeIfNeeded(); | 140 input_method->ShowImeIfNeeded(); |
144 } | 141 } |
145 } | 142 } |
146 } | 143 } |
147 | 144 |
148 void ArcImeService::OnCursorRectChanged(const gfx::Rect& rect) { | 145 void ArcImeService::OnCursorRectChanged(const gfx::Rect& rect) { |
149 if (cursor_rect_ == rect) | 146 if (cursor_rect_ == rect) |
150 return; | 147 return; |
151 cursor_rect_ = rect; | 148 cursor_rect_ = rect; |
152 | 149 |
153 ui::InputMethod* const input_method = GetInputMethod(); | 150 ui::InputMethod* const input_method = GetInputMethod(); |
154 if (input_method) | 151 if (input_method) |
155 input_method->OnCaretBoundsChanged(this); | 152 input_method->OnCaretBoundsChanged(this); |
156 } | 153 } |
157 | 154 |
158 void ArcImeService::OnCancelComposition() { | 155 void ArcImeService::OnCancelComposition() { |
159 ui::InputMethod* const input_method = GetInputMethod(); | 156 ui::InputMethod* const input_method = GetInputMethod(); |
160 if (input_method) | 157 if (input_method) |
161 input_method->CancelComposition(this); | 158 input_method->CancelComposition(this); |
162 } | 159 } |
163 | 160 |
161 void ArcImeService::ShowImeIfNeeded() { | |
162 ui::InputMethod* const input_method = GetInputMethod(); | |
163 if (input_method && input_method->GetTextInputClient() == this) { | |
164 input_method->ShowImeIfNeeded(); | |
165 } | |
166 } | |
167 | |
164 //////////////////////////////////////////////////////////////////////////////// | 168 //////////////////////////////////////////////////////////////////////////////// |
165 // Oberridden from ui::TextInputClient: | 169 // Oberridden from ui::TextInputClient: |
166 | 170 |
167 void ArcImeService::SetCompositionText( | 171 void ArcImeService::SetCompositionText( |
168 const ui::CompositionText& composition) { | 172 const ui::CompositionText& composition) { |
169 has_composition_text_ = !composition.text.empty(); | 173 has_composition_text_ = !composition.text.empty(); |
170 ime_bridge_->SendSetCompositionText(composition); | 174 ime_bridge_->SendSetCompositionText(composition); |
171 } | 175 } |
172 | 176 |
173 void ArcImeService::ConfirmCompositionText() { | 177 void ArcImeService::ConfirmCompositionText() { |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
279 bool ArcImeService::ChangeTextDirectionAndLayoutAlignment( | 283 bool ArcImeService::ChangeTextDirectionAndLayoutAlignment( |
280 base::i18n::TextDirection direction) { | 284 base::i18n::TextDirection direction) { |
281 return false; | 285 return false; |
282 } | 286 } |
283 | 287 |
284 bool ArcImeService::IsEditCommandEnabled(int command_id) { | 288 bool ArcImeService::IsEditCommandEnabled(int command_id) { |
285 return false; | 289 return false; |
286 } | 290 } |
287 | 291 |
288 } // namespace arc | 292 } // namespace arc |
OLD | NEW |