From 97388a1838eb65cf984bf0a105f8719b475c1ffa Mon Sep 17 00:00:00 2001 From: "harrym@chromium.org" Date: Sat, 18 May 2013 09:20:07 +0000 Subject: Reserve Debug Shortcuts - Processes debug shortcuts earlier in input cycle to prevent some views from blocking them. BUG=157650 Review URL: https://chromiumcodereview.appspot.com/14845014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@200982 0039d316-1c4b-4281-b951-d872f2087c98 --- ash/accelerators/accelerator_controller.cc | 5 ++++- ash/accelerators/accelerator_table.cc | 12 ++++++++++++ ash/accelerators/accelerator_table.h | 8 ++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc index 175c79d..677e8a4 100644 --- a/ash/accelerators/accelerator_controller.cc +++ b/ash/accelerators/accelerator_controller.cc @@ -400,8 +400,11 @@ void AcceleratorController::Init() { RegisterAccelerators(kDesktopAcceleratorData, kDesktopAcceleratorDataLength); #endif - if (DebugShortcutsEnabled()) + if (DebugShortcutsEnabled()) { RegisterAccelerators(kDebugAcceleratorData, kDebugAcceleratorDataLength); + for (size_t i = 0; i < kReservedDebugActionsLength; ++i) + reserved_actions_.insert(kReservedDebugActions[i]); + } #if defined(OS_CHROMEOS) keyboard_brightness_control_delegate_.reset( diff --git a/ash/accelerators/accelerator_table.cc b/ash/accelerators/accelerator_table.cc index e60408e..835ac45 100644 --- a/ash/accelerators/accelerator_table.cc +++ b/ash/accelerators/accelerator_table.cc @@ -239,6 +239,18 @@ const AcceleratorAction kReservedActions[] = { const size_t kReservedActionsLength = arraysize(kReservedActions); +const AcceleratorAction kReservedDebugActions[] = { + PRINT_LAYER_HIERARCHY, + PRINT_VIEW_HIERARCHY, + PRINT_WINDOW_HIERARCHY, + DEBUG_TOGGLE_DEVICE_SCALE_FACTOR, + DEBUG_TOGGLE_SHOW_DEBUG_BORDERS, + DEBUG_TOGGLE_SHOW_FPS_COUNTER, + DEBUG_TOGGLE_SHOW_PAINT_RECTS, +}; + +const size_t kReservedDebugActionsLength = arraysize(kReservedDebugActions); + const AcceleratorAction kActionsAllowedAtLoginOrLockScreen[] = { BRIGHTNESS_DOWN, BRIGHTNESS_UP, diff --git a/ash/accelerators/accelerator_table.h b/ash/accelerators/accelerator_table.h index 7e5e456..563a7c5 100644 --- a/ash/accelerators/accelerator_table.h +++ b/ash/accelerators/accelerator_table.h @@ -142,6 +142,14 @@ ASH_EXPORT extern const AcceleratorAction kReservedActions[]; // The number of elements in kReservedActions. ASH_EXPORT extern const size_t kReservedActionsLength; +// Actions that should be handled very early in Ash unless the current target +// window is full-screen, these actions are only handled if +// DebugShortcutsEnabled is true (command line switch 'ash-debug-shortcuts'). +ASH_EXPORT extern const AcceleratorAction kReservedDebugActions[]; + +// The number of elements in kReservedDebugActions. +ASH_EXPORT extern const size_t kReservedDebugActionsLength; + // Actions allowed while user is not signed in or screen is locked. ASH_EXPORT extern const AcceleratorAction kActionsAllowedAtLoginOrLockScreen[]; -- cgit v1.1