| 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/desktop_background/desktop_background_controller.h" | 8 #include "ash/desktop_background/desktop_background_controller.h" |
| 9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
| 10 #include "ash/caps_lock_delegate.h" | 10 #include "ash/caps_lock_delegate.h" |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 for (size_t i = 0; i < kActionsAllowedAtLoginScreenLength; ++i) { | 244 for (size_t i = 0; i < kActionsAllowedAtLoginScreenLength; ++i) { |
| 245 CHECK(actions_allowed_at_login_screen_.insert( | 245 CHECK(actions_allowed_at_login_screen_.insert( |
| 246 kActionsAllowedAtLoginScreen[i]).second); | 246 kActionsAllowedAtLoginScreen[i]).second); |
| 247 } | 247 } |
| 248 | 248 |
| 249 for (size_t i = 0; i < kAcceleratorDataLength; ++i) { | 249 for (size_t i = 0; i < kAcceleratorDataLength; ++i) { |
| 250 ui::Accelerator accelerator(kAcceleratorData[i].keycode, | 250 ui::Accelerator accelerator(kAcceleratorData[i].keycode, |
| 251 kAcceleratorData[i].shift, | 251 kAcceleratorData[i].shift, |
| 252 kAcceleratorData[i].ctrl, | 252 kAcceleratorData[i].ctrl, |
| 253 kAcceleratorData[i].alt); | 253 kAcceleratorData[i].alt); |
| 254 accelerator.set_type(kAcceleratorData[i].type); | 254 accelerator.set_type(kAcceleratorData[i].trigger_on_press ? |
| 255 ui::ET_KEY_PRESSED : ui::ET_KEY_RELEASED); |
| 255 Register(accelerator, this); | 256 Register(accelerator, this); |
| 256 CHECK(accelerators_.insert( | 257 CHECK(accelerators_.insert( |
| 257 std::make_pair(accelerator, kAcceleratorData[i].action)).second); | 258 std::make_pair(accelerator, kAcceleratorData[i].action)).second); |
| 258 } | 259 } |
| 259 } | 260 } |
| 260 | 261 |
| 261 void AcceleratorController::Register(const ui::Accelerator& accelerator, | 262 void AcceleratorController::Register(const ui::Accelerator& accelerator, |
| 262 ui::AcceleratorTarget* target) { | 263 ui::AcceleratorTarget* target) { |
| 263 accelerator_manager_->Register(accelerator, | 264 accelerator_manager_->Register(accelerator, |
| 264 ui::AcceleratorManager::kNormalPriority, | 265 ui::AcceleratorManager::kNormalPriority, |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 // Then set this one as active. | 504 // Then set this one as active. |
| 504 ActivateLauncherItem(found_index); | 505 ActivateLauncherItem(found_index); |
| 505 } | 506 } |
| 506 } | 507 } |
| 507 | 508 |
| 508 bool AcceleratorController::CanHandleAccelerators() const { | 509 bool AcceleratorController::CanHandleAccelerators() const { |
| 509 return true; | 510 return true; |
| 510 } | 511 } |
| 511 | 512 |
| 512 } // namespace ash | 513 } // namespace ash |
| OLD | NEW |