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

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

Issue 8771015: Rename Desktop->RootWindow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' 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/shell.cc ('k') | ui/aura_shell/shell_accelerator_filter.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 "base/logging.h" 7 #include "base/logging.h"
8 #include "ui/aura/desktop.h"
9 #include "ui/aura/event.h" 8 #include "ui/aura/event.h"
9 #include "ui/aura/root_window.h"
10 #include "ui/aura_shell/shell.h" 10 #include "ui/aura_shell/shell.h"
11 #include "ui/base/accelerators/accelerator.h" 11 #include "ui/base/accelerators/accelerator.h"
12 #include "ui/base/accelerators/accelerator_manager.h" 12 #include "ui/base/accelerators/accelerator_manager.h"
13 #include "ui/gfx/compositor/debug_utils.h" 13 #include "ui/gfx/compositor/debug_utils.h"
14 #include "ui/gfx/compositor/layer_animation_sequence.h" 14 #include "ui/gfx/compositor/layer_animation_sequence.h"
15 #include "ui/gfx/compositor/layer_animator.h" 15 #include "ui/gfx/compositor/layer_animator.h"
16 #include "ui/gfx/compositor/screen_rotation.h" 16 #include "ui/gfx/compositor/screen_rotation.h"
17 17
18 namespace { 18 namespace {
19 19
20 enum AcceleratorAction { 20 enum AcceleratorAction {
21 CYCLE_BACKWARD, 21 CYCLE_BACKWARD,
22 CYCLE_FORWARD, 22 CYCLE_FORWARD,
23 TAKE_SCREENSHOT, 23 TAKE_SCREENSHOT,
24 #if !defined(NDEBUG) 24 #if !defined(NDEBUG)
25 ROTATE_SCREEN, 25 ROTATE_SCREEN,
26 PRINT_LAYER_HIERARCHY, 26 PRINT_LAYER_HIERARCHY,
27 TOGGLE_DESKTOP_FULL_SCREEN, 27 TOGGLE_ROOT_WINDOW_FULL_SCREEN,
28 #endif 28 #endif
29 }; 29 };
30 30
31 // Acceleraters handled by ShellAcceleratorController. 31 // Acceleraters handled by ShellAcceleratorController.
32 struct AcceleratorData { 32 struct AcceleratorData {
33 ui::KeyboardCode keycode; 33 ui::KeyboardCode keycode;
34 bool shift; 34 bool shift;
35 bool ctrl; 35 bool ctrl;
36 bool alt; 36 bool alt;
37 AcceleratorAction action; 37 AcceleratorAction action;
38 } kAcceleratorData[] = { 38 } kAcceleratorData[] = {
39 { ui::VKEY_TAB, true, false, true, CYCLE_BACKWARD }, 39 { ui::VKEY_TAB, true, false, true, CYCLE_BACKWARD },
40 { ui::VKEY_TAB, false, false, true, CYCLE_FORWARD }, 40 { ui::VKEY_TAB, false, false, true, CYCLE_FORWARD },
41 { ui::VKEY_F5, false, true, false, TAKE_SCREENSHOT }, 41 { ui::VKEY_F5, false, true, false, TAKE_SCREENSHOT },
42 { ui::VKEY_PRINT, false, false, false, TAKE_SCREENSHOT }, 42 { ui::VKEY_PRINT, false, false, false, TAKE_SCREENSHOT },
43 #if !defined(NDEBUG) 43 #if !defined(NDEBUG)
44 { ui::VKEY_HOME, false, true, false, ROTATE_SCREEN }, 44 { ui::VKEY_HOME, false, true, false, ROTATE_SCREEN },
45 { ui::VKEY_F11, false, true, false, TOGGLE_DESKTOP_FULL_SCREEN }, 45 { ui::VKEY_F11, false, true, false, TOGGLE_ROOT_WINDOW_FULL_SCREEN },
46 { ui::VKEY_L, false, false, true, PRINT_LAYER_HIERARCHY }, 46 { ui::VKEY_L, false, false, true, PRINT_LAYER_HIERARCHY },
47 #endif 47 #endif
48 }; 48 };
49 49
50 bool HandleCycleBackward() { 50 bool HandleCycleBackward() {
51 // TODO(mazda): http://crbug.com/105204 51 // TODO(mazda): http://crbug.com/105204
52 NOTIMPLEMENTED(); 52 NOTIMPLEMENTED();
53 return false; 53 return false;
54 } 54 }
55 55
(...skipping 24 matching lines...) Expand all
80 case 6: delta = -90; break; 80 case 6: delta = -90; break;
81 case 7: delta = -90; break; 81 case 7: delta = -90; break;
82 case 8: delta = -90; break; 82 case 8: delta = -90; break;
83 case 9: delta = 180; break; 83 case 9: delta = 180; break;
84 case 10: delta = 180; break; 84 case 10: delta = 180; break;
85 case 11: delta = 90; break; 85 case 11: delta = 90; break;
86 case 12: delta = 180; break; 86 case 12: delta = 180; break;
87 case 13: delta = 180; break; 87 case 13: delta = 180; break;
88 } 88 }
89 i = (i + 1) % 14; 89 i = (i + 1) % 14;
90 aura::Desktop::GetInstance()->layer()->GetAnimator()->set_preemption_strategy( 90 aura::RootWindow::GetInstance()->layer()->GetAnimator()->
91 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); 91 set_preemption_strategy(ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS);
92 scoped_ptr<ui::LayerAnimationSequence> screen_rotation( 92 scoped_ptr<ui::LayerAnimationSequence> screen_rotation(
93 new ui::LayerAnimationSequence(new ui::ScreenRotation(delta))); 93 new ui::LayerAnimationSequence(new ui::ScreenRotation(delta)));
94 screen_rotation->AddObserver(aura::Desktop::GetInstance()); 94 screen_rotation->AddObserver(aura::RootWindow::GetInstance());
95 aura::Desktop::GetInstance()->layer()->GetAnimator()->StartAnimation( 95 aura::RootWindow::GetInstance()->layer()->GetAnimator()->StartAnimation(
96 screen_rotation.release()); 96 screen_rotation.release());
97 return true; 97 return true;
98 } 98 }
99 99
100 bool HandleToggleDesktopFullScreen() { 100 bool HandleToggleRootWindowFullScreen() {
101 aura::Desktop::GetInstance()->ToggleFullScreen(); 101 aura::RootWindow::GetInstance()->ToggleFullScreen();
102 return true; 102 return true;
103 } 103 }
104 104
105 bool HandlePrintLayerHierarchy() { 105 bool HandlePrintLayerHierarchy() {
106 ui::PrintLayerHierarchy(aura::Desktop::GetInstance()->layer()); 106 ui::PrintLayerHierarchy(aura::RootWindow::GetInstance()->layer());
107 return true; 107 return true;
108 } 108 }
109 #endif 109 #endif
110 110
111 } // namespace 111 } // namespace
112 112
113 namespace aura_shell { 113 namespace aura_shell {
114 114
115 //////////////////////////////////////////////////////////////////////////////// 115 ////////////////////////////////////////////////////////////////////////////////
116 // ShellAcceleratorController, public: 116 // ShellAcceleratorController, public:
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 switch (static_cast<AcceleratorAction>(it->second)) { 167 switch (static_cast<AcceleratorAction>(it->second)) {
168 case CYCLE_BACKWARD: 168 case CYCLE_BACKWARD:
169 return HandleCycleBackward(); 169 return HandleCycleBackward();
170 case CYCLE_FORWARD: 170 case CYCLE_FORWARD:
171 return HandleCycleForward(); 171 return HandleCycleForward();
172 case TAKE_SCREENSHOT: 172 case TAKE_SCREENSHOT:
173 return HandleTakeScreenshot(); 173 return HandleTakeScreenshot();
174 #if !defined(NDEBUG) 174 #if !defined(NDEBUG)
175 case ROTATE_SCREEN: 175 case ROTATE_SCREEN:
176 return HandleRotateScreen(); 176 return HandleRotateScreen();
177 case TOGGLE_DESKTOP_FULL_SCREEN: 177 case TOGGLE_ROOT_WINDOW_FULL_SCREEN:
178 return HandleToggleDesktopFullScreen(); 178 return HandleToggleRootWindowFullScreen();
179 case PRINT_LAYER_HIERARCHY: 179 case PRINT_LAYER_HIERARCHY:
180 return HandlePrintLayerHierarchy(); 180 return HandlePrintLayerHierarchy();
181 #endif 181 #endif
182 default: 182 default:
183 NOTREACHED() << "Unhandled action " << it->second;; 183 NOTREACHED() << "Unhandled action " << it->second;;
184 } 184 }
185 return false; 185 return false;
186 } 186 }
187 187
188 } // namespace aura_shell 188 } // namespace aura_shell
OLDNEW
« no previous file with comments | « ui/aura_shell/shell.cc ('k') | ui/aura_shell/shell_accelerator_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698