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

Unified Diff: chrome/browser/browser.cc

Issue 224023: Don't send tab switching/killing/creating keyboard accelerators to pages. Th... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: call Browser:IsReservedAccelerator from tab_contents_view.cc instead of each platform file Created 11 years, 3 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/browser.cc
===================================================================
--- chrome/browser/browser.cc (revision 27783)
+++ chrome/browser/browser.cc (working copy)
@@ -2108,6 +2108,28 @@
window()->ShowPageInfo(profile, url, ssl, show_history);
}
+bool Browser::IsReservedAccelerator(const NativeWebKeyboardEvent& event) {
+ // Other platforms don't send close-app keyboard shortcuts to apps first.
+#if defined(OS_WIN)
+ if ((event.modifiers & NativeWebKeyboardEvent::AltKey) &&
+ event.windowsKeyCode == VK_F4) {
+ return true;
+ }
+#endif
+
+ int command_id = window()->GetCommandId(event);
+ return command_id == IDC_CLOSE_TAB ||
+ command_id == IDC_CLOSE_POPUPS ||
+ 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_TASK_MANAGER;
+}
+
void Browser::ShowRepostFormWarningDialog(TabContents *tab_contents) {
window()->ShowRepostFormWarningDialog(tab_contents);
}

Powered by Google App Engine
This is Rietveld 408576698