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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_GLOBAL_KEYBOARD_SHORTCUTS_MAC_H_ 5 #ifndef CHROME_BROWSER_GLOBAL_KEYBOARD_SHORTCUTS_MAC_H_
6 #define CHROME_BROWSER_GLOBAL_KEYBOARD_SHORTCUTS_MAC_H_ 6 #define CHROME_BROWSER_GLOBAL_KEYBOARD_SHORTCUTS_MAC_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 9
10 struct KeyboardShortcutData { 10 struct KeyboardShortcutData {
11 bool command_key; 11 bool command_key;
12 bool shift_key; 12 bool shift_key;
13 bool cntrl_key; 13 bool cntrl_key;
14 int vkey_code; // Virtual Key code for the command. 14 int vkey_code; // Virtual Key code for the command.
15 int chrome_command; // The chrome command # to execute for this shortcut. 15 int chrome_command; // The chrome command # to execute for this shortcut.
16 }; 16 };
17 17
18 // Check if a given keycode + modifiers correspond to a given Chrome command. 18 // Check if a given keycode + modifiers correspond to a given Chrome command.
19 // returns: Command number (as passed to Browser::ExecuteCommand) or -1 if there 19 // returns: Command number (as passed to Browser::ExecuteCommand) or -1 if there
20 // was no match. 20 // was no match.
21 int CommandForKeyboardShortcut(bool command_key, bool shift_key, bool cntrl_key, 21 //
22 int vkey_code); 22 // |performKeyEquivalent:| bubbles events up from the window to the views.
23 // If we let it bubble up to the Omnibox, then the Omnibox handles
24 // cmd-left/right just fine, but it swallows cmd-1 and doesn't give us a chance
25 // 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.
26 //
27 // This means cmd-left doesn't work if you hit cmd-l tab, which focusses
28 // something that's neither omnibox nor tab contents. This behavior is
29 // consistent with safari and camino, and I think it's the best we can do
30 // without rewriting event dispatching ( http://crbug.com/251069 ).
31
32 // This returns shortcuts that should work no matter what component of the
33 // browser is focused. They are executed by the window, before any view has the
34 // opportunity to override the shortcut (with the exception of the tab contents,
35 // which first checks if the current web page wants to handle the shortcut).
36 int CommandForWindowKeyboardShortcut(
37 bool command_key, bool shift_key, bool cntrl_key, int vkey_code);
38
39 // This returns shortcuts that should work only if the tab contents have focus
40 // (e.g. cmd-left, which shouldn't do history navigation if e.g. the omnibox has
41 // focus).
42 int CommandForBrowserKeyboardShortcut(
43 bool command_key, bool shift_key, bool cntrl_key, int vkey_code);
23 44
24 // For testing purposes. 45 // For testing purposes.
25 const KeyboardShortcutData* GetKeyboardShortCutTable(size_t* num_entries); 46 const KeyboardShortcutData* GetWindowKeyboardShortcutTable(size_t* num_entries);
47 const KeyboardShortcutData*
48 GetBrowserKeyboardShortcutTable(size_t* num_entries);
26 49
27 #endif // #ifndef CHROME_BROWSER_GLOBAL_KEYBOARD_SHORTCUTS_MAC_H_ 50 #endif // #ifndef CHROME_BROWSER_GLOBAL_KEYBOARD_SHORTCUTS_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698