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

Side by Side Diff: ash/accelerators/accelerator_controller.cc

Issue 1601063002: Removes ImeController::UsingFrenchInputMethod and thus ImeControlDelegate::RemapAccelerator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | ash/accelerators/accelerator_controller_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 (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 "ash/accelerators/accelerator_controller.h" 5 #include "ash/accelerators/accelerator_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 void AcceleratorController::Unregister(const ui::Accelerator& accelerator, 768 void AcceleratorController::Unregister(const ui::Accelerator& accelerator,
769 ui::AcceleratorTarget* target) { 769 ui::AcceleratorTarget* target) {
770 accelerator_manager_->Unregister(accelerator, target); 770 accelerator_manager_->Unregister(accelerator, target);
771 } 771 }
772 772
773 void AcceleratorController::UnregisterAll(ui::AcceleratorTarget* target) { 773 void AcceleratorController::UnregisterAll(ui::AcceleratorTarget* target) {
774 accelerator_manager_->UnregisterAll(target); 774 accelerator_manager_->UnregisterAll(target);
775 } 775 }
776 776
777 bool AcceleratorController::Process(const ui::Accelerator& accelerator) { 777 bool AcceleratorController::Process(const ui::Accelerator& accelerator) {
778 if (ime_control_delegate_) { 778 if (ime_control_delegate_)
779 return accelerator_manager_->Process( 779 return accelerator_manager_->Process(accelerator);
780 ime_control_delegate_->RemapAccelerator(accelerator));
781 }
782 return accelerator_manager_->Process(accelerator); 780 return accelerator_manager_->Process(accelerator);
783 } 781 }
784 782
785 bool AcceleratorController::IsRegistered( 783 bool AcceleratorController::IsRegistered(
786 const ui::Accelerator& accelerator) const { 784 const ui::Accelerator& accelerator) const {
787 return accelerator_manager_->GetCurrentTarget(accelerator) != NULL; 785 return accelerator_manager_->GetCurrentTarget(accelerator) != NULL;
788 } 786 }
789 787
790 bool AcceleratorController::IsPreferred( 788 bool AcceleratorController::IsPreferred(
791 const ui::Accelerator& accelerator) const { 789 const ui::Accelerator& accelerator) const {
792 const ui::Accelerator remapped_accelerator = ime_control_delegate_.get() ?
793 ime_control_delegate_->RemapAccelerator(accelerator) : accelerator;
794
795 std::map<ui::Accelerator, AcceleratorAction>::const_iterator iter = 790 std::map<ui::Accelerator, AcceleratorAction>::const_iterator iter =
796 accelerators_.find(remapped_accelerator); 791 accelerators_.find(accelerator);
797 if (iter == accelerators_.end()) 792 if (iter == accelerators_.end())
798 return false; // not an accelerator. 793 return false; // not an accelerator.
799 794
800 return preferred_actions_.find(iter->second) != preferred_actions_.end(); 795 return preferred_actions_.find(iter->second) != preferred_actions_.end();
801 } 796 }
802 797
803 bool AcceleratorController::IsReserved( 798 bool AcceleratorController::IsReserved(
804 const ui::Accelerator& accelerator) const { 799 const ui::Accelerator& accelerator) const {
805 const ui::Accelerator remapped_accelerator = ime_control_delegate_.get() ?
806 ime_control_delegate_->RemapAccelerator(accelerator) : accelerator;
807
808 std::map<ui::Accelerator, AcceleratorAction>::const_iterator iter = 800 std::map<ui::Accelerator, AcceleratorAction>::const_iterator iter =
809 accelerators_.find(remapped_accelerator); 801 accelerators_.find(accelerator);
810 if (iter == accelerators_.end()) 802 if (iter == accelerators_.end())
811 return false; // not an accelerator. 803 return false; // not an accelerator.
812 804
813 return reserved_actions_.find(iter->second) != reserved_actions_.end(); 805 return reserved_actions_.find(iter->second) != reserved_actions_.end();
814 } 806 }
815 807
816 bool AcceleratorController::IsDeprecated( 808 bool AcceleratorController::IsDeprecated(
817 const ui::Accelerator& accelerator) const { 809 const ui::Accelerator& accelerator) const {
818 return deprecated_accelerators_.count(accelerator) != 0; 810 return deprecated_accelerators_.count(accelerator) != 0;
819 } 811 }
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
1453 } 1445 }
1454 1446
1455 void AcceleratorController::SetKeyboardBrightnessControlDelegate( 1447 void AcceleratorController::SetKeyboardBrightnessControlDelegate(
1456 scoped_ptr<KeyboardBrightnessControlDelegate> 1448 scoped_ptr<KeyboardBrightnessControlDelegate>
1457 keyboard_brightness_control_delegate) { 1449 keyboard_brightness_control_delegate) {
1458 keyboard_brightness_control_delegate_ = 1450 keyboard_brightness_control_delegate_ =
1459 std::move(keyboard_brightness_control_delegate); 1451 std::move(keyboard_brightness_control_delegate);
1460 } 1452 }
1461 1453
1462 } // namespace ash 1454 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/accelerators/accelerator_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698