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

Side by Side Diff: chrome/browser/chromeos/input_method/input_method_engine.cc

Issue 345653004: Removes the restriction of onFocus event on password field to 3rd party IMEs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: make unit_tests pass. Created 6 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 | « no previous file | chrome/browser/chromeos/input_method/input_method_engine_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/chromeos/input_method/input_method_engine.h" 5 #include "chrome/browser/chromeos/input_method/input_method_engine.h"
6 6
7 #undef FocusIn 7 #undef FocusIn
8 #undef FocusOut 8 #undef FocusOut
9 #undef RootWindow 9 #undef RootWindow
10 #include <map> 10 #include <map>
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 keyboard_controller->Reload(); 502 keyboard_controller->Reload();
503 } 503 }
504 504
505 void InputMethodEngine::FocusIn( 505 void InputMethodEngine::FocusIn(
506 const IMEEngineHandlerInterface::InputContext& input_context) { 506 const IMEEngineHandlerInterface::InputContext& input_context) {
507 current_input_type_ = input_context.type; 507 current_input_type_ = input_context.type;
508 508
509 if (!active_ || current_input_type_ == ui::TEXT_INPUT_TYPE_NONE) 509 if (!active_ || current_input_type_ == ui::TEXT_INPUT_TYPE_NONE)
510 return; 510 return;
511 511
512 // Prevent sending events on password field to 3rd-party IME extensions.
513 // And also make sure the VK fallback to system VK.
514 // TODO(shuchen): for password field, forcibly switch/lock the IME to the XKB
515 // keyboard related to the current IME.
516 if (current_input_type_ == ui::TEXT_INPUT_TYPE_PASSWORD &&
517 !extension_ime_util::IsComponentExtensionIME(GetDescriptor().id())) {
518 EnableInputView(false);
519 return;
520 }
521
522 context_id_ = next_context_id_; 512 context_id_ = next_context_id_;
523 ++next_context_id_; 513 ++next_context_id_;
524 514
525 InputMethodEngineInterface::InputContext context; 515 InputMethodEngineInterface::InputContext context;
526 context.id = context_id_; 516 context.id = context_id_;
527 switch (current_input_type_) { 517 switch (current_input_type_) {
528 case ui::TEXT_INPUT_TYPE_SEARCH: 518 case ui::TEXT_INPUT_TYPE_SEARCH:
529 context.type = "search"; 519 context.type = "search";
530 break; 520 break;
531 case ui::TEXT_INPUT_TYPE_TELEPHONE: 521 case ui::TEXT_INPUT_TYPE_TELEPHONE:
(...skipping 16 matching lines...) Expand all
548 break; 538 break;
549 } 539 }
550 540
551 observer_->OnFocus(context); 541 observer_->OnFocus(context);
552 } 542 }
553 543
554 void InputMethodEngine::FocusOut() { 544 void InputMethodEngine::FocusOut() {
555 if (!active_ || current_input_type_ == ui::TEXT_INPUT_TYPE_NONE) 545 if (!active_ || current_input_type_ == ui::TEXT_INPUT_TYPE_NONE)
556 return; 546 return;
557 547
558 ui::TextInputType previous_input_type = current_input_type_;
559 current_input_type_ = ui::TEXT_INPUT_TYPE_NONE; 548 current_input_type_ = ui::TEXT_INPUT_TYPE_NONE;
560 549
561 // Prevent sending events on password field to 3rd-party IME extensions.
562 // And also make sure the VK restore to IME input view.
563 if (previous_input_type == ui::TEXT_INPUT_TYPE_PASSWORD &&
564 !extension_ime_util::IsComponentExtensionIME(GetDescriptor().id())) {
565 EnableInputView(true);
566 return;
567 }
568
569 int context_id = context_id_; 550 int context_id = context_id_;
570 context_id_ = -1; 551 context_id_ = -1;
571 observer_->OnBlur(context_id); 552 observer_->OnBlur(context_id);
572 } 553 }
573 554
574 void InputMethodEngine::Enable() { 555 void InputMethodEngine::Enable() {
575 active_ = true; 556 active_ = true;
576 observer_->OnActivate(engine_id_); 557 observer_->OnActivate(engine_id_);
577 current_input_type_ = IMEBridge::Get()->GetCurrentTextInputType(); 558 current_input_type_ = IMEBridge::Get()->GetCurrentTextInputType();
578 FocusIn(IMEEngineHandlerInterface::InputContext( 559 FocusIn(IMEEngineHandlerInterface::InputContext(
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 // TODO(nona): Implement it. 679 // TODO(nona): Implement it.
699 break; 680 break;
700 } 681 }
701 } 682 }
702 } 683 }
703 684
704 // TODO(nona): Support item.children. 685 // TODO(nona): Support item.children.
705 } 686 }
706 687
707 } // namespace chromeos 688 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/input_method/input_method_engine_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698