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

Unified Diff: chrome/browser/global_keyboard_shortcuts_mac.h

Issue 251069: Support cmd-left/right for history. (Closed)
Patch Set: comments Created 11 years, 2 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/global_keyboard_shortcuts_mac.h
diff --git a/chrome/browser/global_keyboard_shortcuts_mac.h b/chrome/browser/global_keyboard_shortcuts_mac.h
index f9a287cccd657e5848cb0d56d9647dd085dd141a..41d26e49b2a8400320b66bc451b5100bdc11a567 100644
--- a/chrome/browser/global_keyboard_shortcuts_mac.h
+++ b/chrome/browser/global_keyboard_shortcuts_mac.h
@@ -18,10 +18,33 @@ struct KeyboardShortcutData {
// Check if a given keycode + modifiers correspond to a given Chrome command.
// returns: Command number (as passed to Browser::ExecuteCommand) or -1 if there
// was no match.
-int CommandForKeyboardShortcut(bool command_key, bool shift_key, bool cntrl_key,
- int vkey_code);
+//
+// |performKeyEquivalent:| bubbles events up from the window to the views.
+// If we let it bubble up to the Omnibox, then the Omnibox handles
+// cmd-left/right just fine, but it swallows cmd-1 and doesn't give us a chance
+// to intercept this. Hence, we need to types of keyboard shortcuts.
pink (ping after 24hrs) 2009/10/09 14:36:51 s/to/two
Nico 2009/10/09 16:50:06 D'oh. ne.
+//
+// This means cmd-left doesn't work if you hit cmd-l tab, which focusses
+// something that's neither omnibox nor tab contents. This behavior is
+// consistent with safari and camino, and I think it's the best we can do
+// without rewriting event dispatching ( http://crbug.com/251069 ).
+
+// This returns shortcuts that should work no matter what component of the
+// browser is focused. They are executed by the window, before any view has the
+// opportunity to override the shortcut (with the exception of the tab contents,
+// which first checks if the current web page wants to handle the shortcut).
+int CommandForWindowKeyboardShortcut(
+ bool command_key, bool shift_key, bool cntrl_key, int vkey_code);
+
+// This returns shortcuts that should work only if the tab contents have focus
+// (e.g. cmd-left, which shouldn't do history navigation if e.g. the omnibox has
+// focus).
+int CommandForBrowserKeyboardShortcut(
+ bool command_key, bool shift_key, bool cntrl_key, int vkey_code);
// For testing purposes.
-const KeyboardShortcutData* GetKeyboardShortCutTable(size_t* num_entries);
+const KeyboardShortcutData* GetWindowKeyboardShortcutTable(size_t* num_entries);
+const KeyboardShortcutData*
+ GetBrowserKeyboardShortcutTable(size_t* num_entries);
#endif // #ifndef CHROME_BROWSER_GLOBAL_KEYBOARD_SHORTCUTS_MAC_H_

Powered by Google App Engine
This is Rietveld 408576698