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

Side by Side Diff: chrome/browser/global_keyboard_shortcuts_mac.mm

Issue 5243003: Style fixes; commenting. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
Bons 2010/11/19 22:16:24 2010
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 #include <AppKit/NSEvent.h> 5 #include <AppKit/NSEvent.h>
6 #include <Carbon/Carbon.h> 6 #include <Carbon/Carbon.h>
7 7
8 #include "chrome/browser/global_keyboard_shortcuts_mac.h" 8 #include "chrome/browser/global_keyboard_shortcuts_mac.h"
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "chrome/app/chrome_command_ids.h" 12 #include "chrome/app/chrome_command_ids.h"
13 13
14 // Basically, there are two kinds of keyboard shortcuts: Ones that should work 14 // Basically, there are two kinds of keyboard shortcuts: Ones that should work
15 // only if the tab contents is focused (BrowserKeyboardShortcut), and ones that 15 // only if the tab contents is focused (BrowserKeyboardShortcut), and ones that
16 // should work in all other cases (WindowKeyboardShortcut). In the latter case, 16 // should work in all other cases (WindowKeyboardShortcut). In the latter case,
17 // we differentiate between shortcuts that are checked before any other view 17 // we differentiate between shortcuts that are checked before any other view
18 // gets the chance to handle them (WindowKeyboardShortcut) or after all views 18 // gets the chance to handle them (WindowKeyboardShortcut) or after all views
19 // had a chance but did not handle the keypress event 19 // had a chance but did not handle the keypress event
20 // (DelayedWindowKeyboardShortcut) 20 // (DelayedWindowKeyboardShortcut).
21 21
22 const KeyboardShortcutData* GetWindowKeyboardShortcutTable 22 const KeyboardShortcutData* GetWindowKeyboardShortcutTable(
23 (size_t* num_entries) { 23 size_t* num_entries) {
24 static const KeyboardShortcutData keyboard_shortcuts[] = { 24 static const KeyboardShortcutData keyboard_shortcuts[] = {
25 //cmd shift cntrl option
26 //--- ----- ----- ------
25 // '{' / '}' characters should be matched earlier than virtual key code 27 // '{' / '}' characters should be matched earlier than virtual key code
26 // (therefore we can match alt-8 as '{' on german keyboards). 28 // (therefore we can match alt-8 as '{' on german keyboards).
27 {true, false, false, false, 0, '}', IDC_SELECT_NEXT_TAB}, 29 {true, false, false, false, 0, '}', IDC_SELECT_NEXT_TAB},
28 {true, false, false, false, 0, '{', IDC_SELECT_PREVIOUS_TAB}, 30 {true, false, false, false, 0, '{', IDC_SELECT_PREVIOUS_TAB},
29 {false, false, true, false, kVK_PageDown, 0, IDC_SELECT_NEXT_TAB}, 31 {false, false, true, false, kVK_PageDown, 0, IDC_SELECT_NEXT_TAB},
30 {false, false, true, false, kVK_Tab, 0, IDC_SELECT_NEXT_TAB}, 32 {false, false, true, false, kVK_Tab, 0, IDC_SELECT_NEXT_TAB},
31 {false, false, true, false, kVK_PageUp, 0, IDC_SELECT_PREVIOUS_TAB}, 33 {false, false, true, false, kVK_PageUp, 0, IDC_SELECT_PREVIOUS_TAB},
32 {false, true, true, false, kVK_Tab, 0, IDC_SELECT_PREVIOUS_TAB}, 34 {false, true, true, false, kVK_Tab, 0, IDC_SELECT_PREVIOUS_TAB},
33 // Cmd-0..8 select the Nth tab, with cmd-9 being "last tab". 35 // Cmd-0..8 select the Nth tab, with cmd-9 being "last tab".
34 {true, false, false, false, kVK_ANSI_1, 0, IDC_SELECT_TAB_0}, 36 {true, false, false, false, kVK_ANSI_1, 0, IDC_SELECT_TAB_0},
(...skipping 14 matching lines...) Expand all
49 {true, false, false, false, kVK_ANSI_Keypad8, 0, IDC_SELECT_TAB_7}, 51 {true, false, false, false, kVK_ANSI_Keypad8, 0, IDC_SELECT_TAB_7},
50 {true, false, false, false, kVK_ANSI_9, 0, IDC_SELECT_LAST_TAB}, 52 {true, false, false, false, kVK_ANSI_9, 0, IDC_SELECT_LAST_TAB},
51 {true, false, false, false, kVK_ANSI_Keypad9, 0, IDC_SELECT_LAST_TAB}, 53 {true, false, false, false, kVK_ANSI_Keypad9, 0, IDC_SELECT_LAST_TAB},
52 }; 54 };
53 55
54 *num_entries = arraysize(keyboard_shortcuts); 56 *num_entries = arraysize(keyboard_shortcuts);
55 57
56 return keyboard_shortcuts; 58 return keyboard_shortcuts;
57 } 59 }
58 60
59 const KeyboardShortcutData* GetDelayedWindowKeyboardShortcutTable 61 const KeyboardShortcutData* GetDelayedWindowKeyboardShortcutTable(
60 (size_t* num_entries) { 62 size_t* num_entries) {
61 static const KeyboardShortcutData keyboard_shortcuts[] = { 63 static const KeyboardShortcutData keyboard_shortcuts[] = {
64 //cmd shift cntrl option
65 //--- ----- ----- ------
62 {false, false, false, false, kVK_Escape, 0, IDC_STOP}, 66 {false, false, false, false, kVK_Escape, 0, IDC_STOP},
63 }; 67 };
64 68
65 *num_entries = arraysize(keyboard_shortcuts); 69 *num_entries = arraysize(keyboard_shortcuts);
66 70
67 return keyboard_shortcuts; 71 return keyboard_shortcuts;
68 } 72 }
69 73
70 const KeyboardShortcutData* GetBrowserKeyboardShortcutTable 74 const KeyboardShortcutData* GetBrowserKeyboardShortcutTable(
71 (size_t* num_entries) { 75 size_t* num_entries) {
72 static const KeyboardShortcutData keyboard_shortcuts[] = { 76 static const KeyboardShortcutData keyboard_shortcuts[] = {
77 //cmd shift cntrl option
78 //--- ----- ----- ------
73 {true, false, false, false, kVK_LeftArrow, 0, IDC_BACK}, 79 {true, false, false, false, kVK_LeftArrow, 0, IDC_BACK},
74 {true, false, false, false, kVK_RightArrow, 0, IDC_FORWARD}, 80 {true, false, false, false, kVK_RightArrow, 0, IDC_FORWARD},
75 {false, false, false, false, kVK_Delete, 0, IDC_BACK}, 81 {false, false, false, false, kVK_Delete, 0, IDC_BACK},
76 {false, true, false, false, kVK_Delete, 0, IDC_FORWARD}, 82 {false, true, false, false, kVK_Delete, 0, IDC_FORWARD},
77 {true, true, false, false, 0, 'c', IDC_DEV_TOOLS_INSPECT}, 83 {true, true, false, false, 0, 'c', IDC_DEV_TOOLS_INSPECT},
78 }; 84 };
79 85
80 *num_entries = arraysize(keyboard_shortcuts); 86 *num_entries = arraysize(keyboard_shortcuts);
81 87
82 return keyboard_shortcuts; 88 return keyboard_shortcuts;
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 return rawChar; 212 return rawChar;
207 } 213 }
208 214
209 // opt/alt modifier is set (e.g. on german layout we want '{' for opt-8). 215 // opt/alt modifier is set (e.g. on german layout we want '{' for opt-8).
210 if ([event modifierFlags] & NSAlternateKeyMask) 216 if ([event modifierFlags] & NSAlternateKeyMask)
211 return [characters characterAtIndex:0]; 217 return [characters characterAtIndex:0];
212 } 218 }
213 219
214 return [eventString characterAtIndex:0]; 220 return [eventString characterAtIndex:0];
215 } 221 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698