Index: chrome/browser/global_keyboard_shortcuts_mac.mm |
=================================================================== |
--- chrome/browser/global_keyboard_shortcuts_mac.mm (revision 34671) |
+++ chrome/browser/global_keyboard_shortcuts_mac.mm (working copy) |
@@ -9,6 +9,14 @@ |
#include "base/basictypes.h" |
#include "chrome/app/chrome_dll_resource.h" |
+// Basically, there are two kinds of keyboard shortcuts: Ones that should work |
+// only if the tab contents is focused (BrowserKeyboardShortcut), and ones that |
+// should work in all other cases (WindowKeyboardShortcut). In the latter case, |
+// we differentiate between shortcuts that are checked before any other view |
+// gets the chance to handle them (WindowKeyboardShortcut) or after all views |
+// had a chance but did not handle the keypress event |
+// (DelayedWindowKeyboardShortcut) |
+ |
const KeyboardShortcutData* GetWindowKeyboardShortcutTable |
(size_t* num_entries) { |
static const KeyboardShortcutData keyboard_shortcuts[] = { |
@@ -35,6 +43,17 @@ |
return keyboard_shortcuts; |
} |
+const KeyboardShortcutData* GetDelayedWindowKeyboardShortcutTable |
+ (size_t* num_entries) { |
+ static const KeyboardShortcutData keyboard_shortcuts[] = { |
+ {false, false, false, false, kVK_Escape, IDC_STOP}, |
+ }; |
+ |
+ *num_entries = arraysize(keyboard_shortcuts); |
+ |
+ return keyboard_shortcuts; |
+} |
+ |
const KeyboardShortcutData* GetBrowserKeyboardShortcutTable |
(size_t* num_entries) { |
static const KeyboardShortcutData keyboard_shortcuts[] = { |
@@ -82,6 +101,14 @@ |
cntrl_key, opt_key, vkey_code); |
} |
+int CommandForDelayedWindowKeyboardShortcut( |
+ bool command_key, bool shift_key, bool cntrl_key, bool opt_key, |
+ int vkey_code) { |
+ return CommandForKeyboardShortcut(GetDelayedWindowKeyboardShortcutTable, |
+ command_key, shift_key, |
+ cntrl_key, opt_key, vkey_code); |
+} |
+ |
int CommandForBrowserKeyboardShortcut( |
bool command_key, bool shift_key, bool cntrl_key, bool opt_key, |
int vkey_code) { |