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

Side by Side Diff: chrome/browser/ui/views/accelerator_table.cc

Issue 2128243003: Make most browser accelerators not repeat. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/views/accelerator_table.h" 5 #include "chrome/browser/ui/views/accelerator_table.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 { ui::VKEY_ESCAPE, ui::EF_SHIFT_DOWN, IDC_TASK_MANAGER }, 172 { ui::VKEY_ESCAPE, ui::EF_SHIFT_DOWN, IDC_TASK_MANAGER },
173 { ui::VKEY_DELETE, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN, 173 { ui::VKEY_DELETE, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN,
174 IDC_CLEAR_BROWSING_DATA }, 174 IDC_CLEAR_BROWSING_DATA },
175 { ui::VKEY_LMENU, ui::EF_NONE, IDC_FOCUS_MENU_BAR }, 175 { ui::VKEY_LMENU, ui::EF_NONE, IDC_FOCUS_MENU_BAR },
176 { ui::VKEY_MENU, ui::EF_NONE, IDC_FOCUS_MENU_BAR }, 176 { ui::VKEY_MENU, ui::EF_NONE, IDC_FOCUS_MENU_BAR },
177 { ui::VKEY_RMENU, ui::EF_NONE, IDC_FOCUS_MENU_BAR }, 177 { ui::VKEY_RMENU, ui::EF_NONE, IDC_FOCUS_MENU_BAR },
178 // On Windows, all VKEY_BROWSER_* keys except VKEY_BROWSER_SEARCH are handled 178 // On Windows, all VKEY_BROWSER_* keys except VKEY_BROWSER_SEARCH are handled
179 // via WM_APPCOMMAND. 179 // via WM_APPCOMMAND.
180 { ui::VKEY_BROWSER_SEARCH, ui::EF_NONE, IDC_FOCUS_SEARCH }, 180 { ui::VKEY_BROWSER_SEARCH, ui::EF_NONE, IDC_FOCUS_SEARCH },
181 { ui::VKEY_M, ui::EF_SHIFT_DOWN | kPlatformModifier, IDC_SHOW_AVATAR_MENU}, 181 { ui::VKEY_M, ui::EF_SHIFT_DOWN | kPlatformModifier, IDC_SHOW_AVATAR_MENU},
182 // On ChromeOS, these keys are assigned to change UI scale. 182 // On Chrome OS, these keys are assigned to change UI scale.
183 { ui::VKEY_OEM_PLUS, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN, IDC_ZOOM_PLUS }, 183 { ui::VKEY_OEM_PLUS, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN, IDC_ZOOM_PLUS },
184 { ui::VKEY_OEM_MINUS, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN, 184 { ui::VKEY_OEM_MINUS, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN,
185 IDC_ZOOM_MINUS }, 185 IDC_ZOOM_MINUS },
186 // For each entry here add an entry into kChromeCmdId2AshActionId below 186 // For each entry here add an entry into kChromeCmdId2AshActionId below
187 // if Ash has a corresponding accelerator. 187 // if Ash has a corresponding accelerator.
188 #if defined(GOOGLE_CHROME_BUILD) 188 #if defined(GOOGLE_CHROME_BUILD)
189 { ui::VKEY_I, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN, IDC_FEEDBACK }, 189 { ui::VKEY_I, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN, IDC_FEEDBACK },
190 #endif 190 #endif
191 { ui::VKEY_Q, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN, IDC_EXIT }, 191 { ui::VKEY_Q, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN, IDC_EXIT },
192 { ui::VKEY_N, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN, 192 { ui::VKEY_N, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN,
193 IDC_NEW_INCOGNITO_WINDOW }, 193 IDC_NEW_INCOGNITO_WINDOW },
194 { ui::VKEY_T, ui::EF_CONTROL_DOWN, IDC_NEW_TAB }, 194 { ui::VKEY_T, ui::EF_CONTROL_DOWN, IDC_NEW_TAB },
195 { ui::VKEY_N, ui::EF_CONTROL_DOWN, IDC_NEW_WINDOW }, 195 { ui::VKEY_N, ui::EF_CONTROL_DOWN, IDC_NEW_WINDOW },
196 { ui::VKEY_T, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN, IDC_RESTORE_TAB }, 196 { ui::VKEY_T, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN, IDC_RESTORE_TAB },
197 #endif 197 #endif
198 }; 198 };
199 const size_t kAcceleratorMapLength = arraysize(kAcceleratorMap); 199 const size_t kAcceleratorMapLength = arraysize(kAcceleratorMap);
200 200
201 const int kRepeatableCommandIds[] = {
202 IDC_FIND_NEXT,
203 IDC_FIND_PREVIOUS,
204 IDC_FOCUS_NEXT_PANE,
205 IDC_FOCUS_PREVIOUS_PANE,
206 IDC_MOVE_TAB_NEXT,
207 IDC_MOVE_TAB_PREVIOUS,
208 IDC_SELECT_NEXT_TAB,
209 IDC_SELECT_PREVIOUS_TAB,
210 };
211 const size_t kRepeatableCommandIdsLength = arraysize(kRepeatableCommandIds);
212
201 #if defined(USE_ASH) 213 #if defined(USE_ASH)
202 // Below we map Chrome command ids to Ash action ids for commands that have 214 // Below we map Chrome command ids to Ash action ids for commands that have
203 // an shortcut that is handled by Ash (instead of Chrome). Adding entries 215 // an shortcut that is handled by Ash (instead of Chrome). Adding entries
204 // here will show shortcut text on menus. See comment above. 216 // here will show shortcut text on menus. See comment above.
205 struct ChromeCmdId2AshActionId { 217 struct ChromeCmdId2AshActionId {
206 const int chrome_cmd_id; 218 const int chrome_cmd_id;
207 const ash::AcceleratorAction ash_action_id; 219 const ash::AcceleratorAction ash_action_id;
208 }; 220 };
209 const ChromeCmdId2AshActionId kChromeCmdId2AshActionId[] = { 221 const ChromeCmdId2AshActionId kChromeCmdId2AshActionId[] = {
210 #if defined(GOOGLE_CHROME_BUILD) 222 #if defined(GOOGLE_CHROME_BUILD)
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 case IDC_COPY: 273 case IDC_COPY:
262 *accelerator = ui::Accelerator(ui::VKEY_C, ui::EF_CONTROL_DOWN); 274 *accelerator = ui::Accelerator(ui::VKEY_C, ui::EF_CONTROL_DOWN);
263 return true; 275 return true;
264 case IDC_PASTE: 276 case IDC_PASTE:
265 *accelerator = ui::Accelerator(ui::VKEY_V, ui::EF_CONTROL_DOWN); 277 *accelerator = ui::Accelerator(ui::VKEY_V, ui::EF_CONTROL_DOWN);
266 return true; 278 return true;
267 } 279 }
268 return false; 280 return false;
269 } 281 }
270 282
283 std::vector<int> GetRepeatableCommandIds() {
284 return std::vector<int>(kRepeatableCommandIds,
sky 2016/08/31 23:46:24 Can this be a set?
Daniel Erat 2016/09/01 16:48:29 yep, looks like it can!
285 kRepeatableCommandIds + kRepeatableCommandIdsLength);
286 }
287
271 } // namespace chrome 288 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698