Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(254)

Unified Diff: chrome/browser/ui/browser_command_controller.cc

Issue 2781633003: Allow keyboard shortcuts can be captured by webpage when toolbar is not visible (Closed)
Patch Set: Resolve review comments Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/browser_command_controller.cc
diff --git a/chrome/browser/ui/browser_command_controller.cc b/chrome/browser/ui/browser_command_controller.cc
index 125126de6c63eee0ace3dd5f09879de389270d92..279ae902865b5a58841eb64cd7fd67eff3768e21 100644
--- a/chrome/browser/ui/browser_command_controller.cc
+++ b/chrome/browser/ui/browser_command_controller.cc
@@ -187,8 +187,27 @@ bool BrowserCommandController::IsReservedCommandOrKey(
}
#endif
- if (window()->IsFullscreen() && command_id == IDC_FULLSCREEN)
- return true;
+ if (window()->IsFullscreen()) {
+ // In fullscreen, all commands except for IDC_FULLSCREEN and IDC_EXIT should
+ // be delivered to the web page. See, intent to implement,
+ // https://goo.gl/4tJ32G.
msw 2017/04/04 22:46:39 I still don't think that we should use URL shorten
Hzj_jie 2017/04/05 18:09:16 Done.
+ const bool is_exit_fullscreen =
+ (command_id == IDC_EXIT || command_id == IDC_FULLSCREEN);
+#if defined(OS_MACOSX)
+ // This behavior is different on Mac OS, which has a unique user-initiated
+ // full-screen mode. According to the discussion in http://crbug.com/702251,
+ // the shortcuts will be reserved once the tab strip / Chrome toolbar is
msw 2017/04/04 22:46:39 nit: "the commands should be reserved for browser-
Hzj_jie 2017/04/05 18:09:16 Done.
+ // visible.
+ if (window()->IsToolbarShowing()) {
+ if (command_id == IDC_FULLSCREEN)
+ return true;
+ } else {
+ return is_exit_fullscreen;
+ }
+#else
+ return is_exit_fullscreen;
+#endif
+ }
#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
// If this key was registered by the user as a content editing hotkey, then

Powered by Google App Engine
This is Rietveld 408576698