Commit 37570b61 authored by Dana Fried's avatar Dana Fried Committed by Commit Bot

New exit fullscreen message for CrOS

See attached bug for the problem statement and some of the rationale for
this change.

Handles a case where we are not going into immersive mode, but also
going fullscreen in a way that the default key to restore the browser is
not ESC (as it is for media, etc.) but F11/Fullscreen.

In this edge case, on ChromeOS, the message - "Press [F11] to exit full
screen" - is displayed and announced to the screen reader. The message
uses the default accelerator (which is still F11 on ChromeOS). This
could be confusing to users on Chromebooks where there are no physical
function keys but there are media keys, one of which is the fullscreen
key.

We cannot just change the default accelerator to Fullscreen however
since the media key is translated to a function key at a lower level;
there is no "fullscreen" key as far as Chrome is concerned. To handle
this, on ChromeOS only, we substitute the name of the key -
"Fullscreen" - for the name of the accelerator.

Bug: 1110468
Change-Id: Id0764f3eb68c8dc49baf5cbe156cbd22e66362d3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2347962Reviewed-by: default avatarDavid Tseng <dtseng@chromium.org>
Commit-Queue: Dana Fried <dfried@chromium.org>
Cr-Commit-Position: refs/heads/master@{#797457}
parent 5764fdd6
...@@ -51,13 +51,30 @@ ExclusiveAccessBubbleViews::ExclusiveAccessBubbleViews( ...@@ -51,13 +51,30 @@ ExclusiveAccessBubbleViews::ExclusiveAccessBubbleViews(
bubble_first_hide_callback_(std::move(bubble_first_hide_callback)), bubble_first_hide_callback_(std::move(bubble_first_hide_callback)),
animation_(new gfx::SlideAnimation(this)) { animation_(new gfx::SlideAnimation(this)) {
// Create the contents view. // Create the contents view.
view_ = new SubtleNotificationView();
#if defined(OS_CHROMEOS)
// Technically the exit fullscreen key on ChromeOS is F11 and the
// "Fullscreen" key on the keyboard is just translated to F11 or F4 (which
// is also a toggle-fullscreen command on ChromeOS). However most Chromebooks
// have media keys - including "fullscreen" - but not function keys, so
// instructing the user to "Press [F11] to exit fullscreen" isn't useful.
//
// An obvious solution might be to change the primary accelerator to the
// fullscreen key, but since translation to a function key is done at system
// level we can't actually do that. Instead we provide specific messaging for
// the platform here. (See crbug.com/1110468 for details.)
browser_fullscreen_exit_accelerator_ =
l10n_util::GetStringUTF16(IDS_APP_FULLSCREEN_KEY);
#else
ui::Accelerator accelerator(ui::VKEY_UNKNOWN, ui::EF_NONE); ui::Accelerator accelerator(ui::VKEY_UNKNOWN, ui::EF_NONE);
bool got_accelerator = bool got_accelerator =
bubble_view_context_->GetAcceleratorProvider() bubble_view_context_->GetAcceleratorProvider()
->GetAcceleratorForCommandId(IDC_FULLSCREEN, &accelerator); ->GetAcceleratorForCommandId(IDC_FULLSCREEN, &accelerator);
DCHECK(got_accelerator); DCHECK(got_accelerator);
view_ = new SubtleNotificationView();
browser_fullscreen_exit_accelerator_ = accelerator.GetShortcutText(); browser_fullscreen_exit_accelerator_ = accelerator.GetShortcutText();
#endif
UpdateViewContent(bubble_type_); UpdateViewContent(bubble_type_);
// Initialize the popup. // Initialize the popup.
......
...@@ -712,6 +712,11 @@ need to be translated for each locale.--> ...@@ -712,6 +712,11 @@ need to be translated for each locale.-->
Win Win
</message> </message>
</if> </if>
<if expr="chromeos">
<message name="IDS_APP_FULLSCREEN_KEY" desc="This refers to the 'Fullscreen' media key on certain keyboards.">
Fullscreen
</message>
</if>
<!-- Accelerator format --> <!-- Accelerator format -->
<message name="IDS_APP_ACCELERATOR_WITH_MODIFIER" desc="Accelerator with a modifier key"> <message name="IDS_APP_ACCELERATOR_WITH_MODIFIER" desc="Accelerator with a modifier key">
......
36a5013c7a18ff69d3b4e8c759bdf83414358fe5
\ No newline at end of file
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