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

Unified Diff: components/arc/ime/arc_ime_bridge.cc

Issue 1605273002: ARC: Show virtual keyboard when necessary on text input type change events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Filed BUG and added a TODO comment. Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/arc/ime/arc_ime_bridge.h ('k') | components/arc/ime/arc_ime_bridge_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/arc/ime/arc_ime_bridge.cc
diff --git a/components/arc/ime/arc_ime_bridge.cc b/components/arc/ime/arc_ime_bridge.cc
index 669cdd23b16b0e0163a44d9c642188a0fe326d43..8d69a47e5a5917ff406cc9fe026c4b9559374acd 100644
--- a/components/arc/ime/arc_ime_bridge.cc
+++ b/components/arc/ime/arc_ime_bridge.cc
@@ -35,7 +35,8 @@ ArcImeBridge::ArcImeBridge(ArcBridgeService* bridge_service)
: ArcService(bridge_service),
ipc_host_(new ArcImeIpcHostImpl(this, bridge_service)),
ime_type_(ui::TEXT_INPUT_TYPE_NONE),
- has_composition_text_(false) {
+ has_composition_text_(false),
+ test_input_method_(nullptr) {
aura::Env* env = aura::Env::GetInstanceDontCreate();
if (env)
env->AddObserver(this);
@@ -60,7 +61,14 @@ void ArcImeBridge::SetIpcHostForTesting(
ipc_host_ = std::move(test_ipc_host);
}
+void ArcImeBridge::SetInputMethodForTesting(
+ ui::InputMethod* test_input_method) {
+ test_input_method_ = test_input_method;
+}
+
ui::InputMethod* ArcImeBridge::GetInputMethod() {
+ if (test_input_method_)
+ return test_input_method_;
if (!focused_arc_window_.has_windows())
return nullptr;
return focused_arc_window_.windows().front()->GetHost()->GetInputMethod();
@@ -114,8 +122,18 @@ void ArcImeBridge::OnTextInputTypeChanged(ui::TextInputType type) {
ime_type_ = type;
ui::InputMethod* const input_method = GetInputMethod();
- if (input_method)
+ if (input_method) {
input_method->OnTextInputTypeChanged(this);
+ if (input_method->GetTextInputClient() == this &&
+ ime_type_ != ui::TEXT_INPUT_TYPE_NONE) {
+ // TODO(kinaba): crbug.com/581282. This is tentative short-term solution.
+ //
+ // For fully correct implementation, rather than to piggyback the "show"
+ // request with the input type change, we need dedicated IPCs to share the
+ // virtual keyboard show/hide states between Chromium and ARC.
+ input_method->ShowImeIfNeeded();
+ }
+ }
}
void ArcImeBridge::OnCursorRectChanged(const gfx::Rect& rect) {
« no previous file with comments | « components/arc/ime/arc_ime_bridge.h ('k') | components/arc/ime/arc_ime_bridge_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698