| 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 "ash/accelerators/accelerator_table.h" | 7 #include "ash/accelerators/accelerator_table.h" |
| 8 #include "ash/ash_switches.h" | 8 #include "ash/ash_switches.h" |
| 9 #include "ash/caps_lock_delegate.h" | 9 #include "ash/caps_lock_delegate.h" |
| 10 #include "ash/desktop_background/desktop_background_controller.h" | 10 #include "ash/desktop_background/desktop_background_controller.h" |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 actions_allowed_at_login_screen_.insert( | 193 actions_allowed_at_login_screen_.insert( |
| 194 kActionsAllowedAtLoginOrLockScreen[i]); | 194 kActionsAllowedAtLoginOrLockScreen[i]); |
| 195 actions_allowed_at_lock_screen_.insert( | 195 actions_allowed_at_lock_screen_.insert( |
| 196 kActionsAllowedAtLoginOrLockScreen[i]); | 196 kActionsAllowedAtLoginOrLockScreen[i]); |
| 197 } | 197 } |
| 198 for (size_t i = 0; i < kActionsAllowedAtLockScreenLength; ++i) { | 198 for (size_t i = 0; i < kActionsAllowedAtLockScreenLength; ++i) { |
| 199 actions_allowed_at_lock_screen_.insert(kActionsAllowedAtLockScreen[i]); | 199 actions_allowed_at_lock_screen_.insert(kActionsAllowedAtLockScreen[i]); |
| 200 } | 200 } |
| 201 | 201 |
| 202 for (size_t i = 0; i < kAcceleratorDataLength; ++i) { | 202 for (size_t i = 0; i < kAcceleratorDataLength; ++i) { |
| 203 ui::Accelerator accelerator(kAcceleratorData[i].keycode, | 203 const ui::Accelerator accelerator(kAcceleratorData[i].keycode, |
| 204 kAcceleratorData[i].modifiers); | 204 kAcceleratorData[i].modifiers, |
| 205 accelerator.set_type(kAcceleratorData[i].trigger_on_press ? | 205 kAcceleratorData[i].trigger_on_press ? |
| 206 ui::ET_KEY_PRESSED : ui::ET_KEY_RELEASED); | 206 ui::ET_KEY_PRESSED : ui::ET_KEY_RELEASED); |
| 207 Register(accelerator, this); | 207 Register(accelerator, this); |
| 208 accelerators_.insert( | 208 accelerators_.insert( |
| 209 std::make_pair(accelerator, kAcceleratorData[i].action)); | 209 std::make_pair(accelerator, kAcceleratorData[i].action)); |
| 210 } | 210 } |
| 211 } | 211 } |
| 212 | 212 |
| 213 void AcceleratorController::Register(const ui::Accelerator& accelerator, | 213 void AcceleratorController::Register(const ui::Accelerator& accelerator, |
| 214 ui::AcceleratorTarget* target) { | 214 ui::AcceleratorTarget* target) { |
| 215 accelerator_manager_->Register(accelerator, | 215 accelerator_manager_->Register(accelerator, |
| 216 ui::AcceleratorManager::kNormalPriority, | 216 ui::AcceleratorManager::kNormalPriority, |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 // Then set this one as active. | 513 // Then set this one as active. |
| 514 Shell::GetInstance()->launcher()->ActivateLauncherItem(found_index); | 514 Shell::GetInstance()->launcher()->ActivateLauncherItem(found_index); |
| 515 } | 515 } |
| 516 } | 516 } |
| 517 | 517 |
| 518 bool AcceleratorController::CanHandleAccelerators() const { | 518 bool AcceleratorController::CanHandleAccelerators() const { |
| 519 return true; | 519 return true; |
| 520 } | 520 } |
| 521 | 521 |
| 522 } // namespace ash | 522 } // namespace ash |
| OLD | NEW |