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. | |
oshima
2015/11/05 21:12:18
crbug.com?
afakhry
2015/11/05 22:13:36
Done.
| |
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 -->). |
201 // - {true or false} whether the deprecated accelerator is still enabled (we | 205 // - {true or false} whether the deprecated accelerator is still enabled (we |
202 // don't disable a deprecated accelerator abruptly). | 206 // don't disable a deprecated accelerator abruptly). |
203 // 4- Don't forget to update the keyboard overlay. | 207 // 5- Don't forget to update the keyboard overlay. |
oshima
2015/11/05 21:12:18
add description to chrome/browser/resources/chrome
afakhry
2015/11/05 22:13:36
Done.
| |
204 #if defined(OS_CHROMEOS) | 208 #if defined(OS_CHROMEOS) |
205 | 209 |
206 const DeprecatedAcceleratorData kDeprecatedAccelerators[] = { | 210 const AcceleratorData kDeprecatedAccelerators[] = { |
211 { true, ui::VKEY_L, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN, LOCK_SCREEN }, | |
212 { true, ui::VKEY_ESCAPE, ui::EF_SHIFT_DOWN, SHOW_TASK_MANAGER }, | |
213 { false, ui::VKEY_LMENU, ui::EF_SHIFT_DOWN, NEXT_IME }, | |
214 { false, ui::VKEY_MENU, ui::EF_SHIFT_DOWN, NEXT_IME }, | |
215 { false, ui::VKEY_RMENU, ui::EF_SHIFT_DOWN, NEXT_IME }, | |
216 { false, ui::VKEY_LSHIFT, ui::EF_ALT_DOWN, NEXT_IME }, | |
217 { false, ui::VKEY_SHIFT, ui::EF_ALT_DOWN, NEXT_IME }, | |
218 { false, ui::VKEY_RSHIFT, ui::EF_ALT_DOWN, NEXT_IME }, | |
219 }; | |
220 | |
221 const size_t kDeprecatedAcceleratorsLength = arraysize(kDeprecatedAccelerators); | |
222 | |
223 const DeprecatedAcceleratorData kDeprecatedAcceleratorsData[] = { | |
207 { | 224 { |
208 { true, ui::VKEY_L, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN, LOCK_SCREEN }, | 225 LOCK_SCREEN, |
209 "Ash.Accelerators.Deprecated.LockScreen", | 226 "Ash.Accelerators.Deprecated.LockScreen", |
210 IDS_DEPRECATED_LOCK_SCREEN_MSG, | 227 IDS_DEPRECATED_LOCK_SCREEN_MSG, |
211 true | 228 true |
212 }, | 229 }, |
213 { | 230 { |
214 { true, ui::VKEY_ESCAPE, ui::EF_SHIFT_DOWN, SHOW_TASK_MANAGER }, | 231 SHOW_TASK_MANAGER, |
215 "Ash.Accelerators.Deprecated.ShowTaskManager", | 232 "Ash.Accelerators.Deprecated.ShowTaskManager", |
216 IDS_DEPRECATED_SHOW_TASK_MANAGER_MSG, | 233 IDS_DEPRECATED_SHOW_TASK_MANAGER_MSG, |
217 true | 234 true |
218 }, | 235 }, |
236 { | |
237 NEXT_IME, | |
238 "Ash.Accelerators.Deprecated.NextIME", | |
239 IDS_DEPRECATED_NEXT_IME_MSG, | |
240 true | |
241 } | |
219 }; | 242 }; |
220 | 243 |
221 const size_t kDeprecatedAcceleratorsLength = arraysize(kDeprecatedAccelerators); | 244 const size_t kDeprecatedAcceleratorsDataLength = |
245 arraysize(kDeprecatedAcceleratorsData); | |
222 | 246 |
223 #endif // defined(OS_CHROMEOS) | 247 #endif // defined(OS_CHROMEOS) |
224 | 248 |
225 const AcceleratorData kDebugAcceleratorData[] = { | 249 const AcceleratorData kDebugAcceleratorData[] = { |
226 #if defined(OS_CHROMEOS) | 250 #if defined(OS_CHROMEOS) |
227 // Extra shortcut for debug build to control magnifier on linux desktop. | 251 // Extra shortcut for debug build to control magnifier on linux desktop. |
228 {true, ui::VKEY_BRIGHTNESS_DOWN, ui::EF_CONTROL_DOWN, | 252 {true, ui::VKEY_BRIGHTNESS_DOWN, ui::EF_CONTROL_DOWN, |
229 MAGNIFY_SCREEN_ZOOM_OUT}, | 253 MAGNIFY_SCREEN_ZOOM_OUT}, |
230 {true, ui::VKEY_BRIGHTNESS_UP, ui::EF_CONTROL_DOWN, MAGNIFY_SCREEN_ZOOM_IN}, | 254 {true, ui::VKEY_BRIGHTNESS_UP, ui::EF_CONTROL_DOWN, MAGNIFY_SCREEN_ZOOM_IN}, |
231 // Extra shortcuts to lock the screen on linux desktop. | 255 // Extra shortcuts to lock the screen on linux desktop. |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
497 TOGGLE_WIFI, | 521 TOGGLE_WIFI, |
498 VOLUME_DOWN, | 522 VOLUME_DOWN, |
499 VOLUME_MUTE, | 523 VOLUME_MUTE, |
500 VOLUME_UP, | 524 VOLUME_UP, |
501 #endif // defined(OS_CHROMEOS) | 525 #endif // defined(OS_CHROMEOS) |
502 }; | 526 }; |
503 | 527 |
504 const size_t kActionsKeepingMenuOpenLength = arraysize(kActionsKeepingMenuOpen); | 528 const size_t kActionsKeepingMenuOpenLength = arraysize(kActionsKeepingMenuOpen); |
505 | 529 |
506 } // namespace ash | 530 } // namespace ash |
OLD | NEW |