Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: ui/aura_shell/shell_accelerator_controller.cc

Issue 8585007: Added hotkey support to 8508009 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: for try bots Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/aura_shell/modal_container_layout_manager.cc ('k') | ui/aura_shell/status_area_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
12 #include "ui/gfx/compositor/layer_animation_sequence.h" 13 #include "ui/gfx/compositor/layer_animation_sequence.h"
13 #include "ui/gfx/compositor/layer_animator.h" 14 #include "ui/gfx/compositor/layer_animator.h"
14 #include "ui/gfx/compositor/screen_rotation.h" 15 #include "ui/gfx/compositor/screen_rotation.h"
15 16
16 namespace { 17 namespace {
17 18
18 // Acceleraters handled by ShellAcceleratorController. 19 // Acceleraters handled by ShellAcceleratorController.
19 struct AcceleratorData { 20 struct AcceleratorData {
20 ui::KeyboardCode keycode; 21 ui::KeyboardCode keycode;
21 bool shift; 22 bool shift;
22 bool ctrl; 23 bool ctrl;
23 bool alt; 24 bool alt;
24 } kAcceleratorData[] = { 25 } kAcceleratorData[] = {
25 { ui::VKEY_F11, false, false, false }, 26 { ui::VKEY_F11, false, false, false },
26 { ui::VKEY_HOME, false, true, false }, 27 { ui::VKEY_HOME, false, true, false },
28 { ui::VKEY_L, false, false, true },
27 }; 29 };
28 30
29 // Registers the accelerators with ShellAcceleratorController. 31 // Registers the accelerators with ShellAcceleratorController.
30 void RegisterAccelerators(aura_shell::ShellAcceleratorController* controller) { 32 void RegisterAccelerators(aura_shell::ShellAcceleratorController* controller) {
31 for (size_t i = 0; i < arraysize(kAcceleratorData); ++i) { 33 for (size_t i = 0; i < arraysize(kAcceleratorData); ++i) {
32 controller->Register(ui::Accelerator(kAcceleratorData[i].keycode, 34 controller->Register(ui::Accelerator(kAcceleratorData[i].keycode,
33 kAcceleratorData[i].shift, 35 kAcceleratorData[i].shift,
34 kAcceleratorData[i].ctrl, 36 kAcceleratorData[i].ctrl,
35 kAcceleratorData[i].alt), 37 kAcceleratorData[i].alt),
36 controller); 38 controller);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 bool ShellAcceleratorController::AcceleratorPressed( 113 bool ShellAcceleratorController::AcceleratorPressed(
112 const ui::Accelerator& accelerator) { 114 const ui::Accelerator& accelerator) {
113 #if !defined(NDEBUG) 115 #if !defined(NDEBUG)
114 if (accelerator.key_code() == ui::VKEY_F11) { 116 if (accelerator.key_code() == ui::VKEY_F11) {
115 aura::Desktop::GetInstance()->ToggleFullScreen(); 117 aura::Desktop::GetInstance()->ToggleFullScreen();
116 return true; 118 return true;
117 } else if (accelerator.key_code() == ui::VKEY_HOME && 119 } else if (accelerator.key_code() == ui::VKEY_HOME &&
118 accelerator.IsCtrlDown()) { 120 accelerator.IsCtrlDown()) {
119 RotateScreen(); 121 RotateScreen();
120 return true; 122 return true;
123 } else if (accelerator.key_code() == ui::VKEY_L &&
124 accelerator.IsAltDown()) {
125 ui::PrintLayerHierarchy(aura::Desktop::GetInstance()->layer());
126 return true;
121 } 127 }
122 #endif 128 #endif
123 return false; 129 return false;
124 } 130 }
125 131
126 } // namespace aura_shell 132 } // namespace aura_shell
OLDNEW
« no previous file with comments | « ui/aura_shell/modal_container_layout_manager.cc ('k') | ui/aura_shell/status_area_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698