OLD | NEW |
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 "ash/accelerators/accelerator_table.h" | 5 #include "ash/accelerators/accelerator_table.h" |
6 | 6 |
7 #include "ash/strings/grit/ash_strings.h" | 7 #include "ash/strings/grit/ash_strings.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 | 9 |
10 namespace ash { | 10 namespace ash { |
11 | 11 |
12 const AcceleratorData kAcceleratorData[] = { | 12 const AcceleratorData kAcceleratorData[] = { |
13 // We have to define 3 entries for Shift+Alt. VKEY_[LR]MENU might be sent to | |
14 // the accelerator controller when RenderWidgetHostViewAura is focused, and | |
15 // VKEY_MENU might be when it's not (e.g. when NativeWidgetAura is focused). | |
16 { false, ui::VKEY_LMENU, ui::EF_SHIFT_DOWN, NEXT_IME }, | |
17 { false, ui::VKEY_MENU, ui::EF_SHIFT_DOWN, NEXT_IME }, | |
18 { false, ui::VKEY_RMENU, ui::EF_SHIFT_DOWN, NEXT_IME }, | |
19 // The same is true for Alt+Shift. | |
20 { false, ui::VKEY_LSHIFT, ui::EF_ALT_DOWN, NEXT_IME }, | |
21 { false, ui::VKEY_SHIFT, ui::EF_ALT_DOWN, NEXT_IME }, | |
22 { false, ui::VKEY_RSHIFT, ui::EF_ALT_DOWN, NEXT_IME }, | |
23 { true, ui::VKEY_SPACE, ui::EF_CONTROL_DOWN, PREVIOUS_IME }, | 13 { true, ui::VKEY_SPACE, ui::EF_CONTROL_DOWN, PREVIOUS_IME }, |
24 { false, ui::VKEY_SPACE, ui::EF_CONTROL_DOWN, PREVIOUS_IME }, | 14 { false, ui::VKEY_SPACE, ui::EF_CONTROL_DOWN, PREVIOUS_IME }, |
25 // Shortcuts for Japanese IME. | 15 // Shortcuts for Japanese IME. |
26 { true, ui::VKEY_CONVERT, ui::EF_NONE, SWITCH_IME }, | 16 { true, ui::VKEY_CONVERT, ui::EF_NONE, SWITCH_IME }, |
27 { true, ui::VKEY_NONCONVERT, ui::EF_NONE, SWITCH_IME }, | 17 { true, ui::VKEY_NONCONVERT, ui::EF_NONE, SWITCH_IME }, |
28 { true, ui::VKEY_DBE_SBCSCHAR, ui::EF_NONE, SWITCH_IME }, | 18 { true, ui::VKEY_DBE_SBCSCHAR, ui::EF_NONE, SWITCH_IME }, |
29 { true, ui::VKEY_DBE_DBCSCHAR, ui::EF_NONE, SWITCH_IME }, | 19 { true, ui::VKEY_DBE_DBCSCHAR, ui::EF_NONE, SWITCH_IME }, |
30 // Shortcut for Koren IME. | 20 // Shortcut for Koren IME. |
31 { true, ui::VKEY_HANGUL, ui::EF_NONE, SWITCH_IME }, | 21 { true, ui::VKEY_HANGUL, ui::EF_NONE, SWITCH_IME }, |
32 | 22 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 TOGGLE_TOUCH_VIEW_TESTING }, | 85 TOGGLE_TOUCH_VIEW_TESTING }, |
96 // Single shift release turns off caps lock. | 86 // Single shift release turns off caps lock. |
97 { false, ui::VKEY_LSHIFT, ui::EF_NONE, DISABLE_CAPS_LOCK }, | 87 { false, ui::VKEY_LSHIFT, ui::EF_NONE, DISABLE_CAPS_LOCK }, |
98 { false, ui::VKEY_SHIFT, ui::EF_NONE, DISABLE_CAPS_LOCK }, | 88 { false, ui::VKEY_SHIFT, ui::EF_NONE, DISABLE_CAPS_LOCK }, |
99 { false, ui::VKEY_RSHIFT, ui::EF_NONE, DISABLE_CAPS_LOCK }, | 89 { false, ui::VKEY_RSHIFT, ui::EF_NONE, DISABLE_CAPS_LOCK }, |
100 { false, ui::VKEY_LWIN, ui::EF_ALT_DOWN, TOGGLE_CAPS_LOCK }, | 90 { false, ui::VKEY_LWIN, ui::EF_ALT_DOWN, TOGGLE_CAPS_LOCK }, |
101 { true, ui::VKEY_VOLUME_MUTE, ui::EF_NONE, VOLUME_MUTE }, | 91 { true, ui::VKEY_VOLUME_MUTE, ui::EF_NONE, VOLUME_MUTE }, |
102 { true, ui::VKEY_VOLUME_DOWN, ui::EF_NONE, VOLUME_DOWN }, | 92 { true, ui::VKEY_VOLUME_DOWN, ui::EF_NONE, VOLUME_DOWN }, |
103 { true, ui::VKEY_VOLUME_UP, ui::EF_NONE, VOLUME_UP }, | 93 { true, ui::VKEY_VOLUME_UP, ui::EF_NONE, VOLUME_UP }, |
104 { true, ui::VKEY_ESCAPE, ui::EF_COMMAND_DOWN, SHOW_TASK_MANAGER }, | 94 { true, ui::VKEY_ESCAPE, ui::EF_COMMAND_DOWN, SHOW_TASK_MANAGER }, |
| 95 { true, ui::VKEY_SPACE, ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN, NEXT_IME }, |
105 #else | 96 #else |
106 // This key has been deprecated on CrOS. It is instead included below in the | 97 // This key has been deprecated on CrOS. It is instead included below in the |
107 // |kDeprecatedAccelerators|, and above in the CrOS accelerators as | 98 // |kDeprecatedAccelerators|, and above in the CrOS accelerators as |
108 // Search+Esc. | 99 // Search+Esc. |
109 { true, ui::VKEY_ESCAPE, ui::EF_SHIFT_DOWN, SHOW_TASK_MANAGER }, | 100 { true, ui::VKEY_ESCAPE, ui::EF_SHIFT_DOWN, SHOW_TASK_MANAGER }, |
| 101 // The below keys have been deprecated on ChromeOS and were replaced above by |
| 102 // Ctrl+Shift+Space. crbug.com/535004. |
| 103 // We have to define 3 entries for Shift+Alt. VKEY_[LR]MENU might be sent to |
| 104 // the accelerator controller when RenderWidgetHostViewAura is focused, and |
| 105 // VKEY_MENU might be when it's not (e.g. when NativeWidgetAura is focused). |
| 106 { false, ui::VKEY_LMENU, ui::EF_SHIFT_DOWN, NEXT_IME }, |
| 107 { false, ui::VKEY_MENU, ui::EF_SHIFT_DOWN, NEXT_IME }, |
| 108 { false, ui::VKEY_RMENU, ui::EF_SHIFT_DOWN, NEXT_IME }, |
| 109 // The same is true for Alt+Shift. |
| 110 { false, ui::VKEY_LSHIFT, ui::EF_ALT_DOWN, NEXT_IME }, |
| 111 { false, ui::VKEY_SHIFT, ui::EF_ALT_DOWN, NEXT_IME }, |
| 112 { false, ui::VKEY_RSHIFT, ui::EF_ALT_DOWN, NEXT_IME }, |
110 #endif // defined(OS_CHROMEOS) | 113 #endif // defined(OS_CHROMEOS) |
111 { true, ui::VKEY_I, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN, OPEN_FEEDBACK_PAGE }, | 114 { true, ui::VKEY_I, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN, OPEN_FEEDBACK_PAGE }, |
112 #if !defined(OS_WIN) | 115 #if !defined(OS_WIN) |
113 { true, ui::VKEY_Q, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN, EXIT }, | 116 { true, ui::VKEY_Q, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN, EXIT }, |
114 #endif | 117 #endif |
115 { true, ui::VKEY_N, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN, | 118 { true, ui::VKEY_N, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN, |
116 NEW_INCOGNITO_WINDOW }, | 119 NEW_INCOGNITO_WINDOW }, |
117 { true, ui::VKEY_N, ui::EF_CONTROL_DOWN, NEW_WINDOW }, | 120 { true, ui::VKEY_N, ui::EF_CONTROL_DOWN, NEW_WINDOW }, |
118 { true, ui::VKEY_T, ui::EF_CONTROL_DOWN, NEW_TAB }, | 121 { true, ui::VKEY_T, ui::EF_CONTROL_DOWN, NEW_TAB }, |
119 { true, ui::VKEY_OEM_MINUS, | 122 { true, ui::VKEY_OEM_MINUS, |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 // VKEY_MEDIA_LAUNCH_MAIL. | 184 // VKEY_MEDIA_LAUNCH_MAIL. |
182 }; | 185 }; |
183 | 186 |
184 const size_t kAcceleratorDataLength = arraysize(kAcceleratorData); | 187 const size_t kAcceleratorDataLength = arraysize(kAcceleratorData); |
185 | 188 |
186 // Instructions for how to deprecate and replace an Accelerator: | 189 // Instructions for how to deprecate and replace an Accelerator: |
187 // | 190 // |
188 // 1- Replace the old deprecated accelerator from the above list with the new | 191 // 1- Replace the old deprecated accelerator from the above list with the new |
189 // accelerator that will take its place. | 192 // accelerator that will take its place. |
190 // 2- Add an entry for it in the following |kDeprecatedAccelerators| list. | 193 // 2- Add an entry for it in the following |kDeprecatedAccelerators| list. |
191 // 3- That entry should contain the following: | 194 // 3- Add another entry in the |kDeprecatedAcceleratorsData|. |
192 // - The deprecated accelerator data you removed from above. | 195 // 4- That entry should contain the following: |
| 196 // - The action that the deprecated accelerator maps to. |
193 // - Define a histogram for this action in |histograms.xml| in the form | 197 // - Define a histogram for this action in |histograms.xml| in the form |
194 // "Ash.Accelerators.Deprecated.{ActionName}" and include the name of this | 198 // "Ash.Accelerators.Deprecated.{ActionName}" and include the name of this |
195 // histogram in this entry. This name will be used as the ID of the | 199 // histogram in this entry. This name will be used as the ID of the |
196 // notification to be shown to the user. This is to prevent duplication of | 200 // notification to be shown to the user. This is to prevent duplication of |
197 // same notification. | 201 // same notification. |
198 // - The ID of the localized notification message to give the users telling | 202 // - The ID of the localized notification message to give the users telling |
199 // them about the deprecation (Add one in |ash_chromeos_strings.grdp|. | 203 // them about the deprecation (Add one in |ash_chromeos_strings.grdp|. |
200 // Search for the comment <!-- Deprecated Accelerators Messages -->). | 204 // Search for the comment <!-- Deprecated Accelerators Messages -->). |
| 205 // - The IDs of the localized old and new shortcut text to be used to fill |
| 206 // the notification text. Also found in |ash_chromeos_strings.grdp|. |
201 // - {true or false} whether the deprecated accelerator is still enabled (we | 207 // - {true or false} whether the deprecated accelerator is still enabled (we |
202 // don't disable a deprecated accelerator abruptly). | 208 // don't disable a deprecated accelerator abruptly). |
203 // 4- Don't forget to update the keyboard overlay. | 209 // 5- Don't forget to update the keyboard overlay. Find 'shortcut' in the file |
| 210 // keyboard_overlay_data.js. |
204 #if defined(OS_CHROMEOS) | 211 #if defined(OS_CHROMEOS) |
205 | 212 |
206 const DeprecatedAcceleratorData kDeprecatedAccelerators[] = { | 213 const AcceleratorData kDeprecatedAccelerators[] = { |
207 { | 214 { true, ui::VKEY_L, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN, LOCK_SCREEN }, |
208 { true, ui::VKEY_L, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN, LOCK_SCREEN }, | 215 { true, ui::VKEY_ESCAPE, ui::EF_SHIFT_DOWN, SHOW_TASK_MANAGER }, |
209 "Ash.Accelerators.Deprecated.LockScreen", | 216 { false, ui::VKEY_LMENU, ui::EF_SHIFT_DOWN, NEXT_IME }, |
210 IDS_DEPRECATED_LOCK_SCREEN_MSG, | 217 { false, ui::VKEY_MENU, ui::EF_SHIFT_DOWN, NEXT_IME }, |
211 true | 218 { false, ui::VKEY_RMENU, ui::EF_SHIFT_DOWN, NEXT_IME }, |
212 }, | 219 { false, ui::VKEY_LSHIFT, ui::EF_ALT_DOWN, NEXT_IME }, |
213 { | 220 { false, ui::VKEY_SHIFT, ui::EF_ALT_DOWN, NEXT_IME }, |
214 { true, ui::VKEY_ESCAPE, ui::EF_SHIFT_DOWN, SHOW_TASK_MANAGER }, | 221 { false, ui::VKEY_RSHIFT, ui::EF_ALT_DOWN, NEXT_IME }, |
215 "Ash.Accelerators.Deprecated.ShowTaskManager", | |
216 IDS_DEPRECATED_SHOW_TASK_MANAGER_MSG, | |
217 true | |
218 }, | |
219 }; | 222 }; |
220 | 223 |
221 const size_t kDeprecatedAcceleratorsLength = arraysize(kDeprecatedAccelerators); | 224 const size_t kDeprecatedAcceleratorsLength = arraysize(kDeprecatedAccelerators); |
222 | 225 |
| 226 const DeprecatedAcceleratorData kDeprecatedAcceleratorsData[] = { |
| 227 { |
| 228 LOCK_SCREEN, |
| 229 "Ash.Accelerators.Deprecated.LockScreen", |
| 230 IDS_DEPRECATED_LOCK_SCREEN_MSG, |
| 231 IDS_SHORTCUT_LOCK_SCREEN_OLD, |
| 232 IDS_SHORTCUT_LOCK_SCREEN_NEW, |
| 233 true |
| 234 }, |
| 235 { |
| 236 SHOW_TASK_MANAGER, |
| 237 "Ash.Accelerators.Deprecated.ShowTaskManager", |
| 238 IDS_DEPRECATED_SHOW_TASK_MANAGER_MSG, |
| 239 IDS_SHORTCUT_TASK_MANAGER_OLD, |
| 240 IDS_SHORTCUT_TASK_MANAGER_NEW, |
| 241 true |
| 242 }, |
| 243 { |
| 244 NEXT_IME, |
| 245 "Ash.Accelerators.Deprecated.NextIME", |
| 246 IDS_DEPRECATED_NEXT_IME_MSG, |
| 247 IDS_SHORTCUT_NEXT_IME_OLD, |
| 248 IDS_SHORTCUT_NEXT_IME_NEW, |
| 249 true |
| 250 } |
| 251 }; |
| 252 |
| 253 const size_t kDeprecatedAcceleratorsDataLength = |
| 254 arraysize(kDeprecatedAcceleratorsData); |
| 255 |
223 #endif // defined(OS_CHROMEOS) | 256 #endif // defined(OS_CHROMEOS) |
224 | 257 |
225 const AcceleratorData kDebugAcceleratorData[] = { | 258 const AcceleratorData kDebugAcceleratorData[] = { |
226 #if defined(OS_CHROMEOS) | 259 #if defined(OS_CHROMEOS) |
227 // Extra shortcut for debug build to control magnifier on linux desktop. | 260 // Extra shortcut for debug build to control magnifier on linux desktop. |
228 {true, ui::VKEY_BRIGHTNESS_DOWN, ui::EF_CONTROL_DOWN, | 261 {true, ui::VKEY_BRIGHTNESS_DOWN, ui::EF_CONTROL_DOWN, |
229 MAGNIFY_SCREEN_ZOOM_OUT}, | 262 MAGNIFY_SCREEN_ZOOM_OUT}, |
230 {true, ui::VKEY_BRIGHTNESS_UP, ui::EF_CONTROL_DOWN, MAGNIFY_SCREEN_ZOOM_IN}, | 263 {true, ui::VKEY_BRIGHTNESS_UP, ui::EF_CONTROL_DOWN, MAGNIFY_SCREEN_ZOOM_IN}, |
231 // Extra shortcuts to lock the screen on linux desktop. | 264 // Extra shortcuts to lock the screen on linux desktop. |
232 {true, ui::VKEY_L, ui::EF_ALT_DOWN, LOCK_SCREEN}, | 265 {true, ui::VKEY_L, ui::EF_ALT_DOWN, LOCK_SCREEN}, |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 TOGGLE_WIFI, | 530 TOGGLE_WIFI, |
498 VOLUME_DOWN, | 531 VOLUME_DOWN, |
499 VOLUME_MUTE, | 532 VOLUME_MUTE, |
500 VOLUME_UP, | 533 VOLUME_UP, |
501 #endif // defined(OS_CHROMEOS) | 534 #endif // defined(OS_CHROMEOS) |
502 }; | 535 }; |
503 | 536 |
504 const size_t kActionsKeepingMenuOpenLength = arraysize(kActionsKeepingMenuOpen); | 537 const size_t kActionsKeepingMenuOpenLength = arraysize(kActionsKeepingMenuOpen); |
505 | 538 |
506 } // namespace ash | 539 } // namespace ash |
OLD | NEW |