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

Side by Side Diff: ash/common/accelerators/debug_commands.cc

Issue 2323863002: Separate debugging and developer accelerators (Closed)
Patch Set: Nits Created 4 years, 3 months 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/common/accelerators/debug_commands.h" 5 #include "ash/common/accelerators/debug_commands.h"
6 6
7 #include "ash/common/accelerators/accelerator_commands.h" 7 #include "ash/common/accelerators/accelerator_commands.h"
8 #include "ash/common/ash_switches.h" 8 #include "ash/common/ash_switches.h"
9 #include "ash/common/shell_delegate.h" 9 #include "ash/common/shell_delegate.h"
10 #include "ash/common/system/toast/toast_data.h" 10 #include "ash/common/system/toast/toast_data.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 void HandleToggleTouchpad() { 124 void HandleToggleTouchpad() {
125 base::RecordAction(base::UserMetricsAction("Accel_Toggle_Touchpad")); 125 base::RecordAction(base::UserMetricsAction("Accel_Toggle_Touchpad"));
126 ash::WmShell::Get()->delegate()->ToggleTouchpad(); 126 ash::WmShell::Get()->delegate()->ToggleTouchpad();
127 } 127 }
128 128
129 void HandleToggleTouchscreen() { 129 void HandleToggleTouchscreen() {
130 base::RecordAction(base::UserMetricsAction("Accel_Toggle_Touchscreen")); 130 base::RecordAction(base::UserMetricsAction("Accel_Toggle_Touchscreen"));
131 ash::WmShell::Get()->delegate()->ToggleTouchscreen(); 131 ash::WmShell::Get()->delegate()->ToggleTouchscreen();
132 } 132 }
133 133
134 void HandleToggleToggleTouchView() { 134 void HandleToggleTouchView() {
135 MaximizeModeController* controller = 135 MaximizeModeController* controller =
136 WmShell::Get()->maximize_mode_controller(); 136 WmShell::Get()->maximize_mode_controller();
137 controller->EnableMaximizeModeWindowManager( 137 controller->EnableMaximizeModeWindowManager(
138 !controller->IsMaximizeModeWindowManagerEnabled()); 138 !controller->IsMaximizeModeWindowManagerEnabled());
139 } 139 }
140 140
141 #endif // defined(OS_CHROMEOS) 141 #endif // defined(OS_CHROMEOS)
142 142
143 } // namespace 143 } // namespace
144 144
145 void PrintUIHierarchies() { 145 void PrintUIHierarchies() {
146 // This is a separate command so the user only has to hit one key to generate 146 // This is a separate command so the user only has to hit one key to generate
147 // all the logs. Developers use the individual dumps repeatedly, so keep 147 // all the logs. Developers use the individual dumps repeatedly, so keep
148 // those as separate commands to avoid spamming their logs. 148 // those as separate commands to avoid spamming their logs.
149 HandlePrintLayerHierarchy(); 149 HandlePrintLayerHierarchy();
150 HandlePrintWindowHierarchy(); 150 HandlePrintWindowHierarchy();
151 HandlePrintViewHierarchy(); 151 HandlePrintViewHierarchy();
152 } 152 }
153 153
154 bool DebugAcceleratorsEnabled() { 154 bool DebugAcceleratorsEnabled() {
155 return base::CommandLine::ForCurrentProcess()->HasSwitch( 155 return base::CommandLine::ForCurrentProcess()->HasSwitch(
156 switches::kAshDebugShortcuts); 156 switches::kAshDebugShortcuts);
157 } 157 }
158 158
159 bool DeveloperAcceleratorsEnabled() {
160 return base::CommandLine::ForCurrentProcess()->HasSwitch(
161 switches::kAshDeveloperShortcuts);
162 }
163
159 void PerformDebugActionIfEnabled(AcceleratorAction action) { 164 void PerformDebugActionIfEnabled(AcceleratorAction action) {
160 if (!DebugAcceleratorsEnabled()) 165 if (!DebugAcceleratorsEnabled())
161 return; 166 return;
162 167
163 switch (action) { 168 switch (action) {
164 #if defined(OS_CHROMEOS) 169 #if defined(OS_CHROMEOS)
165 case DEBUG_SHOW_TOAST: 170 case DEBUG_SHOW_TOAST:
166 WmShell::Get()->toast_manager()->Show( 171 WmShell::Get()->toast_manager()->Show(
167 ToastData("id", base::ASCIIToUTF16("Toast"), 5000 /* duration_ms */, 172 ToastData("id", base::ASCIIToUTF16("Toast"), 5000 /* duration_ms */,
168 base::ASCIIToUTF16("Dismiss"))); 173 base::ASCIIToUTF16("Dismiss")));
169 break; 174 break;
170 case DEBUG_TOGGLE_TOUCH_PAD: 175 case DEBUG_TOGGLE_TOUCH_PAD:
171 HandleToggleTouchpad(); 176 HandleToggleTouchpad();
172 break; 177 break;
173 case DEBUG_TOGGLE_TOUCH_SCREEN: 178 case DEBUG_TOGGLE_TOUCH_SCREEN:
174 HandleToggleTouchscreen(); 179 HandleToggleTouchscreen();
175 break; 180 break;
176 case DEBUG_TOGGLE_TOUCH_VIEW: 181 case DEBUG_TOGGLE_TOUCH_VIEW:
177 HandleToggleToggleTouchView(); 182 HandleToggleTouchView();
178 break; 183 break;
179 #endif 184 #endif
180 case DEBUG_TOGGLE_WALLPAPER_MODE: 185 case DEBUG_TOGGLE_WALLPAPER_MODE:
181 HandleToggleWallpaperMode(); 186 HandleToggleWallpaperMode();
182 break; 187 break;
183 case DEBUG_PRINT_LAYER_HIERARCHY: 188 case DEBUG_PRINT_LAYER_HIERARCHY:
184 HandlePrintLayerHierarchy(); 189 HandlePrintLayerHierarchy();
185 break; 190 break;
186 case DEBUG_PRINT_VIEW_HIERARCHY: 191 case DEBUG_PRINT_VIEW_HIERARCHY:
187 HandlePrintViewHierarchy(); 192 HandlePrintViewHierarchy();
188 break; 193 break;
189 case DEBUG_PRINT_WINDOW_HIERARCHY: 194 case DEBUG_PRINT_WINDOW_HIERARCHY:
190 HandlePrintWindowHierarchy(); 195 HandlePrintWindowHierarchy();
191 break; 196 break;
192 default: 197 default:
193 break; 198 break;
194 } 199 }
195 } 200 }
196 201
197 } // namespace debug 202 } // namespace debug
198 } // namespace ash 203 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698