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

Unified Diff: ash/accelerators/accelerator_table.cc

Issue 1177773002: Deprecating high-conflict accelerators (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reverted whitespace from generated_resources.grd Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: ash/accelerators/accelerator_table.cc
diff --git a/ash/accelerators/accelerator_table.cc b/ash/accelerators/accelerator_table.cc
index 93ddb01fa9d3581d4af479107ab747eed41d2915..dffee43fec70db486eefb25eb487189476b859e6 100644
--- a/ash/accelerators/accelerator_table.cc
+++ b/ash/accelerators/accelerator_table.cc
@@ -4,6 +4,7 @@
#include "ash/accelerators/accelerator_table.h"
+#include "ash/strings/grit/ash_strings.h"
#include "base/basictypes.h"
namespace ash {
@@ -53,7 +54,6 @@ const AcceleratorData kAcceleratorData[] = {
MAGNIFY_SCREEN_ZOOM_OUT},
{ true, ui::VKEY_BRIGHTNESS_UP, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN,
MAGNIFY_SCREEN_ZOOM_IN},
- { true, ui::VKEY_L, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN, LOCK_SCREEN },
// The lock key on Chrome OS keyboards produces F13 scancodes.
{ true, ui::VKEY_F13, ui::EF_NONE, LOCK_PRESSED },
{ false, ui::VKEY_F13, ui::EF_NONE, LOCK_RELEASED },
@@ -100,6 +100,10 @@ const AcceleratorData kAcceleratorData[] = {
{ true, ui::VKEY_VOLUME_MUTE, ui::EF_NONE, VOLUME_MUTE },
{ true, ui::VKEY_VOLUME_DOWN, ui::EF_NONE, VOLUME_DOWN },
{ true, ui::VKEY_VOLUME_UP, ui::EF_NONE, VOLUME_UP },
+#else // defined(OS_CHROMEOS)
+ // This key has been deprecated on CrOS. It is instead included below in the
oshima 2015/06/16 05:54:17 indent
afakhry 2015/06/16 22:30:33 That was done by 'git cl format ash', not sure why
+ // |kDeprecatedAccelerators|.
+ {true, ui::VKEY_ESCAPE, ui::EF_SHIFT_DOWN, SHOW_TASK_MANAGER},
#endif // defined(OS_CHROMEOS)
{ true, ui::VKEY_I, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN, OPEN_FEEDBACK_PAGE },
#if !defined(OS_WIN)
@@ -140,7 +144,6 @@ const AcceleratorData kAcceleratorData[] = {
SHOW_MESSAGE_CENTER_BUBBLE },
{ true, ui::VKEY_S, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN,
SHOW_SYSTEM_TRAY_BUBBLE },
- { true, ui::VKEY_ESCAPE, ui::EF_SHIFT_DOWN, SHOW_TASK_MANAGER },
{ true, ui::VKEY_1, ui::EF_ALT_DOWN, LAUNCH_APP_0 },
{ true, ui::VKEY_2, ui::EF_ALT_DOWN, LAUNCH_APP_1 },
{ true, ui::VKEY_3, ui::EF_ALT_DOWN, LAUNCH_APP_2 },
@@ -182,6 +185,46 @@ const AcceleratorData kAcceleratorData[] = {
const size_t kAcceleratorDataLength = arraysize(kAcceleratorData);
+// Instructions for how to deprecate and replace an Accelerator:
+//
+// 1- Remove the old deprecated accelerator from the above list.
+// 2- Add an entry for it in the following |kDeprecatedAccelerators| list.
+// 3- That entry should contain the following:
+// - The deprecated accelerator data you removed from above.
+// - The new accelerator that should replace it.
+// - Both the new and old accelerators MUST map to the same
+// |AcceleratorAction|.
+// - Define a histogram for this action in |histograms.xml| in the form
+// "Ash.Accelerators.{ActionName}" and include the name of this histogram
+// in this entry.
+// - The ID of the localized notification message to give the users telling
+// them about the deprecation (Add one in |ash_chromeos_strings.grdp|.
+// Search for the comment <!-- Deprecated Accelerators Messages -->).
+// - {true or false} whether the notification should be displayed every time
+// the user uses the deprecated accelerator.
+// - {true or false} whether the deprecated accelerator is still enabled (we
+// don't disable a deprecated accelerator abruptly).
+// 4- Don't forget to update the keyboard overlay.
+
+const DeprecatedAcceleratorData kDeprecatedAccelerators[] = {
oshima 2015/06/16 05:54:17 instead of defining both here, it's be better to s
afakhry 2015/06/16 22:30:33 Let's discuss tomorrow, then.
+#if defined(OS_CHROMEOS)
+ {{true, ui::VKEY_L, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN, LOCK_SCREEN},
+ {true, ui::VKEY_L, ui::EF_COMMAND_DOWN, LOCK_SCREEN},
+ "Ash.Accelerators.LockScreen",
+ IDS_DEPRECATED_LOCK_SCREEN_MSG,
+ true,
+ true},
+ {{true, ui::VKEY_ESCAPE, ui::EF_SHIFT_DOWN, SHOW_TASK_MANAGER},
+ {true, ui::VKEY_ESCAPE, ui::EF_COMMAND_DOWN, SHOW_TASK_MANAGER},
+ "Ash.Accelerators.ShowTaskManager",
+ IDS_DEPRECATED_SHOW_TASK_MANAGER_MSG,
+ true,
+ true},
+#endif // defined(OS_CHROMEOS)
+};
+
+const size_t kDeprecatedAcceleratorsLength = arraysize(kDeprecatedAccelerators);
+
const AcceleratorData kDebugAcceleratorData[] = {
#if defined(OS_CHROMEOS)
// Extra shortcut for debug build to control magnifier on linux desktop.

Powered by Google App Engine
This is Rietveld 408576698