Commit d817e184 authored by Weidong Guo's avatar Weidong Guo Committed by Commit Bot

cros: Make Alt+Shift+N toggle message center

Changes:
Change shortcut Alt+Shift+N to toggling message center instead of only
showing message center.

BUG=376937

Change-Id: I44a062eb4d2117d642257241cbddf9a5feab97cf
Reviewed-on: https://chromium-review.googlesource.com/614726Reviewed-by: default avatarSteven Holte <holte@chromium.org>
Reviewed-by: default avatarJesse Doherty <jwd@chromium.org>
Reviewed-by: default avatarDan Erat <derat@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Commit-Queue: Weidong Guo <weidongg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#496563}
parent ed2387b8
......@@ -363,7 +363,7 @@ void HandleShowKeyboardOverlay() {
Shell::Get()->new_window_controller()->ShowKeyboardOverlay();
}
bool CanHandleShowMessageCenterBubble() {
bool CanHandleToggleMessageCenterBubble() {
aura::Window* target_root = Shell::GetRootWindowForNewWindows();
StatusAreaWidget* status_area_widget =
Shelf::ForWindow(target_root)->shelf_widget()->status_area_widget();
......@@ -371,17 +371,21 @@ bool CanHandleShowMessageCenterBubble() {
status_area_widget->web_notification_tray()->visible();
}
void HandleShowMessageCenterBubble() {
base::RecordAction(UserMetricsAction("Accel_Show_Message_Center_Bubble"));
void HandleToggleMessageCenterBubble() {
base::RecordAction(UserMetricsAction("Accel_Toggle_Message_Center_Bubble"));
aura::Window* target_root = Shell::GetRootWindowForNewWindows();
StatusAreaWidget* status_area_widget =
Shelf::ForWindow(target_root)->shelf_widget()->status_area_widget();
if (status_area_widget) {
WebNotificationTray* notification_tray =
status_area_widget->web_notification_tray();
if (notification_tray->visible())
notification_tray->ShowBubble();
}
if (!status_area_widget)
return;
WebNotificationTray* notification_tray =
status_area_widget->web_notification_tray();
if (!notification_tray->visible())
return;
if (notification_tray->IsMessageCenterBubbleVisible())
notification_tray->CloseBubble();
else
notification_tray->ShowBubble();
}
void HandleToggleSystemTrayBubble() {
......@@ -1001,8 +1005,6 @@ bool AcceleratorController::CanPerformAction(
case SCALE_UI_RESET:
case SCALE_UI_UP:
return accelerators::IsInternalDisplayZoomEnabled();
case SHOW_MESSAGE_CENTER_BUBBLE:
return CanHandleShowMessageCenterBubble();
case SHOW_STYLUS_TOOLS:
return CanHandleShowStylusTools();
case START_VOICE_INTERACTION:
......@@ -1018,6 +1020,8 @@ bool AcceleratorController::CanPerformAction(
return CanHandleToggleAppList(accelerator, previous_accelerator);
case TOGGLE_CAPS_LOCK:
return CanHandleToggleCapsLock(accelerator, previous_accelerator);
case TOGGLE_MESSAGE_CENTER_BUBBLE:
return CanHandleToggleMessageCenterBubble();
case TOGGLE_MIRROR_MODE:
return true;
case WINDOW_CYCLE_SNAP_LEFT:
......@@ -1251,9 +1255,6 @@ void AcceleratorController::PerformAction(AcceleratorAction action,
case SHOW_KEYBOARD_OVERLAY:
HandleShowKeyboardOverlay();
break;
case SHOW_MESSAGE_CENTER_BUBBLE:
HandleShowMessageCenterBubble();
break;
case SHOW_STYLUS_TOOLS:
HandleShowStylusTools();
break;
......@@ -1293,6 +1294,9 @@ void AcceleratorController::PerformAction(AcceleratorAction action,
case TOGGLE_MAXIMIZED:
accelerators::ToggleMaximized();
break;
case TOGGLE_MESSAGE_CENTER_BUBBLE:
HandleToggleMessageCenterBubble();
break;
case TOGGLE_MIRROR_MODE:
HandleToggleMirrorMode();
break;
......
......@@ -130,10 +130,10 @@ bool AcceleratorControllerDelegateClassic::HandlesAction(
case MAGNIFY_SCREEN_ZOOM_OUT:
case POWER_PRESSED:
case POWER_RELEASED:
case SHOW_MESSAGE_CENTER_BUBBLE:
case TAKE_PARTIAL_SCREENSHOT:
case TAKE_SCREENSHOT:
case TAKE_WINDOW_SCREENSHOT:
case TOGGLE_MESSAGE_CENTER_BUBBLE:
case TOUCH_HUD_CLEAR:
case TOUCH_HUD_MODE_CHANGE:
case TOUCH_HUD_PROJECTION_TOGGLE:
......
......@@ -128,7 +128,7 @@ const AcceleratorData kAcceleratorData[] = {
SHOW_KEYBOARD_OVERLAY},
{true, ui::VKEY_F14, ui::EF_NONE, SHOW_KEYBOARD_OVERLAY},
{true, ui::VKEY_N, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN,
SHOW_MESSAGE_CENTER_BUBBLE},
TOGGLE_MESSAGE_CENTER_BUBBLE},
{true, ui::VKEY_P, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN, SHOW_STYLUS_TOOLS},
{true, ui::VKEY_S, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN,
TOGGLE_SYSTEM_TRAY_BUBBLE},
......
......@@ -115,7 +115,6 @@ enum AcceleratorAction {
SCALE_UI_UP,
SHOW_IME_MENU_BUBBLE,
SHOW_KEYBOARD_OVERLAY,
SHOW_MESSAGE_CENTER_BUBBLE,
SHOW_STYLUS_TOOLS,
SHOW_TASK_MANAGER,
START_VOICE_INTERACTION,
......@@ -132,6 +131,7 @@ enum AcceleratorAction {
TOGGLE_FULLSCREEN,
TOGGLE_HIGH_CONTRAST,
TOGGLE_MAXIMIZED,
TOGGLE_MESSAGE_CENTER_BUBBLE,
TOGGLE_MIRROR_MODE,
TOGGLE_OVERVIEW,
TOGGLE_SPOKEN_FEEDBACK,
......
......@@ -20,7 +20,7 @@ constexpr int kNonSearchAcceleratorsNum = 94;
// The hash of non-Search-based accelerators as of 2017-07-19.
// See HashAcceleratorData().
constexpr char kNonSearchAcceleratorsHash[] =
"8c68836ced2c7874a8ff8e306005d526";
"d36dd12d75b39fe7175858af6077f13b";
struct Cmp {
bool operator()(const AcceleratorData& lhs, const AcceleratorData& rhs) {
......
......@@ -207,7 +207,7 @@ IN_PROC_BROWSER_TEST_F(LoggedInSpokenFeedbackTest,
DISABLED_NavigateNotificationCenter) {
EnableChromeVox();
EXPECT_TRUE(PerformAcceleratorAction(ash::SHOW_MESSAGE_CENTER_BUBBLE));
EXPECT_TRUE(PerformAcceleratorAction(ash::TOGGLE_MESSAGE_CENTER_BUBBLE));
// Tab to request the initial focus.
SendKeyPress(ui::VKEY_TAB);
......
......@@ -853,6 +853,9 @@ should be able to be added at any place in this file.
</action>
<action name="Accel_Show_Message_Center_Bubble">
<obsolete>
Deprecated 08/2017. Replaced by Accel_Toggle_Message_Center_Bubble.
</obsolete>
<owner>Please list the metric's owners. Add more owner tags as needed.</owner>
<description>Please enter the description of this user action.</description>
</action>
......@@ -947,6 +950,14 @@ should be able to be added at any place in this file.
<description>Please enter the description of this user action.</description>
</action>
<action name="Accel_Toggle_Message_Center_Bubble">
<owner>weidongg@chromium.org</owner>
<description>
Metric recorded when the user toggles the message center bubble with the
keyboard accelerator.
</description>
</action>
<action name="Accel_Toggle_Minimized">
<owner>Please list the metric's owners. Add more owner tags as needed.</owner>
<description>Please enter the description of this user action.</description>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment