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

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

Issue 2689143002: ash: Remove OS_CHROMEOS ifdefs from accelerator files (Closed)
Patch Set: rebase Created 3 years, 10 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 wallpaper::WALLPAPER_LAYOUT_CENTER); 120 wallpaper::WALLPAPER_LAYOUT_CENTER);
121 break; 121 break;
122 case 3: 122 case 3:
123 wallpaper_controller->SetWallpaperImage( 123 wallpaper_controller->SetWallpaperImage(
124 CreateWallpaperImage(SK_ColorGREEN, SK_ColorRED), 124 CreateWallpaperImage(SK_ColorGREEN, SK_ColorRED),
125 wallpaper::WALLPAPER_LAYOUT_CENTER_CROPPED); 125 wallpaper::WALLPAPER_LAYOUT_CENTER_CROPPED);
126 break; 126 break;
127 } 127 }
128 } 128 }
129 129
130 #if defined(OS_CHROMEOS)
131
132 void HandleToggleTouchpad() { 130 void HandleToggleTouchpad() {
133 base::RecordAction(base::UserMetricsAction("Accel_Toggle_Touchpad")); 131 base::RecordAction(base::UserMetricsAction("Accel_Toggle_Touchpad"));
134 ash::WmShell::Get()->delegate()->ToggleTouchpad(); 132 ash::WmShell::Get()->delegate()->ToggleTouchpad();
135 } 133 }
136 134
137 void HandleToggleTouchscreen() { 135 void HandleToggleTouchscreen() {
138 base::RecordAction(base::UserMetricsAction("Accel_Toggle_Touchscreen")); 136 base::RecordAction(base::UserMetricsAction("Accel_Toggle_Touchscreen"));
139 ShellDelegate* delegate = WmShell::Get()->delegate(); 137 ShellDelegate* delegate = WmShell::Get()->delegate();
140 delegate->SetTouchscreenEnabledInPrefs( 138 delegate->SetTouchscreenEnabledInPrefs(
141 !delegate->IsTouchscreenEnabledInPrefs(false /* use_local_state */), 139 !delegate->IsTouchscreenEnabledInPrefs(false /* use_local_state */),
142 false /* use_local_state */); 140 false /* use_local_state */);
143 delegate->UpdateTouchscreenStatusFromPrefs(); 141 delegate->UpdateTouchscreenStatusFromPrefs();
144 } 142 }
145 143
146 void HandleToggleTouchView() { 144 void HandleToggleTouchView() {
147 MaximizeModeController* controller = 145 MaximizeModeController* controller =
148 WmShell::Get()->maximize_mode_controller(); 146 WmShell::Get()->maximize_mode_controller();
149 controller->EnableMaximizeModeWindowManager( 147 controller->EnableMaximizeModeWindowManager(
150 !controller->IsMaximizeModeWindowManagerEnabled()); 148 !controller->IsMaximizeModeWindowManagerEnabled());
151 } 149 }
152 150
153 #endif // defined(OS_CHROMEOS)
154
155 void HandleTriggerCrash() { 151 void HandleTriggerCrash() {
156 CHECK(false) << "Intentional crash via debug accelerator."; 152 CHECK(false) << "Intentional crash via debug accelerator.";
157 } 153 }
158 154
159 } // namespace 155 } // namespace
160 156
161 void PrintUIHierarchies() { 157 void PrintUIHierarchies() {
162 // This is a separate command so the user only has to hit one key to generate 158 // This is a separate command so the user only has to hit one key to generate
163 // all the logs. Developers use the individual dumps repeatedly, so keep 159 // all the logs. Developers use the individual dumps repeatedly, so keep
164 // those as separate commands to avoid spamming their logs. 160 // those as separate commands to avoid spamming their logs.
(...skipping 10 matching lines...) Expand all
175 bool DeveloperAcceleratorsEnabled() { 171 bool DeveloperAcceleratorsEnabled() {
176 return base::CommandLine::ForCurrentProcess()->HasSwitch( 172 return base::CommandLine::ForCurrentProcess()->HasSwitch(
177 switches::kAshDeveloperShortcuts); 173 switches::kAshDeveloperShortcuts);
178 } 174 }
179 175
180 void PerformDebugActionIfEnabled(AcceleratorAction action) { 176 void PerformDebugActionIfEnabled(AcceleratorAction action) {
181 if (!DebugAcceleratorsEnabled()) 177 if (!DebugAcceleratorsEnabled())
182 return; 178 return;
183 179
184 switch (action) { 180 switch (action) {
185 #if defined(OS_CHROMEOS) 181 case DEBUG_PRINT_LAYER_HIERARCHY:
182 HandlePrintLayerHierarchy();
183 break;
184 case DEBUG_PRINT_VIEW_HIERARCHY:
185 HandlePrintViewHierarchy();
186 break;
187 case DEBUG_PRINT_WINDOW_HIERARCHY:
188 HandlePrintWindowHierarchy();
189 break;
186 case DEBUG_SHOW_TOAST: 190 case DEBUG_SHOW_TOAST:
187 WmShell::Get()->toast_manager()->Show( 191 WmShell::Get()->toast_manager()->Show(
188 ToastData("id", base::ASCIIToUTF16("Toast"), 5000 /* duration_ms */, 192 ToastData("id", base::ASCIIToUTF16("Toast"), 5000 /* duration_ms */,
189 base::ASCIIToUTF16("Dismiss"))); 193 base::ASCIIToUTF16("Dismiss")));
190 break; 194 break;
191 case DEBUG_TOGGLE_TOUCH_PAD: 195 case DEBUG_TOGGLE_TOUCH_PAD:
192 HandleToggleTouchpad(); 196 HandleToggleTouchpad();
193 break; 197 break;
194 case DEBUG_TOGGLE_TOUCH_SCREEN: 198 case DEBUG_TOGGLE_TOUCH_SCREEN:
195 HandleToggleTouchscreen(); 199 HandleToggleTouchscreen();
196 break; 200 break;
197 case DEBUG_TOGGLE_TOUCH_VIEW: 201 case DEBUG_TOGGLE_TOUCH_VIEW:
198 HandleToggleTouchView(); 202 HandleToggleTouchView();
199 break; 203 break;
200 #endif
201 case DEBUG_TOGGLE_WALLPAPER_MODE: 204 case DEBUG_TOGGLE_WALLPAPER_MODE:
202 HandleToggleWallpaperMode(); 205 HandleToggleWallpaperMode();
203 break; 206 break;
204 case DEBUG_PRINT_LAYER_HIERARCHY:
205 HandlePrintLayerHierarchy();
206 break;
207 case DEBUG_PRINT_VIEW_HIERARCHY:
208 HandlePrintViewHierarchy();
209 break;
210 case DEBUG_PRINT_WINDOW_HIERARCHY:
211 HandlePrintWindowHierarchy();
212 break;
213 case DEBUG_TRIGGER_CRASH: 207 case DEBUG_TRIGGER_CRASH:
214 HandleTriggerCrash(); 208 HandleTriggerCrash();
215 break; 209 break;
216 default: 210 default:
217 break; 211 break;
218 } 212 }
219 } 213 }
220 214
221 } // namespace debug 215 } // namespace debug
222 } // namespace ash 216 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/accelerators/accelerator_table_unittest.cc ('k') | ash/common/accelerators/exit_warning_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698