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

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

Issue 348293002: Do not consume Alt-Shift-Up event for IME switch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_manager_impl.h" 5 #include "chrome/browser/chromeos/input_method/input_method_manager_impl.h"
6 6
7 #include <algorithm> // std::find 7 #include <algorithm> // std::find
8 8
9 #include "ash/ime/input_method_menu_item.h" 9 #include "ash/ime/input_method_menu_item.h"
10 #include "ash/ime/input_method_menu_manager.h" 10 #include "ash/ime/input_method_menu_manager.h"
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 if (initial_input_method_id.empty()) { 636 if (initial_input_method_id.empty()) {
637 // If kPreferredKeyboardLayout is not specified, use the hardware layout. 637 // If kPreferredKeyboardLayout is not specified, use the hardware layout.
638 input_methods_to_be_enabled = util_.GetHardwareLoginInputMethodIds(); 638 input_methods_to_be_enabled = util_.GetHardwareLoginInputMethodIds();
639 } else { 639 } else {
640 input_methods_to_be_enabled.push_back(initial_input_method_id); 640 input_methods_to_be_enabled.push_back(initial_input_method_id);
641 } 641 }
642 EnableLoginLayouts(locale, input_methods_to_be_enabled); 642 EnableLoginLayouts(locale, input_methods_to_be_enabled);
643 } 643 }
644 } 644 }
645 645
646 bool InputMethodManagerImpl::SwitchToNextInputMethod() { 646 void InputMethodManagerImpl::SwitchToNextInputMethod() {
647 // Sanity checks. 647 // Sanity checks.
648 if (active_input_method_ids_.empty()) { 648 if (active_input_method_ids_.empty()) {
649 DVLOG(1) << "active input method is empty"; 649 DVLOG(1) << "active input method is empty";
650 return false; 650 return;
651 } 651 }
652 652
653 if (current_input_method_.id().empty()) { 653 if (current_input_method_.id().empty()) {
654 DVLOG(1) << "current_input_method_ is unknown"; 654 DVLOG(1) << "current_input_method_ is unknown";
655 return false; 655 return;
656 } 656 }
657 657
658 // Do not consume key event if there is only one input method is enabled. 658 // Do not consume key event if there is only one input method is enabled.
659 // Ctrl+Space or Alt+Shift may be used by other application. 659 // Ctrl+Space or Alt+Shift may be used by other application.
660 if (active_input_method_ids_.size() == 1) 660 if (active_input_method_ids_.size() == 1)
661 return false; 661 return;
662 662
663 // Find the next input method and switch to it. 663 // Find the next input method and switch to it.
664 SwitchToNextInputMethodInternal(active_input_method_ids_, 664 SwitchToNextInputMethodInternal(active_input_method_ids_,
665 current_input_method_.id()); 665 current_input_method_.id());
666 return true; 666 return;
Shu Chen 2014/06/24 00:48:49 This return is unnecessary.
Seigo Nonaka 2014/06/24 04:35:01 Done.
667 } 667 }
668 668
669 bool InputMethodManagerImpl::SwitchToPreviousInputMethod( 669 bool InputMethodManagerImpl::SwitchToPreviousInputMethod(
670 const ui::Accelerator& accelerator) { 670 const ui::Accelerator& accelerator) {
671 // Sanity check. 671 // Sanity check.
672 if (active_input_method_ids_.empty()) { 672 if (active_input_method_ids_.empty()) {
673 DVLOG(1) << "active input method is empty"; 673 DVLOG(1) << "active input method is empty";
674 return false; 674 return false;
675 } 675 }
676 676
677 // Do not consume key event if there is only one input method is enabled. 677 // Do not consume key event if there is only one input method is enabled.
678 // Ctrl+Space or Alt+Shift may be used by other application. 678 // Ctrl+Space or Alt+Shift may be used by other application.
679 if (active_input_method_ids_.size() == 1) 679 if (active_input_method_ids_.size() == 1)
680 return false; 680 return false;
681 681
682 if (accelerator.type() == ui::ET_KEY_RELEASED) 682 if (accelerator.type() == ui::ET_KEY_RELEASED)
683 return true; 683 return true;
684 684
685 if (previous_input_method_.id().empty() || 685 if (previous_input_method_.id().empty() ||
686 previous_input_method_.id() == current_input_method_.id()) { 686 previous_input_method_.id() == current_input_method_.id()) {
687 return SwitchToNextInputMethod(); 687 SwitchToNextInputMethod();
688 return true;
688 } 689 }
689 690
690 std::vector<std::string>::const_iterator iter = 691 std::vector<std::string>::const_iterator iter =
691 std::find(active_input_method_ids_.begin(), 692 std::find(active_input_method_ids_.begin(),
692 active_input_method_ids_.end(), 693 active_input_method_ids_.end(),
693 previous_input_method_.id()); 694 previous_input_method_.id());
694 if (iter == active_input_method_ids_.end()) { 695 if (iter == active_input_method_ids_.end()) {
695 // previous_input_method_ is not supported. 696 // previous_input_method_ is not supported.
696 return SwitchToNextInputMethod(); 697 SwitchToNextInputMethod();
698 return true;
697 } 699 }
698 ChangeInputMethodInternal(*iter, true); 700 ChangeInputMethodInternal(*iter, true);
699 return true; 701 return true;
700 } 702 }
701 703
702 bool InputMethodManagerImpl::SwitchInputMethod( 704 bool InputMethodManagerImpl::SwitchInputMethod(
703 const ui::Accelerator& accelerator) { 705 const ui::Accelerator& accelerator) {
704 // Sanity check. 706 // Sanity check.
705 if (active_input_method_ids_.empty()) { 707 if (active_input_method_ids_.empty()) {
706 DVLOG(1) << "active input method is empty"; 708 DVLOG(1) << "active input method is empty";
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 CandidateWindowController::CreateCandidateWindowController()); 915 CandidateWindowController::CreateCandidateWindowController());
914 candidate_window_controller_->AddObserver(this); 916 candidate_window_controller_->AddObserver(this);
915 } 917 }
916 918
917 Profile* InputMethodManagerImpl::GetProfile() const { 919 Profile* InputMethodManagerImpl::GetProfile() const {
918 return ProfileManager::GetActiveUserProfile(); 920 return ProfileManager::GetActiveUserProfile();
919 } 921 }
920 922
921 } // namespace input_method 923 } // namespace input_method
922 } // namespace chromeos 924 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698