Revert 3c7af99, but keep only IsReservedCommandOrKey change
Change
https://chromium.googlesource.com/chromium/src/+/3c7af99a93f4b4837b2fbee5cb66697f66ccf241/
impacts both keyboard shortcut reservation and enable / disable of the commands,
while the later one is not expected. So this change partially reverts the
original change.
The intent to implement is https://goo.gl/4tJ32G, which expects to deliver
browser keyboard shortcuts to the web pages.
BUG=680809
Review-Url: https://codereview.chromium.org/2698013004
Cr-Commit-Position: refs/heads/master@{#450894}
diff --git a/chrome/browser/ui/browser_command_controller.cc b/chrome/browser/ui/browser_command_controller.cc
index b59372d..be7339df 100644
--- a/chrome/browser/ui/browser_command_controller.cc
+++ b/chrome/browser/ui/browser_command_controller.cc
@@ -187,22 +187,11 @@
}
#endif
- const bool is_tab_or_window_command =
- command_id == IDC_CLOSE_TAB ||
- command_id == IDC_CLOSE_WINDOW ||
- command_id == IDC_NEW_INCOGNITO_WINDOW ||
- command_id == IDC_NEW_TAB ||
- command_id == IDC_NEW_WINDOW ||
- command_id == IDC_RESTORE_TAB ||
- command_id == IDC_SELECT_NEXT_TAB ||
- command_id == IDC_SELECT_PREVIOUS_TAB;
if (window()->IsFullscreen()) {
// In fullscreen, all commands except for IDC_FULLSCREEN and IDC_EXIT should
- // be delivered to the web page. See https://goo.gl/4tJ32G.
- if (command_id == IDC_FULLSCREEN)
- return true;
- if (is_tab_or_window_command)
- return false;
+ // be delivered to the web page. See, intent to implement,
+ // https://goo.gl/4tJ32G.
+ return command_id == IDC_EXIT || command_id == IDC_FULLSCREEN;
}
#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
@@ -214,7 +203,15 @@
return false;
#endif
- return is_tab_or_window_command || command_id == IDC_EXIT;
+ return command_id == IDC_CLOSE_TAB ||
+ command_id == IDC_CLOSE_WINDOW ||
+ command_id == IDC_NEW_INCOGNITO_WINDOW ||
+ command_id == IDC_NEW_TAB ||
+ command_id == IDC_NEW_WINDOW ||
+ command_id == IDC_RESTORE_TAB ||
+ command_id == IDC_SELECT_NEXT_TAB ||
+ command_id == IDC_SELECT_PREVIOUS_TAB ||
+ command_id == IDC_EXIT;
}
void BrowserCommandController::SetBlockCommandExecution(bool block) {
@@ -1079,17 +1076,6 @@
command_updater_.UpdateCommandEnabled(IDC_TOGGLE_FULLSCREEN_TOOLBAR,
fullscreen_enabled);
- command_updater_.UpdateCommandEnabled(IDC_CLOSE_TAB, !is_fullscreen);
- command_updater_.UpdateCommandEnabled(IDC_CLOSE_WINDOW, !is_fullscreen);
- command_updater_.UpdateCommandEnabled(IDC_NEW_INCOGNITO_WINDOW,
- !is_fullscreen);
- command_updater_.UpdateCommandEnabled(IDC_NEW_TAB, !is_fullscreen);
- command_updater_.UpdateCommandEnabled(IDC_NEW_WINDOW, !is_fullscreen);
- command_updater_.UpdateCommandEnabled(IDC_RESTORE_TAB, !is_fullscreen);
- command_updater_.UpdateCommandEnabled(IDC_SELECT_NEXT_TAB, !is_fullscreen);
- command_updater_.UpdateCommandEnabled(IDC_SELECT_PREVIOUS_TAB,
- !is_fullscreen);
-
UpdateCommandsForBookmarkBar();
}