diff options
Diffstat (limited to 'ash/accelerators')
-rw-r--r-- | ash/accelerators/accelerator_controller.cc | 35 | ||||
-rw-r--r-- | ash/accelerators/accelerator_table.cc | 12 | ||||
-rw-r--r-- | ash/accelerators/accelerator_table.h | 2 |
3 files changed, 45 insertions, 4 deletions
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc index bc742c7..2ac4e7e 100644 --- a/ash/accelerators/accelerator_controller.cc +++ b/ash/accelerators/accelerator_controller.cc @@ -33,6 +33,7 @@ #include "ash/system/tray/system_tray_delegate.h" #include "ash/volume_control_delegate.h" #include "ash/wm/partial_screenshot_view.h" +#include "ash/wm/power_button_controller.h" #include "ash/wm/property_util.h" #include "ash/wm/window_cycle_controller.h" #include "ash/wm/window_util.h" @@ -57,6 +58,7 @@ #if defined(OS_CHROMEOS) #include "ash/display/output_configurator_animation.h" #include "base/chromeos/chromeos_version.h" +#include "base/time.h" #include "chromeos/display/output_configurator.h" #endif // defined(OS_CHROMEOS) @@ -763,10 +765,35 @@ bool AcceleratorController::PerformAction(int action, return HandleMediaPrevTrack(); case POWER_PRESSED: // fallthrough case POWER_RELEASED: - // We don't do anything with these at present, but we consume them to - // prevent them from getting passed to apps -- see - // http://crbug.com/146609. - return true; +#if defined(OS_CHROMEOS) + if (!base::chromeos::IsRunningOnChromeOS()) { + // There is no powerd in linux desktop, so call the + // PowerButtonController here. + Shell::GetInstance()->power_button_controller()-> + OnPowerButtonEvent(action == POWER_PRESSED, base::TimeTicks()); + } +#endif + // We don't do anything with these at present on the device, + // (power button evets are reported to us from powerm via + // D-BUS), but we consume them to prevent them from getting + // passed to apps -- see http://crbug.com/146609. + return true; + case LOCK_PRESSED: + case LOCK_RELEASED: +#if defined(OS_CHROMEOS) + if (!base::chromeos::IsRunningOnChromeOS()) { + // There is no powerd in linux desktop, so call the + // PowerButtonController here. + Shell::GetInstance()->power_button_controller()-> + OnLockButtonEvent(action == LOCK_PRESSED, base::TimeTicks()); + return true; + } +#endif + // LOCK_PRESSED/RELEASED in debug only action that is meant for + // testing lock behavior on linux desktop. If we ever reached + // here (when you run a debug build on the device), pass it onto + // apps. + return false; #if !defined(NDEBUG) case PRINT_LAYER_HIERARCHY: return HandlePrintLayerHierarchy(); diff --git a/ash/accelerators/accelerator_table.cc b/ash/accelerators/accelerator_table.cc index 8abc308..a061d77 100644 --- a/ash/accelerators/accelerator_table.cc +++ b/ash/accelerators/accelerator_table.cc @@ -66,6 +66,12 @@ const AcceleratorData kAcceleratorData[] = { // 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 exit on linux desktop. + { true, ui::VKEY_F11, ui::EF_NONE, POWER_PRESSED }, + { false, ui::VKEY_F11, ui::EF_NONE, POWER_RELEASED }, + // Extra shortcut to lock the screen on linux desktop. + { true, ui::VKEY_F11, ui::EF_SHIFT_DOWN, LOCK_PRESSED }, + { false, ui::VKEY_F11, ui::EF_SHIFT_DOWN, LOCK_RELEASED }, #endif { true, ui::VKEY_O, ui::EF_CONTROL_DOWN, OPEN_FILE_MANAGER_DIALOG }, { true, ui::VKEY_M, ui::EF_CONTROL_DOWN, OPEN_FILE_MANAGER_TAB }, @@ -195,6 +201,8 @@ const AcceleratorAction kReservedActions[] = { CYCLE_FORWARD_MRU_PRESSED, // Alt+Tab CYCLE_FORWARD_MRU_RELEASED, #if defined(OS_CHROMEOS) + LOCK_PRESSED, + LOCK_RELEASED, POWER_PRESSED, POWER_RELEASED, TOGGLE_MAXIMIZED_PRESSED, @@ -233,6 +241,10 @@ const AcceleratorAction kActionsAllowedAtLoginOrLockScreen[] = { PRINT_WINDOW_HIERARCHY, ROTATE_SCREEN, #endif +#if defined(OS_CHROMEOS) && !defined(NDEBUG) + POWER_PRESSED, + POWER_RELEASED, +#endif }; const size_t kActionsAllowedAtLoginOrLockScreenLength = diff --git a/ash/accelerators/accelerator_table.h b/ash/accelerators/accelerator_table.h index 91442a4..14b4327 100644 --- a/ash/accelerators/accelerator_table.h +++ b/ash/accelerators/accelerator_table.h @@ -32,6 +32,8 @@ enum AcceleratorAction { FOCUS_SYSTEM_TRAY, KEYBOARD_BRIGHTNESS_DOWN, KEYBOARD_BRIGHTNESS_UP, + LOCK_PRESSED, + LOCK_RELEASED, MAGNIFY_SCREEN_ZOOM_IN, MAGNIFY_SCREEN_ZOOM_OUT, MEDIA_NEXT_TRACK, |