summaryrefslogtreecommitdiffstats
path: root/ash/accelerators
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-27 01:53:40 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-27 01:53:40 +0000
commit918f8db43032cb88114b7bcbdf137f94c4ac4e3e (patch)
tree8d4b8806288794f63d12855301c3cad138dd4e33 /ash/accelerators
parent5f683172f6f64e33edcb664e30795808e989c38d (diff)
downloadchromium_src-918f8db43032cb88114b7bcbdf137f94c4ac4e3e.zip
chromium_src-918f8db43032cb88114b7bcbdf137f94c4ac4e3e.tar.gz
chromium_src-918f8db43032cb88114b7bcbdf137f94c4ac4e3e.tar.bz2
Add debug shortcuts that toggles options to shows paint rects.
Cleanup: Separate desktop shortcuts which are useful only on linux desktop, and debug shortcuts. BUG=227375 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=195733 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=195854 Review URL: https://chromiumcodereview.appspot.com/14050009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@196911 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/accelerators')
-rw-r--r--ash/accelerators/accelerator_controller.cc10
-rw-r--r--ash/accelerators/accelerator_table.cc99
-rw-r--r--ash/accelerators/accelerator_table.h23
3 files changed, 75 insertions, 57 deletions
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc
index cdc67dc..ac36027 100644
--- a/ash/accelerators/accelerator_controller.cc
+++ b/ash/accelerators/accelerator_controller.cc
@@ -12,6 +12,7 @@
#include "ash/accelerators/accelerator_table.h"
#include "ash/ash_switches.h"
#include "ash/caps_lock_delegate.h"
+#include "ash/debug.h"
#include "ash/desktop_background/desktop_background_controller.h"
#include "ash/desktop_background/user_wallpaper_delegate.h"
#include "ash/display/display_controller.h"
@@ -368,6 +369,10 @@ void AcceleratorController::Init() {
RegisterAccelerators(kAcceleratorData, kAcceleratorDataLength);
+#if !defined(NDEBUG)
+ RegisterAccelerators(kDesktopAcceleratorData, kDesktopAcceleratorDataLength);
+#endif
+
if (DebugShortcutsEnabled())
RegisterAccelerators(kDebugAcceleratorData, kDebugAcceleratorDataLength);
@@ -808,9 +813,12 @@ bool AcceleratorController::PerformAction(int action,
return HandleToggleDesktopBackgroundMode();
case TOGGLE_ROOT_WINDOW_FULL_SCREEN:
return HandleToggleRootWindowFullScreen();
- case DISPLAY_TOGGLE_SCALE:
+ case DEBUG_TOGGLE_DEVICE_SCALE_FACTOR:
internal::DisplayManager::ToggleDisplayScaleFactor();
return true;
+ case DEBUG_TOGGLE_SHOW_PAINT_RECTS:
+ ash::debug::ToggleShowPaintRects();
+ return true;
case MAGNIFY_SCREEN_ZOOM_IN:
return HandleMagnifyScreen(1);
case MAGNIFY_SCREEN_ZOOM_OUT:
diff --git a/ash/accelerators/accelerator_table.cc b/ash/accelerators/accelerator_table.cc
index a3f4c5b..95725f9 100644
--- a/ash/accelerators/accelerator_table.cc
+++ b/ash/accelerators/accelerator_table.cc
@@ -64,23 +64,6 @@ const AcceleratorData kAcceleratorData[] = {
{ false, ui::VKEY_F13, ui::EF_NONE, LOCK_RELEASED },
{ true, ui::VKEY_POWER, ui::EF_NONE, POWER_PRESSED },
{ false, ui::VKEY_POWER, ui::EF_NONE, POWER_RELEASED },
-#if !defined(NDEBUG)
- // Extra shortcut for debug build to control magnifier on linux desktop.
- { true, ui::VKEY_BRIGHTNESS_DOWN, ui::EF_CONTROL_DOWN,
- MAGNIFY_SCREEN_ZOOM_OUT},
- { true, ui::VKEY_BRIGHTNESS_UP, ui::EF_CONTROL_DOWN, MAGNIFY_SCREEN_ZOOM_IN},
- // Extra shortcut for debug build to activate lock screen on linux desktop.
- { true, ui::VKEY_L, ui::EF_ALT_DOWN, LOCK_SCREEN },
- // Extra shortcut for display swaping as alt-f4 is taken on linux desktop.
- { true, ui::VKEY_F4, ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN,
- SWAP_PRIMARY_DISPLAY },
- // Extra shortcut to lock the screen on linux desktop.
- { true, ui::VKEY_POWER, ui::EF_SHIFT_DOWN, LOCK_PRESSED },
- { false, ui::VKEY_POWER, ui::EF_SHIFT_DOWN, LOCK_RELEASED },
- // Extra shortcut to rotate/scale up/down the screen on linux desktop.
- { true, ui::VKEY_R,
- ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN, ROTATE_SCREEN },
-#endif // !defined(NDEBUG)
{ true, ui::VKEY_O, ui::EF_CONTROL_DOWN, OPEN_FILE_DIALOG },
{ true, ui::VKEY_M, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN,
OPEN_FILE_MANAGER },
@@ -182,25 +165,49 @@ const AcceleratorData kAcceleratorData[] = {
const size_t kAcceleratorDataLength = arraysize(kAcceleratorData);
-const AcceleratorData kDebugAcceleratorData[] = {
- { true, ui::VKEY_B, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN,
- TOGGLE_DESKTOP_BACKGROUND_MODE },
- { true, ui::VKEY_F11, ui::EF_CONTROL_DOWN, TOGGLE_ROOT_WINDOW_FULL_SCREEN },
- { true, ui::VKEY_W, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN, TOGGLE_WIFI },
+#if !defined(NDEBUG)
+const AcceleratorData kDesktopAcceleratorData[] = {
+#if defined(OS_CHROMEOS)
+ // Extra shortcut for debug build to control magnifier on linux desktop.
+ { true, ui::VKEY_BRIGHTNESS_DOWN, ui::EF_CONTROL_DOWN,
+ MAGNIFY_SCREEN_ZOOM_OUT},
+ { true, ui::VKEY_BRIGHTNESS_UP, ui::EF_CONTROL_DOWN, MAGNIFY_SCREEN_ZOOM_IN},
+ // Extra shortcuts to lock the screen on linux desktop.
+ { true, ui::VKEY_L, ui::EF_ALT_DOWN, LOCK_SCREEN },
+ { true, ui::VKEY_POWER, ui::EF_SHIFT_DOWN, LOCK_PRESSED },
+ { false, ui::VKEY_POWER, ui::EF_SHIFT_DOWN, LOCK_RELEASED },
+#endif
+ // Extra shortcut for display swaping as alt-f4 is taken on linux desktop.
+ { true, ui::VKEY_S, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN,
+ SWAP_PRIMARY_DISPLAY },
+ // Extra shortcut to rotate/scale up/down the screen on linux desktop.
+ { true, ui::VKEY_R,
+ ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN, ROTATE_SCREEN },
// For testing on systems where Alt-Tab is already mapped.
{ true, ui::VKEY_W, ui::EF_ALT_DOWN, CYCLE_FORWARD_MRU },
+
+ { true, ui::VKEY_F11, ui::EF_CONTROL_DOWN, TOGGLE_ROOT_WINDOW_FULL_SCREEN },
+ { true, ui::VKEY_W, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN, TOGGLE_WIFI },
{ true, ui::VKEY_W, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN,
CYCLE_BACKWARD_MRU },
- { true, ui::VKEY_HOME, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN,
- DISPLAY_TOGGLE_SCALE },
-#if !defined(NDEBUG)
+ { true, ui::VKEY_B, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN,
+ TOGGLE_DESKTOP_BACKGROUND_MODE },
+};
+
+const size_t kDesktopAcceleratorDataLength = arraysize(kDesktopAcceleratorData);
+#endif
+
+const AcceleratorData kDebugAcceleratorData[] = {
{ true, ui::VKEY_L, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN,
PRINT_LAYER_HIERARCHY },
{ true, ui::VKEY_V, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN,
PRINT_VIEW_HIERARCHY },
{ true, ui::VKEY_W, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN,
PRINT_WINDOW_HIERARCHY },
-#endif
+ { true, ui::VKEY_S, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN,
+ DEBUG_TOGGLE_DEVICE_SCALE_FACTOR },
+ { true, ui::VKEY_P, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN,
+ DEBUG_TOGGLE_SHOW_PAINT_RECTS },
};
const size_t kDebugAcceleratorDataLength = arraysize(kDebugAcceleratorData);
@@ -220,10 +227,6 @@ const size_t kReservedActionsLength = arraysize(kReservedActions);
const AcceleratorAction kActionsAllowedAtLoginOrLockScreen[] = {
BRIGHTNESS_DOWN,
BRIGHTNESS_UP,
-#if defined(OS_CHROMEOS)
- CYCLE_DISPLAY_MODE,
- DISABLE_GPU_WATCHDOG,
-#endif // defined(OS_CHROMEOS)
DISABLE_CAPS_LOCK,
KEYBOARD_BRIGHTNESS_DOWN,
KEYBOARD_BRIGHTNESS_UP,
@@ -231,10 +234,14 @@ const AcceleratorAction kActionsAllowedAtLoginOrLockScreen[] = {
MAGNIFY_SCREEN_ZOOM_OUT, // Control+F6
NEXT_IME,
PREVIOUS_IME,
+ PRINT_LAYER_HIERARCHY,
PRINT_UI_HIERARCHIES,
+ PRINT_VIEW_HIERARCHY,
+ PRINT_WINDOW_HIERARCHY,
+ ROTATE_WINDOW,
SWITCH_IME, // Switch to another IME depending on the accelerator.
- TAKE_SCREENSHOT,
TAKE_PARTIAL_SCREENSHOT,
+ TAKE_SCREENSHOT,
TOGGLE_CAPS_LOCK,
TOGGLE_SPOKEN_FEEDBACK,
TOGGLE_WIFI,
@@ -242,16 +249,14 @@ const AcceleratorAction kActionsAllowedAtLoginOrLockScreen[] = {
VOLUME_DOWN,
VOLUME_MUTE,
VOLUME_UP,
- ROTATE_WINDOW,
-#if !defined(NDEBUG)
- PRINT_LAYER_HIERARCHY,
- PRINT_VIEW_HIERARCHY,
- PRINT_WINDOW_HIERARCHY,
+#if defined(OS_CHROMEOS)
+ CYCLE_DISPLAY_MODE,
+ DISABLE_GPU_WATCHDOG,
#endif
#if defined(OS_CHROMEOS) && !defined(NDEBUG)
POWER_PRESSED,
POWER_RELEASED,
-#endif
+#endif // defined(OS_CHROMEOS)
};
const size_t kActionsAllowedAtLoginOrLockScreenLength =
@@ -285,8 +290,8 @@ const AcceleratorAction kActionsAllowedAtModalWindow[] = {
SHOW_KEYBOARD_OVERLAY,
SWAP_PRIMARY_DISPLAY,
SWITCH_IME,
- TAKE_SCREENSHOT,
TAKE_PARTIAL_SCREENSHOT,
+ TAKE_SCREENSHOT,
TOGGLE_CAPS_LOCK,
TOGGLE_SPOKEN_FEEDBACK,
TOGGLE_WIFI,
@@ -325,10 +330,6 @@ const size_t kNonrepeatableActionsLength =
const AcceleratorAction kActionsAllowedInAppMode[] = {
BRIGHTNESS_DOWN,
BRIGHTNESS_UP,
-#if defined(OS_CHROMEOS)
- CYCLE_DISPLAY_MODE,
- DISABLE_GPU_WATCHDOG,
-#endif // defined(OS_CHROMEOS)
DISABLE_CAPS_LOCK,
KEYBOARD_BRIGHTNESS_DOWN,
KEYBOARD_BRIGHTNESS_UP,
@@ -341,11 +342,14 @@ const AcceleratorAction kActionsAllowedInAppMode[] = {
POWER_PRESSED,
POWER_RELEASED,
PREVIOUS_IME,
+ PRINT_LAYER_HIERARCHY,
PRINT_UI_HIERARCHIES,
+ PRINT_VIEW_HIERARCHY,
+ PRINT_WINDOW_HIERARCHY,
ROTATE_SCREEN,
- SCALE_UI_UP,
SCALE_UI_DOWN,
SCALE_UI_RESET,
+ SCALE_UI_UP,
SWAP_PRIMARY_DISPLAY,
SWITCH_IME, // Switch to another IME depending on the accelerator.
TOGGLE_CAPS_LOCK,
@@ -355,11 +359,10 @@ const AcceleratorAction kActionsAllowedInAppMode[] = {
VOLUME_DOWN,
VOLUME_MUTE,
VOLUME_UP,
-#if !defined(NDEBUG)
- PRINT_LAYER_HIERARCHY,
- PRINT_VIEW_HIERARCHY,
- PRINT_WINDOW_HIERARCHY,
-#endif
+#if defined(OS_CHROMEOS)
+ CYCLE_DISPLAY_MODE,
+ DISABLE_GPU_WATCHDOG,
+#endif // defined(OS_CHROMEOS)
};
const size_t kActionsAllowedInAppModeLength =
diff --git a/ash/accelerators/accelerator_table.h b/ash/accelerators/accelerator_table.h
index 361f314..af63dee 100644
--- a/ash/accelerators/accelerator_table.h
+++ b/ash/accelerators/accelerator_table.h
@@ -21,8 +21,9 @@ enum AcceleratorAction {
CYCLE_BACKWARD_MRU,
CYCLE_FORWARD_LINEAR,
CYCLE_FORWARD_MRU,
+ DEBUG_TOGGLE_DEVICE_SCALE_FACTOR,
+ DEBUG_TOGGLE_SHOW_PAINT_RECTS,
DISABLE_CAPS_LOCK,
- DISPLAY_TOGGLE_SCALE,
EXIT,
FOCUS_LAUNCHER,
FOCUS_NEXT_PANE,
@@ -41,10 +42,13 @@ enum AcceleratorAction {
NEW_WINDOW,
NEXT_IME,
OPEN_FEEDBACK_PAGE,
- PREVIOUS_IME,
POWER_PRESSED,
POWER_RELEASED,
+ PREVIOUS_IME,
+ PRINT_LAYER_HIERARCHY,
PRINT_UI_HIERARCHIES,
+ PRINT_VIEW_HIERARCHY,
+ PRINT_WINDOW_HIERARCHY,
RESTORE_TAB,
ROTATE_SCREEN,
ROTATE_WINDOW,
@@ -89,16 +93,11 @@ enum AcceleratorAction {
WINDOW_SNAP_RIGHT,
#if defined(OS_CHROMEOS)
CYCLE_DISPLAY_MODE,
+ DISABLE_GPU_WATCHDOG,
LOCK_SCREEN,
OPEN_CROSH,
OPEN_FILE_DIALOG, // Open 'Open file' dialog.
OPEN_FILE_MANAGER,
- DISABLE_GPU_WATCHDOG,
-#endif
-#if !defined(NDEBUG)
- PRINT_LAYER_HIERARCHY,
- PRINT_VIEW_HIERARCHY,
- PRINT_WINDOW_HIERARCHY,
#endif
};
@@ -115,6 +114,14 @@ ASH_EXPORT extern const AcceleratorData kAcceleratorData[];
// The number of elements in kAcceleratorData.
ASH_EXPORT extern const size_t kAcceleratorDataLength;
+#if !defined(NDEBUG)
+// Accelerators useful when running on desktop. Debug build only.
+ASH_EXPORT extern const AcceleratorData kDesktopAcceleratorData[];
+
+// The number of elements in kDesktopAcceleratorData.
+ASH_EXPORT extern const size_t kDesktopAcceleratorDataLength;
+#endif
+
// Debug accelerators enabled only when "Debugging keyboard shortcuts" flag
// (--ash-debug-shortcuts) is enabled.
ASH_EXPORT extern const AcceleratorData kDebugAcceleratorData[];