0

ash: Prevent power button events from reaching apps.

This adds no-op POWER_PRESSED and POWER_RELEASED
accelerators that are used to prevent power button presses
and releases from being seen by apps.

BUG=146609
TEST=none


Review URL: https://chromiumcodereview.appspot.com/10907084

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155304 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
derat@chromium.org
2012-09-07 04:01:30 +00:00
parent 94a673c217
commit e870566da4
3 changed files with 13 additions and 1 deletions

@ -686,6 +686,12 @@ bool AcceleratorController::PerformAction(int action,
return HandleMediaPlayPause();
case MEDIA_PREV_TRACK:
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(NDEBUG)
case PRINT_LAYER_HIERARCHY:
return HandlePrintLayerHierarchy();

@ -46,6 +46,8 @@ const AcceleratorData kAcceleratorData[] = {
{ true, ui::VKEY_KBD_BRIGHTNESS_UP, ui::EF_NONE, KEYBOARD_BRIGHTNESS_UP },
{ true, ui::VKEY_F4, ui::EF_CONTROL_DOWN, CYCLE_DISPLAY_MODE },
{ true, ui::VKEY_L, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN, LOCK_SCREEN },
{ 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 activate lock screen on linux desktop.
{ true, ui::VKEY_L, ui::EF_ALT_DOWN, LOCK_SCREEN },
@ -185,7 +187,9 @@ const AcceleratorAction kReservedActions[] = {
MAGNIFY_SCREEN_ZOOM_IN, // Control+F7
VOLUME_MUTE, // F8
VOLUME_DOWN, // F9
VOLUME_UP // F10
VOLUME_UP, // F10
POWER_PRESSED,
POWER_RELEASED,
// TODO(yusukes): Handle F1, F2, F3, and F4 without modifiers in BrowserView.
#endif
};

@ -41,6 +41,8 @@ enum AcceleratorAction {
NEXT_IME,
OPEN_FEEDBACK_PAGE,
PREVIOUS_IME,
POWER_PRESSED,
POWER_RELEASED,
RESTORE_TAB,
ROTATE_SCREEN,
ROTATE_WINDOWS,