| OLD | NEW |
| 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 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 void AcceleratorController::Unregister(const ui::Accelerator& accelerator, | 774 void AcceleratorController::Unregister(const ui::Accelerator& accelerator, |
| 775 ui::AcceleratorTarget* target) { | 775 ui::AcceleratorTarget* target) { |
| 776 accelerator_manager_->Unregister(accelerator, target); | 776 accelerator_manager_->Unregister(accelerator, target); |
| 777 } | 777 } |
| 778 | 778 |
| 779 void AcceleratorController::UnregisterAll(ui::AcceleratorTarget* target) { | 779 void AcceleratorController::UnregisterAll(ui::AcceleratorTarget* target) { |
| 780 accelerator_manager_->UnregisterAll(target); | 780 accelerator_manager_->UnregisterAll(target); |
| 781 } | 781 } |
| 782 | 782 |
| 783 bool AcceleratorController::Process(const ui::Accelerator& accelerator) { | 783 bool AcceleratorController::Process(const ui::Accelerator& accelerator) { |
| 784 if (ime_control_delegate_) | |
| 785 return accelerator_manager_->Process(accelerator); | |
| 786 return accelerator_manager_->Process(accelerator); | 784 return accelerator_manager_->Process(accelerator); |
| 787 } | 785 } |
| 788 | 786 |
| 789 bool AcceleratorController::IsRegistered( | 787 bool AcceleratorController::IsRegistered( |
| 790 const ui::Accelerator& accelerator) const { | 788 const ui::Accelerator& accelerator) const { |
| 791 return accelerator_manager_->GetCurrentTarget(accelerator) != NULL; | 789 return accelerator_manager_->IsRegistered(accelerator); |
| 792 } | 790 } |
| 793 | 791 |
| 794 bool AcceleratorController::IsPreferred( | 792 bool AcceleratorController::IsPreferred( |
| 795 const ui::Accelerator& accelerator) const { | 793 const ui::Accelerator& accelerator) const { |
| 796 std::map<ui::Accelerator, AcceleratorAction>::const_iterator iter = | 794 std::map<ui::Accelerator, AcceleratorAction>::const_iterator iter = |
| 797 accelerators_.find(accelerator); | 795 accelerators_.find(accelerator); |
| 798 if (iter == accelerators_.end()) | 796 if (iter == accelerators_.end()) |
| 799 return false; // not an accelerator. | 797 return false; // not an accelerator. |
| 800 | 798 |
| 801 return preferred_actions_.find(iter->second) != preferred_actions_.end(); | 799 return preferred_actions_.find(iter->second) != preferred_actions_.end(); |
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1445 } | 1443 } |
| 1446 | 1444 |
| 1447 void AcceleratorController::SetKeyboardBrightnessControlDelegate( | 1445 void AcceleratorController::SetKeyboardBrightnessControlDelegate( |
| 1448 std::unique_ptr<KeyboardBrightnessControlDelegate> | 1446 std::unique_ptr<KeyboardBrightnessControlDelegate> |
| 1449 keyboard_brightness_control_delegate) { | 1447 keyboard_brightness_control_delegate) { |
| 1450 keyboard_brightness_control_delegate_ = | 1448 keyboard_brightness_control_delegate_ = |
| 1451 std::move(keyboard_brightness_control_delegate); | 1449 std::move(keyboard_brightness_control_delegate); |
| 1452 } | 1450 } |
| 1453 | 1451 |
| 1454 } // namespace ash | 1452 } // namespace ash |
| OLD | NEW |