| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/aura_shell/shell_accelerator_controller.h" | 5 #include "ui/aura_shell/shell_accelerator_controller.h" |
| 6 | 6 |
| 7 #include "ui/aura/desktop.h" | 7 #include "ui/aura/desktop.h" |
| 8 #include "ui/aura/event.h" | 8 #include "ui/aura/event.h" |
| 9 #include "ui/aura_shell/shell.h" | 9 #include "ui/aura_shell/shell.h" |
| 10 #include "ui/base/accelerators/accelerator.h" | 10 #include "ui/base/accelerators/accelerator.h" |
| 11 #include "ui/base/accelerators/accelerator_manager.h" | 11 #include "ui/base/accelerators/accelerator_manager.h" |
| 12 #include "ui/gfx/compositor/debug_utils.h" | |
| 13 #include "ui/gfx/compositor/layer_animation_sequence.h" | 12 #include "ui/gfx/compositor/layer_animation_sequence.h" |
| 14 #include "ui/gfx/compositor/layer_animator.h" | 13 #include "ui/gfx/compositor/layer_animator.h" |
| 15 #include "ui/gfx/compositor/screen_rotation.h" | 14 #include "ui/gfx/compositor/screen_rotation.h" |
| 16 | 15 |
| 17 namespace { | 16 namespace { |
| 18 | 17 |
| 19 // Acceleraters handled by ShellAcceleratorController. | 18 // Acceleraters handled by ShellAcceleratorController. |
| 20 struct AcceleratorData { | 19 struct AcceleratorData { |
| 21 ui::KeyboardCode keycode; | 20 ui::KeyboardCode keycode; |
| 22 bool shift; | 21 bool shift; |
| 23 bool ctrl; | 22 bool ctrl; |
| 24 bool alt; | 23 bool alt; |
| 25 } kAcceleratorData[] = { | 24 } kAcceleratorData[] = { |
| 26 { ui::VKEY_F11, false, false, false }, | 25 { ui::VKEY_F11, false, false, false }, |
| 27 { ui::VKEY_HOME, false, true, false }, | 26 { ui::VKEY_HOME, false, true, false }, |
| 28 { ui::VKEY_L, false, false, true }, | |
| 29 }; | 27 }; |
| 30 | 28 |
| 31 // Registers the accelerators with ShellAcceleratorController. | 29 // Registers the accelerators with ShellAcceleratorController. |
| 32 void RegisterAccelerators(aura_shell::ShellAcceleratorController* controller) { | 30 void RegisterAccelerators(aura_shell::ShellAcceleratorController* controller) { |
| 33 for (size_t i = 0; i < arraysize(kAcceleratorData); ++i) { | 31 for (size_t i = 0; i < arraysize(kAcceleratorData); ++i) { |
| 34 controller->Register(ui::Accelerator(kAcceleratorData[i].keycode, | 32 controller->Register(ui::Accelerator(kAcceleratorData[i].keycode, |
| 35 kAcceleratorData[i].shift, | 33 kAcceleratorData[i].shift, |
| 36 kAcceleratorData[i].ctrl, | 34 kAcceleratorData[i].ctrl, |
| 37 kAcceleratorData[i].alt), | 35 kAcceleratorData[i].alt), |
| 38 controller); | 36 controller); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 bool ShellAcceleratorController::AcceleratorPressed( | 111 bool ShellAcceleratorController::AcceleratorPressed( |
| 114 const ui::Accelerator& accelerator) { | 112 const ui::Accelerator& accelerator) { |
| 115 #if !defined(NDEBUG) | 113 #if !defined(NDEBUG) |
| 116 if (accelerator.key_code() == ui::VKEY_F11) { | 114 if (accelerator.key_code() == ui::VKEY_F11) { |
| 117 aura::Desktop::GetInstance()->ToggleFullScreen(); | 115 aura::Desktop::GetInstance()->ToggleFullScreen(); |
| 118 return true; | 116 return true; |
| 119 } else if (accelerator.key_code() == ui::VKEY_HOME && | 117 } else if (accelerator.key_code() == ui::VKEY_HOME && |
| 120 accelerator.IsCtrlDown()) { | 118 accelerator.IsCtrlDown()) { |
| 121 RotateScreen(); | 119 RotateScreen(); |
| 122 return true; | 120 return true; |
| 123 } else if (accelerator.key_code() == ui::VKEY_L && | |
| 124 accelerator.IsAltDown()) { | |
| 125 ui::PrintLayerHierarchy(aura::Desktop::GetInstance()->layer()); | |
| 126 return true; | |
| 127 } | 121 } |
| 128 #endif | 122 #endif |
| 129 return false; | 123 return false; |
| 130 } | 124 } |
| 131 | 125 |
| 132 } // namespace aura_shell | 126 } // namespace aura_shell |
| OLD | NEW |