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

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: Add gyp/gn dependency to ui test_support. 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..50b024aa55b75ad6e8f1c88fc38bc388e3d97986 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,13 @@ 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 &&
hidehiko 2016/01/26 08:05:53 IMHO, this should work, and practically cover most
kinaba 2016/01/26 08:28:59 You're right. Added the TODO comment as suggested.
+ ime_type_ != ui::TEXT_INPUT_TYPE_NONE) {
+ 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