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

Unified Diff: chrome/browser/global_keyboard_shortcuts_mac.mm

Issue 491023: Add a keyboard shortcut on Escape that emits the IDC_STOP command.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years 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.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) {
« no previous file with comments | « chrome/browser/global_keyboard_shortcuts_mac.h ('k') | chrome/browser/global_keyboard_shortcuts_mac_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698