Commit 14596236 authored by Jennifer Apacible's avatar Jennifer Apacible Committed by Commit Bot

[Picture in Picture] Only handle space key on Mac.

The buttons on other platforms handle the space key as well. This change
only adds the handling to toggle play/pause to Mac. The close button
is not handled since tabbing is not handled and there are no visual
affordances for which button is focused on Mac. These exist on other
platforms.

Bug: 879139
Change-Id: I40135a7c70fd8d737a2b3b368bfad968d0eeb225
Reviewed-on: https://chromium-review.googlesource.com/1196931Reviewed-by: default avatarCJ DiMeglio <lethalantidote@chromium.org>
Commit-Queue: apacible <apacible@chromium.org>
Cr-Commit-Position: refs/heads/master@{#587788}
parent 4664c32a
...@@ -608,11 +608,16 @@ void OverlayWindowViews::OnKeyEvent(ui::KeyEvent* event) { ...@@ -608,11 +608,16 @@ void OverlayWindowViews::OnKeyEvent(ui::KeyEvent* event) {
UpdateControlsVisibility(true); UpdateControlsVisibility(true);
} }
// On Mac, the space key event isn't automatically handled. Only handle space
// for TogglePlayPause() since tabbing between the buttons is not supported and
// there is no focus affordance on the buttons.
#if defined(OS_MACOSX)
if (event->type() == ui::ET_KEY_PRESSED && if (event->type() == ui::ET_KEY_PRESSED &&
event->key_code() == ui::VKEY_SPACE) { event->key_code() == ui::VKEY_SPACE) {
TogglePlayPause(); TogglePlayPause();
event->SetHandled(); event->SetHandled();
} }
#endif // OS_MACOSX
// On Windows, the Alt+F4 keyboard combination closes the window. Only handle // On Windows, the Alt+F4 keyboard combination closes the window. Only handle
// closure on key press so Close() is not called a second time when the key // closure on key press so Close() is not called a second time when the key
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment