From 0105097d94885a858dfefc838034ceb5731e408b Mon Sep 17 00:00:00 2001 From: "shuchen@chromium.org" Date: Fri, 20 Jun 2014 13:29:56 +0000 Subject: [PATCH] Removes the restriction of onFocus event on password field to 3rd party IMEs. BUG=356569 TEST=None Review URL: https://codereview.chromium.org/345653004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278701 0039d316-1c4b-4281-b951-d872f2087c98 --- .../chromeos/input_method/input_method_engine.cc | 19 ------------------- .../input_method/input_method_engine_unittest.cc | 8 ++++---- chrome/common/extensions/api/input_ime.json | 2 +- 3 files changed, 5 insertions(+), 24 deletions(-) diff --git a/chrome/browser/chromeos/input_method/input_method_engine.cc b/chrome/browser/chromeos/input_method/input_method_engine.cc index adac10d1df32..03d8ada3c5b6 100644 --- a/chrome/browser/chromeos/input_method/input_method_engine.cc +++ b/chrome/browser/chromeos/input_method/input_method_engine.cc @@ -509,16 +509,6 @@ void InputMethodEngine::FocusIn( if (!active_ || current_input_type_ == ui::TEXT_INPUT_TYPE_NONE) return; - // Prevent sending events on password field to 3rd-party IME extensions. - // And also make sure the VK fallback to system VK. - // TODO(shuchen): for password field, forcibly switch/lock the IME to the XKB - // keyboard related to the current IME. - if (current_input_type_ == ui::TEXT_INPUT_TYPE_PASSWORD && - !extension_ime_util::IsComponentExtensionIME(GetDescriptor().id())) { - EnableInputView(false); - return; - } - context_id_ = next_context_id_; ++next_context_id_; @@ -555,17 +545,8 @@ void InputMethodEngine::FocusOut() { if (!active_ || current_input_type_ == ui::TEXT_INPUT_TYPE_NONE) return; - ui::TextInputType previous_input_type = current_input_type_; current_input_type_ = ui::TEXT_INPUT_TYPE_NONE; - // Prevent sending events on password field to 3rd-party IME extensions. - // And also make sure the VK restore to IME input view. - if (previous_input_type == ui::TEXT_INPUT_TYPE_PASSWORD && - !extension_ime_util::IsComponentExtensionIME(GetDescriptor().id())) { - EnableInputView(true); - return; - } - int context_id = context_id_; context_id_ = -1; observer_->OnBlur(context_id); diff --git a/chrome/browser/chromeos/input_method/input_method_engine_unittest.cc b/chrome/browser/chromeos/input_method/input_method_engine_unittest.cc index 50e3be4fd04a..8210b1714370 100644 --- a/chrome/browser/chromeos/input_method/input_method_engine_unittest.cc +++ b/chrome/browser/chromeos/input_method/input_method_engine_unittest.cc @@ -248,16 +248,16 @@ TEST_F(InputMethodEngineTest, TestSwitching_Password_3rd_Party) { FocusIn(ui::TEXT_INPUT_TYPE_PASSWORD); EXPECT_EQ(NONE, observer_->GetCallsBitmapAndReset()); engine_->Enable(); - EXPECT_EQ(ACTIVATE, observer_->GetCallsBitmapAndReset()); + EXPECT_EQ(ACTIVATE | ONFOCUS, observer_->GetCallsBitmapAndReset()); engine_->Disable(); EXPECT_EQ(DEACTIVATED, observer_->GetCallsBitmapAndReset()); // Focus change when enabled. engine_->Enable(); - EXPECT_EQ(ACTIVATE, observer_->GetCallsBitmapAndReset()); + EXPECT_EQ(ACTIVATE | ONFOCUS, observer_->GetCallsBitmapAndReset()); engine_->FocusOut(); - EXPECT_EQ(NONE, observer_->GetCallsBitmapAndReset()); + EXPECT_EQ(ONBLUR, observer_->GetCallsBitmapAndReset()); FocusIn(ui::TEXT_INPUT_TYPE_PASSWORD); - EXPECT_EQ(NONE, observer_->GetCallsBitmapAndReset()); + EXPECT_EQ(ONFOCUS, observer_->GetCallsBitmapAndReset()); engine_->Disable(); EXPECT_EQ(DEACTIVATED, observer_->GetCallsBitmapAndReset()); } diff --git a/chrome/common/extensions/api/input_ime.json b/chrome/common/extensions/api/input_ime.json index e682d40b82f5..93cf9661e9b5 100644 --- a/chrome/common/extensions/api/input_ime.json +++ b/chrome/common/extensions/api/input_ime.json @@ -30,7 +30,7 @@ "description": "Describes an input Context", "properties": { "contextID": {"type": "integer", "description": "This is used to specify targets of text field operations. This ID becomes invalid as soon as onBlur is called."}, - "type": {"type": "string", "description": "Type of value this text field edits, (Text, Number, URL, etc)", "enum": ["text", "search", "tel", "url", "email", "number"]} + "type": {"type": "string", "description": "Type of value this text field edits, (Text, Number, URL, etc)", "enum": ["text", "search", "tel", "url", "email", "number", "password"]} } }, { -- 2.11.4.GIT