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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 AcceleratorController::~AcceleratorController() { | 188 AcceleratorController::~AcceleratorController() { |
189 } | 189 } |
190 | 190 |
191 void AcceleratorController::Init() { | 191 void AcceleratorController::Init() { |
192 for (size_t i = 0; i < kActionsAllowedAtLoginScreenLength; ++i) { | 192 for (size_t i = 0; i < kActionsAllowedAtLoginScreenLength; ++i) { |
193 actions_allowed_at_login_screen_.insert(kActionsAllowedAtLoginScreen[i]); | 193 actions_allowed_at_login_screen_.insert(kActionsAllowedAtLoginScreen[i]); |
194 } | 194 } |
195 | 195 |
196 for (size_t i = 0; i < kAcceleratorDataLength; ++i) { | 196 for (size_t i = 0; i < kAcceleratorDataLength; ++i) { |
197 ui::Accelerator accelerator(kAcceleratorData[i].keycode, | 197 ui::Accelerator accelerator(kAcceleratorData[i].keycode, |
198 kAcceleratorData[i].shift, | 198 kAcceleratorData[i].modifiers); |
199 kAcceleratorData[i].ctrl, | |
200 kAcceleratorData[i].alt); | |
201 accelerator.set_type(kAcceleratorData[i].trigger_on_press ? | 199 accelerator.set_type(kAcceleratorData[i].trigger_on_press ? |
202 ui::ET_KEY_PRESSED : ui::ET_KEY_RELEASED); | 200 ui::ET_KEY_PRESSED : ui::ET_KEY_RELEASED); |
203 Register(accelerator, this); | 201 Register(accelerator, this); |
204 accelerators_.insert( | 202 accelerators_.insert( |
205 std::make_pair(accelerator, kAcceleratorData[i].action)); | 203 std::make_pair(accelerator, kAcceleratorData[i].action)); |
206 } | 204 } |
207 } | 205 } |
208 | 206 |
209 void AcceleratorController::Register(const ui::Accelerator& accelerator, | 207 void AcceleratorController::Register(const ui::Accelerator& accelerator, |
210 ui::AcceleratorTarget* target) { | 208 ui::AcceleratorTarget* target) { |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 // Then set this one as active. | 498 // Then set this one as active. |
501 Shell::GetInstance()->launcher()->ActivateLauncherItem(found_index); | 499 Shell::GetInstance()->launcher()->ActivateLauncherItem(found_index); |
502 } | 500 } |
503 } | 501 } |
504 | 502 |
505 bool AcceleratorController::CanHandleAccelerators() const { | 503 bool AcceleratorController::CanHandleAccelerators() const { |
506 return true; | 504 return true; |
507 } | 505 } |
508 | 506 |
509 } // namespace ash | 507 } // namespace ash |
OLD | NEW |