Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: components/arc/ime/arc_ime_service.cc

Issue 2039233003: Showing virtual keyboard when input type changed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add ImeHost.ShowImeIfNeeded to ARC bridge Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/arc/ime/arc_ime_service.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « components/arc/ime/arc_ime_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698