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

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

Issue 164133: Support cntrl-tab to switch tabs on OS X. (Closed)
Patch Set: Created 11 years, 4 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
« 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.
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 "chrome/browser/global_keyboard_shortcuts_mac.h" 5 #include "chrome/browser/global_keyboard_shortcuts_mac.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "chrome/app/chrome_dll_resource.h" 8 #include "chrome/app/chrome_dll_resource.h"
9 9
10 const KeyboardShortcutData* GetKeyboardShortCutTable(size_t* num_entries) { 10 const KeyboardShortcutData* GetKeyboardShortCutTable(size_t* num_entries) {
11 static const KeyboardShortcutData keyboard_shortcuts[] = { 11 static const KeyboardShortcutData keyboard_shortcuts[] = {
12 {true, true, false, 30 /* ] */, IDC_SELECT_NEXT_TAB}, 12 {true, true, false, 30 /* ] */, IDC_SELECT_NEXT_TAB},
13 {false, false, true, 121 /* pg down */, IDC_SELECT_NEXT_TAB}, 13 {false, false, true, 121 /* pg down */, IDC_SELECT_NEXT_TAB},
14 {false, false, true, 48 /* tab */, IDC_SELECT_NEXT_TAB},
14 {true, true, false, 33 /* [ */, IDC_SELECT_PREVIOUS_TAB}, 15 {true, true, false, 33 /* [ */, IDC_SELECT_PREVIOUS_TAB},
15 {false, false, true, 116 /* pg_up */, IDC_SELECT_PREVIOUS_TAB}, 16 {false, false, true, 116 /* pg_up */, IDC_SELECT_PREVIOUS_TAB},
17 {false, true, true, 48 /* tab */, IDC_SELECT_PREVIOUS_TAB},
16 }; 18 };
17 19
18 *num_entries = arraysize(keyboard_shortcuts); 20 *num_entries = arraysize(keyboard_shortcuts);
19 21
20 return keyboard_shortcuts; 22 return keyboard_shortcuts;
21 } 23 }
22 24
23 int CommandForKeyboardShortcut(bool command_key, bool shift_key, bool cntrl_key, 25 int CommandForKeyboardShortcut(bool command_key, bool shift_key, bool cntrl_key,
24 int vkey_code) { 26 int vkey_code) {
25 27
26 // Scan through keycodes and see if it corresponds to one of the global 28 // Scan through keycodes and see if it corresponds to one of the global
27 // shortcuts on file. 29 // shortcuts on file.
28 // 30 //
29 // TODO(jeremy): Change this into a hash table once we get enough 31 // TODO(jeremy): Change this into a hash table once we get enough
30 // entries in the array to make a difference. 32 // entries in the array to make a difference.
31 size_t num_shortcuts = 0; 33 size_t num_shortcuts = 0;
32 const KeyboardShortcutData *it = GetKeyboardShortCutTable(&num_shortcuts); 34 const KeyboardShortcutData *it = GetKeyboardShortCutTable(&num_shortcuts);
33 for (size_t i = 0; i < num_shortcuts; ++i, ++it) { 35 for (size_t i = 0; i < num_shortcuts; ++i, ++it) {
34 if (it->command_key == command_key && 36 if (it->command_key == command_key &&
35 it->shift_key == shift_key && 37 it->shift_key == shift_key &&
36 it->cntrl_key == cntrl_key && 38 it->cntrl_key == cntrl_key &&
37 it->vkey_code == vkey_code) { 39 it->vkey_code == vkey_code) {
38 return it->chrome_command; 40 return it->chrome_command;
39 } 41 }
40 } 42 }
41 43
42 return -1; 44 return -1;
43 } 45 }
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