Chromium Code Reviews| Index: ash/accelerators/accelerator_controller.cc |
| diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc |
| index d9c2d7955d7b7d08e781c02df72d9c3b00e1c70d..4c261d7181c596461b250bbff5edfcc4e33381ce 100644 |
| --- a/ash/accelerators/accelerator_controller.cc |
| +++ b/ash/accelerators/accelerator_controller.cc |
| @@ -92,6 +92,12 @@ bool DebugShortcutsEnabled() { |
| #endif |
| } |
| +void HandleAddRemoveDisplay() { |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Add_Remove_Display")); |
| + Shell::GetInstance()->display_manager()->AddRemoveDisplay(); |
| +} |
| + |
| void HandleCycleBackwardMRU(const ui::Accelerator& accelerator) { |
| Shell* shell = Shell::GetInstance(); |
| @@ -137,7 +143,37 @@ void HandleCycleLinear(const ui::Accelerator& accelerator) { |
| shell->window_cycle_controller()->HandleLinearCycleWindow(); |
| } |
| +bool HandleDisableCapsLock(ui::KeyboardCode key_code, |
| + ui::EventType previous_event_type, |
| + ui::KeyboardCode previous_key_code) { |
| + Shell* shell = Shell::GetInstance(); |
| + |
| + if (previous_event_type == ui::ET_KEY_RELEASED || |
| + (previous_key_code != ui::VKEY_LSHIFT && |
| + previous_key_code != ui::VKEY_SHIFT && |
| + previous_key_code != ui::VKEY_RSHIFT)) { |
| + // If something else was pressed between the Shift key being pressed |
| + // and released, then ignore the release of the Shift key. |
| + return false; |
| + } |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Disable_Caps_Lock")); |
| + if (shell->caps_lock_delegate()->IsCapsLockEnabled()) { |
| + shell->caps_lock_delegate()->SetCapsLockEnabled(false); |
| + return true; |
| + } |
| + return false; |
| +} |
| + |
| bool HandleAccessibleFocusCycle(bool reverse) { |
| + if (reverse) { |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Accessible_Focus_Previous")); |
| + } else { |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Accessible_Focus_Next")); |
| + } |
| + |
| if (!Shell::GetInstance()->accessibility_delegate()-> |
| IsSpokenFeedbackEnabled()) { |
| return false; |
| @@ -162,7 +198,58 @@ bool HandleAccessibleFocusCycle(bool reverse) { |
| return true; |
| } |
| +void HandleShowKeyboardOverlay() { |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Show_Keyboard_Overlay")); |
| + ash::Shell::GetInstance()->new_window_delegate()->ShowKeyboardOverlay(); |
| +} |
| + |
| +void HandleShowMessageCenterBubble() { |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Show_Message_Center_Bubble")); |
| + internal::RootWindowController* controller = |
| + internal::RootWindowController::ForTargetRootWindow(); |
| + internal::StatusAreaWidget* status_area_widget = |
| + controller->shelf()->status_area_widget(); |
| + if (status_area_widget) { |
| + WebNotificationTray* notification_tray = |
| + status_area_widget->web_notification_tray(); |
| + if (notification_tray->visible()) |
| + notification_tray->ShowMessageCenterBubble(); |
| + } |
| +} |
| + |
| +bool HandleShowOak() { |
| + if (CommandLine::ForCurrentProcess()->HasSwitch( |
| + switches::kAshEnableOak)) { |
| + oak::ShowOakWindowWithContext(Shell::GetPrimaryRootWindow()); |
| + return true; |
| + } |
| + return false; |
| +} |
| + |
| +bool HandleShowSystemTrayBubble() { |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Show_System_Tray_Bubble")); |
| + internal::RootWindowController* controller = |
| + internal::RootWindowController::ForTargetRootWindow(); |
| + if (!controller->GetSystemTray()->HasSystemBubble()) { |
| + controller->GetSystemTray()->ShowDefaultView(BUBBLE_CREATE_NEW); |
| + return true; |
| + } |
| + return false; |
| +} |
| + |
| +void HandleShowTaskManager() { |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Show_Task_Manager")); |
| + Shell::GetInstance()->new_window_delegate()->ShowTaskManager(); |
| +} |
| + |
| void HandleSilenceSpokenFeedback() { |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Silence_Spoken_Feedback")); |
| + |
| AccessibilityDelegate* delegate = |
| Shell::GetInstance()->accessibility_delegate(); |
| if (!delegate->IsSpokenFeedbackEnabled()) |
| @@ -171,28 +258,141 @@ void HandleSilenceSpokenFeedback() { |
| } |
| #if defined(OS_CHROMEOS) |
| -bool HandleLock() { |
| +bool HandleLock(ui::KeyboardCode key_code) { |
| Shell::GetInstance()->session_state_delegate()->LockScreen(); |
| return true; |
| } |
| bool HandleFileManager() { |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Open_File_Manager")); |
| + |
| Shell::GetInstance()->new_window_delegate()->OpenFileManager(); |
| return true; |
| } |
| +bool HandleFocusLauncher() { |
| + Shell* shell = Shell::GetInstance(); |
| + content::RecordAction(content::UserMetricsAction("Accel_Focus_Launcher")); |
| + return shell->focus_cycler()->FocusWidget( |
| + Launcher::ForPrimaryDisplay()->shelf_widget()); |
| +} |
| + |
| bool HandleCrosh() { |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Open_Crosh")); |
| + |
| Shell::GetInstance()->new_window_delegate()->OpenCrosh(); |
| return true; |
| } |
| +void HandleTakePartialScreenshot(ScreenshotDelegate* screenshot_delegate) { |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Take_Partial_Screenshot")); |
| + if (screenshot_delegate) { |
| + ash::PartialScreenshotView::StartPartialScreenshot( |
| + screenshot_delegate); |
| + } |
| +} |
| + |
| +void HandleTakeScreenshot(ScreenshotDelegate* screenshot_delegate) { |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Take_Screenshot")); |
| + if (screenshot_delegate && |
| + screenshot_delegate->CanTakeScreenshot()) { |
| + screenshot_delegate->HandleTakeScreenshotForAllRootWindows(); |
| + } |
| +} |
| + |
| +bool HandleToggleAppList(ui::KeyboardCode key_code, |
| + ui::EventType previous_event_type, |
| + ui::KeyboardCode previous_key_code, |
| + const ui::Accelerator& accelerator) { |
| + // If something else was pressed between the Search key (LWIN) |
| + // being pressed and released, then ignore the release of the |
| + // Search key. |
| + if (key_code == ui::VKEY_LWIN && |
| + (previous_event_type == ui::ET_KEY_RELEASED || |
| + previous_key_code != ui::VKEY_LWIN)) |
| + return false; |
| + if (key_code == ui::VKEY_LWIN) |
| + content::RecordAction(content::UserMetricsAction("Accel_Search_LWin")); |
| + // When spoken feedback is enabled, we should neither toggle the list nor |
| + // consume the key since Search+Shift is one of the shortcuts the a11y |
| + // feature uses. crbug.com/132296 |
| + DCHECK_EQ(ui::VKEY_LWIN, accelerator.key_code()); |
| + if (Shell::GetInstance()->accessibility_delegate()-> |
| + IsSpokenFeedbackEnabled()) |
| + return false; |
| + ash::Shell::GetInstance()->ToggleAppList(NULL); |
| + return true; |
| +} |
| + |
| +bool HandleToggleCapsLock(ui::KeyboardCode key_code, |
| + ui::EventType previous_event_type, |
| + ui::KeyboardCode previous_key_code) { |
| + Shell* shell = Shell::GetInstance(); |
| + if (key_code == ui::VKEY_LWIN) { |
| + // If something else was pressed between the Search key (LWIN) |
| + // being pressed and released, then ignore the release of the |
| + // Search key. |
| + // TODO(danakj): Releasing Alt first breaks this: crbug.com/166495 |
| + if (previous_event_type == ui::ET_KEY_RELEASED || |
| + previous_key_code != ui::VKEY_LWIN) |
| + return false; |
| + } |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Toggle_Caps_Lock")); |
| + shell->caps_lock_delegate()->ToggleCapsLock(); |
| + return true; |
| +} |
| + |
| +void HandleToggleMirrorMode() { |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Toggle_Mirror_Mode")); |
| + Shell::GetInstance()->display_controller()->ToggleMirrorMode(); |
| +} |
| + |
| bool HandleToggleSpokenFeedback() { |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Toggle_Spoken_Feedback")); |
| + |
| Shell::GetInstance()->accessibility_delegate()-> |
| ToggleSpokenFeedback(A11Y_NOTIFICATION_SHOW); |
| return true; |
| } |
| -bool SwitchToNextUser() { |
| +bool HandleTouchHudClear() { |
| + internal::RootWindowController* controller = |
| + internal::RootWindowController::ForTargetRootWindow(); |
| + if (controller->touch_hud_debug()) { |
| + controller->touch_hud_debug()->Clear(); |
| + return true; |
| + } |
| + return false; |
| +} |
| + |
| +bool HandleTouchHudModeChange() { |
| + internal::RootWindowController* controller = |
| + internal::RootWindowController::ForTargetRootWindow(); |
| + if (controller->touch_hud_debug()) { |
| + controller->touch_hud_debug()->ChangeToNextMode(); |
| + return true; |
| + } |
| + return false; |
| +} |
| + |
| +void HandleTouchHudProjectToggle() { |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Touch_Hud_Clear")); |
| + bool enabled = Shell::GetInstance()->is_touch_hud_projection_enabled(); |
| + Shell::GetInstance()->SetTouchHudProjectionEnabled(!enabled); |
| +} |
| + |
| +bool HandleSwitchToNextUser() { |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Switch_To_Next_User")); |
| + |
| if (!Shell::GetInstance()->delegate()->IsMultiProfilesEnabled()) |
| return false; |
| ash::SessionStateDelegate* delegate = |
| @@ -210,18 +410,27 @@ bool SwitchToNextUser() { |
| bool HandleRotatePaneFocus(Shell::Direction direction) { |
| Shell* shell = Shell::GetInstance(); |
| switch (direction) { |
| - case Shell::FORWARD: |
| + // TODO(stevet): Not sure if this is the same as IDC_FOCUS_NEXT_PANE. |
| + case Shell::FORWARD: { |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Focus_Next_Pane")); |
| shell->focus_cycler()->RotateFocus(internal::FocusCycler::FORWARD); |
| break; |
| - case Shell::BACKWARD: |
| + } |
| + case Shell::BACKWARD: { |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Focus_Previous_Pane")); |
| shell->focus_cycler()->RotateFocus(internal::FocusCycler::BACKWARD); |
| break; |
| + } |
| } |
| return true; |
| } |
| // Rotate the active window. |
| bool HandleRotateActiveWindow() { |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Rotate_Window")); |
| aura::Window* active_window = wm::GetActiveWindow(); |
| if (active_window) { |
| // The rotation animation bases its target transform on the current |
| @@ -258,6 +467,15 @@ bool HandleScaleUI(bool up) { |
| int64 display_id = display_manager->GetDisplayIdForUIScaling(); |
| if (display_id == gfx::Display::kInvalidDisplayID) |
| return false; |
| + |
| + if (up) { |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Scale_Ui_Up")); |
| + } else { |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Scale_Ui_Down")); |
| + } |
| + |
| const DisplayInfo& display_info = display_manager->GetDisplayInfo(display_id); |
| float next_scale = |
| internal::DisplayManager::GetNextUIScale(display_info, up); |
| @@ -271,12 +489,29 @@ bool HandleScaleReset() { |
| int64 display_id = display_manager->GetDisplayIdForUIScaling(); |
| if (display_id == gfx::Display::kInvalidDisplayID) |
| return false; |
| + |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Scale_Ui_Reset")); |
| + |
| display_manager->SetDisplayUIScale(display_id, 1.0f); |
| return true; |
| } |
| +void HandleSwapPrimaryDisplay() { |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Swap_Primary_Display")); |
| + Shell::GetInstance()->display_controller()->SwapPrimaryDisplay(); |
| +} |
| + |
| +void HandleRestoreTab() { |
| + content::RecordAction(content::UserMetricsAction("Accel_Restore_Tab")); |
| + Shell::GetInstance()->new_window_delegate()->RestoreTab(); |
| +} |
| + |
| // Rotates the screen. |
| bool HandleRotateScreen() { |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Rotate_Window")); |
| gfx::Point point = Shell::GetScreen()->GetCursorScreenPoint(); |
| gfx::Display display = Shell::GetScreen()->GetDisplayNearestPoint(point); |
| const DisplayInfo& display_info = |
| @@ -330,6 +565,35 @@ bool HandleMediaPrevTrack() { |
| return true; |
| } |
| +bool HandleNewIncognitoWindow() { |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_New_Incognito_Window")); |
| + bool incognito_allowed = |
| + Shell::GetInstance()->delegate()->IsIncognitoAllowed(); |
| + if (incognito_allowed) |
| + Shell::GetInstance()->new_window_delegate()->NewWindow( |
| + true /* is_incognito */); |
| + return incognito_allowed; |
| +} |
| + |
| +void HandleNewTab(ui::KeyboardCode key_code) { |
| + if (key_code == ui::VKEY_T) |
| + content::RecordAction(content::UserMetricsAction("Accel_NewTab_T")); |
| + Shell::GetInstance()->new_window_delegate()->NewTab(); |
| +} |
| + |
| +void HandleNewWindow() { |
| + content::RecordAction(content::UserMetricsAction("Accel_New_Window")); |
| + Shell::GetInstance()->new_window_delegate()->NewWindow( |
| + false /* is_incognito */); |
| +} |
| + |
| +void HandleOpenFeedbackPage() { |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Open_Feedback_Page")); |
| + ash::Shell::GetInstance()->new_window_delegate()->OpenFeedbackPage(); |
| +} |
| + |
| bool HandlePrintLayerHierarchy() { |
| aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| for (size_t i = 0; i < root_windows.size(); ++i) { |
| @@ -575,15 +839,13 @@ bool AcceleratorController::PerformAction(int action, |
| return true; |
| #if defined(OS_CHROMEOS) |
| case ADD_REMOVE_DISPLAY: |
| - Shell::GetInstance()->display_manager()->AddRemoveDisplay(); |
| + HandleAddRemoveDisplay(); |
| return true; |
| case TOGGLE_MIRROR_MODE: |
| - Shell::GetInstance()->display_controller()->ToggleMirrorMode(); |
| + HandleToggleMirrorMode(); |
| return true; |
| case LOCK_SCREEN: |
| - if (key_code == ui::VKEY_L) |
| - content::RecordAction(content::UserMetricsAction("Accel_LockScreen_L")); |
| - return HandleLock(); |
| + return HandleLock(key_code); |
| case OPEN_FILE_MANAGER: |
| return HandleFileManager(); |
| case OPEN_CROSH: |
| @@ -592,129 +854,62 @@ bool AcceleratorController::PerformAction(int action, |
| HandleSilenceSpokenFeedback(); |
| break; |
| case SWAP_PRIMARY_DISPLAY: |
| - Shell::GetInstance()->display_controller()->SwapPrimaryDisplay(); |
| + HandleSwapPrimaryDisplay(); |
| return true; |
| case SWITCH_TO_NEXT_USER: |
| - return SwitchToNextUser(); |
| + return HandleSwitchToNextUser(); |
| case TOGGLE_SPOKEN_FEEDBACK: |
| return HandleToggleSpokenFeedback(); |
| case TOGGLE_WIFI: |
| Shell::GetInstance()->system_tray_notifier()->NotifyRequestToggleWifi(); |
| return true; |
| - case TOUCH_HUD_CLEAR: { |
| - internal::RootWindowController* controller = |
| - internal::RootWindowController::ForTargetRootWindow(); |
| - if (controller->touch_hud_debug()) { |
| - controller->touch_hud_debug()->Clear(); |
| - return true; |
| - } |
| - return false; |
| - } |
| - case TOUCH_HUD_MODE_CHANGE: { |
| - internal::RootWindowController* controller = |
| - internal::RootWindowController::ForTargetRootWindow(); |
| - if (controller->touch_hud_debug()) { |
| - controller->touch_hud_debug()->ChangeToNextMode(); |
| - return true; |
| - } |
| - return false; |
| - } |
| - case TOUCH_HUD_PROJECTION_TOGGLE: { |
| - bool enabled = Shell::GetInstance()->is_touch_hud_projection_enabled(); |
| - Shell::GetInstance()->SetTouchHudProjectionEnabled(!enabled); |
| + case TOUCH_HUD_CLEAR: |
| + return HandleTouchHudClear(); |
| + case TOUCH_HUD_MODE_CHANGE: |
| + return HandleTouchHudModeChange(); |
| + case TOUCH_HUD_PROJECTION_TOGGLE: |
| + HandleTouchHudProjectToggle(); |
| return true; |
| - } |
| case DISABLE_GPU_WATCHDOG: |
| content::GpuDataManager::GetInstance()->DisableGpuWatchdog(); |
| return true; |
| #endif |
| case OPEN_FEEDBACK_PAGE: |
| - ash::Shell::GetInstance()->new_window_delegate()->OpenFeedbackPage(); |
| + HandleOpenFeedbackPage(); |
| return true; |
| case EXIT: |
| // UMA metrics are recorded in the handler. |
| exit_warning_handler_.HandleAccelerator(); |
| return true; |
| - case NEW_INCOGNITO_WINDOW: { |
| - bool incognito_allowed = |
| - Shell::GetInstance()->delegate()->IsIncognitoAllowed(); |
| - if (incognito_allowed) |
| - Shell::GetInstance()->new_window_delegate()->NewWindow( |
| - true /* is_incognito */); |
| - return incognito_allowed; |
| - } |
| + case NEW_INCOGNITO_WINDOW: |
| + return HandleNewIncognitoWindow(); |
| case NEW_TAB: |
| - if (key_code == ui::VKEY_T) |
| - content::RecordAction(content::UserMetricsAction("Accel_NewTab_T")); |
| - Shell::GetInstance()->new_window_delegate()->NewTab(); |
| + HandleNewTab(key_code); |
| return true; |
| case NEW_WINDOW: |
| - Shell::GetInstance()->new_window_delegate()->NewWindow( |
| - false /* is_incognito */); |
| + HandleNewWindow(); |
| return true; |
| case RESTORE_TAB: |
| - Shell::GetInstance()->new_window_delegate()->RestoreTab(); |
| + HandleRestoreTab(); |
| return true; |
| case TAKE_SCREENSHOT: |
| - if (screenshot_delegate_.get() && |
| - screenshot_delegate_->CanTakeScreenshot()) { |
| - screenshot_delegate_->HandleTakeScreenshotForAllRootWindows(); |
| - } |
| + HandleTakeScreenshot(screenshot_delegate_.get()); |
| // Return true to prevent propagation of the key event. |
| return true; |
| case TAKE_PARTIAL_SCREENSHOT: |
| - if (screenshot_delegate_) { |
| - ash::PartialScreenshotView::StartPartialScreenshot( |
| - screenshot_delegate_.get()); |
| - } |
| + HandleTakePartialScreenshot(screenshot_delegate_.get()); |
| // Return true to prevent propagation of the key event because |
| // this key combination is reserved for partial screenshot. |
| return true; |
| case TOGGLE_APP_LIST: |
| - // If something else was pressed between the Search key (LWIN) |
| - // being pressed and released, then ignore the release of the |
| - // Search key. |
| - if (key_code == ui::VKEY_LWIN && |
| - (previous_event_type == ui::ET_KEY_RELEASED || |
| - previous_key_code != ui::VKEY_LWIN)) |
| - return false; |
| - if (key_code == ui::VKEY_LWIN) |
| - content::RecordAction(content::UserMetricsAction("Accel_Search_LWin")); |
| - // When spoken feedback is enabled, we should neither toggle the list nor |
| - // consume the key since Search+Shift is one of the shortcuts the a11y |
| - // feature uses. crbug.com/132296 |
| - DCHECK_EQ(ui::VKEY_LWIN, accelerator.key_code()); |
| - if (Shell::GetInstance()->accessibility_delegate()-> |
| - IsSpokenFeedbackEnabled()) |
| - return false; |
| - ash::Shell::GetInstance()->ToggleAppList(NULL); |
| - return true; |
| + return HandleToggleAppList( |
| + key_code, previous_event_type, previous_key_code, accelerator); |
| case DISABLE_CAPS_LOCK: |
| - if (previous_event_type == ui::ET_KEY_RELEASED || |
| - (previous_key_code != ui::VKEY_LSHIFT && |
| - previous_key_code != ui::VKEY_SHIFT && |
| - previous_key_code != ui::VKEY_RSHIFT)) { |
| - // If something else was pressed between the Shift key being pressed |
| - // and released, then ignore the release of the Shift key. |
| - return false; |
| - } |
| - if (shell->caps_lock_delegate()->IsCapsLockEnabled()) { |
| - shell->caps_lock_delegate()->SetCapsLockEnabled(false); |
| - return true; |
| - } |
| - return false; |
| + return HandleDisableCapsLock( |
| + key_code, previous_event_type, previous_key_code); |
| case TOGGLE_CAPS_LOCK: |
| - if (key_code == ui::VKEY_LWIN) { |
| - // If something else was pressed between the Search key (LWIN) |
| - // being pressed and released, then ignore the release of the |
| - // Search key. |
| - // TODO(danakj): Releasing Alt first breaks this: crbug.com/166495 |
| - if (previous_event_type == ui::ET_KEY_RELEASED || |
| - previous_key_code != ui::VKEY_LWIN) |
| - return false; |
| - } |
| - shell->caps_lock_delegate()->ToggleCapsLock(); |
| - return true; |
| + return HandleToggleCapsLock( |
| + key_code, previous_event_type, previous_key_code); |
| case BRIGHTNESS_DOWN: |
| if (brightness_control_delegate_) |
| return brightness_control_delegate_->HandleBrightnessDown(accelerator); |
| @@ -748,47 +943,27 @@ bool AcceleratorController::PerformAction(int action, |
| shell->system_tray_delegate()->GetVolumeControlDelegate(); |
| return volume_delegate && volume_delegate->HandleVolumeUp(accelerator); |
| } |
| - case FOCUS_LAUNCHER: |
| - return shell->focus_cycler()->FocusWidget( |
| - Launcher::ForPrimaryDisplay()->shelf_widget()); |
| - case FOCUS_NEXT_PANE: |
| + case FOCUS_LAUNCHER: { |
| + return HandleFocusLauncher(); |
| + } |
|
James Cook
2013/11/26 21:40:59
nit: I don't think you need the extra braces and i
SteveT
2013/11/27 17:56:50
Done here and below.
|
| + case FOCUS_NEXT_PANE: { |
| return HandleRotatePaneFocus(Shell::FORWARD); |
| - case FOCUS_PREVIOUS_PANE: |
| + } |
| + case FOCUS_PREVIOUS_PANE: { |
| return HandleRotatePaneFocus(Shell::BACKWARD); |
| + } |
| case SHOW_KEYBOARD_OVERLAY: |
| - ash::Shell::GetInstance()->new_window_delegate()->ShowKeyboardOverlay(); |
| + HandleShowKeyboardOverlay(); |
| return true; |
| case SHOW_OAK: |
| - if (CommandLine::ForCurrentProcess()->HasSwitch( |
| - switches::kAshEnableOak)) { |
| - oak::ShowOakWindowWithContext(Shell::GetPrimaryRootWindow()); |
| - return true; |
| - } |
| + return HandleShowOak(); |
| + case SHOW_SYSTEM_TRAY_BUBBLE: |
| + return HandleShowSystemTrayBubble(); |
| + case SHOW_MESSAGE_CENTER_BUBBLE: |
| + HandleShowMessageCenterBubble(); |
| break; |
| - case SHOW_SYSTEM_TRAY_BUBBLE: { |
| - internal::RootWindowController* controller = |
| - internal::RootWindowController::ForTargetRootWindow(); |
| - if (!controller->GetSystemTray()->HasSystemBubble()) { |
| - controller->GetSystemTray()->ShowDefaultView(BUBBLE_CREATE_NEW); |
| - return true; |
| - } |
| - break; |
| - } |
| - case SHOW_MESSAGE_CENTER_BUBBLE: { |
| - internal::RootWindowController* controller = |
| - internal::RootWindowController::ForTargetRootWindow(); |
| - internal::StatusAreaWidget* status_area_widget = |
| - controller->shelf()->status_area_widget(); |
| - if (status_area_widget) { |
| - WebNotificationTray* notification_tray = |
| - status_area_widget->web_notification_tray(); |
| - if (notification_tray->visible()) |
| - notification_tray->ShowMessageCenterBubble(); |
| - } |
| - break; |
| - } |
| case SHOW_TASK_MANAGER: |
| - Shell::GetInstance()->new_window_delegate()->ShowTaskManager(); |
| + HandleShowTaskManager(); |
| return true; |
| case NEXT_IME: |
| // This check is necessary e.g. not to process the Shift+Alt+ |
| @@ -808,44 +983,68 @@ bool AcceleratorController::PerformAction(int action, |
| // TODO(mazda): Fix crbug.com/158217 |
| return false; |
| } |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Next_Ime")); |
| if (ime_control_delegate_) |
| return ime_control_delegate_->HandleNextIme(); |
| break; |
| case PREVIOUS_IME: |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Previous_Ime")); |
| if (ime_control_delegate_) |
| return ime_control_delegate_->HandlePreviousIme(accelerator); |
| break; |
| case PRINT_UI_HIERARCHIES: |
| return HandlePrintUIHierarchies(); |
| case SWITCH_IME: |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Switch_Ime")); |
| if (ime_control_delegate_) |
| return ime_control_delegate_->HandleSwitchIme(accelerator); |
| break; |
| case LAUNCH_APP_0: |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Launch_App_0")); |
| Launcher::ForPrimaryDisplay()->LaunchAppIndexAt(0); |
| return true; |
| case LAUNCH_APP_1: |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Launch_App_1")); |
| Launcher::ForPrimaryDisplay()->LaunchAppIndexAt(1); |
| return true; |
| case LAUNCH_APP_2: |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Launch_App_2")); |
| Launcher::ForPrimaryDisplay()->LaunchAppIndexAt(2); |
| return true; |
| case LAUNCH_APP_3: |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Launch_App_3")); |
| Launcher::ForPrimaryDisplay()->LaunchAppIndexAt(3); |
| return true; |
| case LAUNCH_APP_4: |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Launch_App_4")); |
| Launcher::ForPrimaryDisplay()->LaunchAppIndexAt(4); |
| return true; |
| case LAUNCH_APP_5: |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Launch_App_5")); |
| Launcher::ForPrimaryDisplay()->LaunchAppIndexAt(5); |
| return true; |
| case LAUNCH_APP_6: |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Launch_App_6")); |
| Launcher::ForPrimaryDisplay()->LaunchAppIndexAt(6); |
| return true; |
| case LAUNCH_APP_7: |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Launch_App_7")); |
| Launcher::ForPrimaryDisplay()->LaunchAppIndexAt(7); |
| return true; |
| case LAUNCH_LAST_APP: |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Launch_Last_App")); |
| Launcher::ForPrimaryDisplay()->LaunchAppIndexAt(-1); |
| return true; |
| case WINDOW_SNAP_LEFT: |
| @@ -859,6 +1058,14 @@ bool AcceleratorController::PerformAction(int action, |
| break; |
| } |
| + if (action == WINDOW_SNAP_LEFT) { |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Window_Snap_Left")); |
| + } else { |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Window_Snap_Right")); |
| + } |
| + |
| internal::SnapSizer::SnapWindow(window_state, |
| action == WINDOW_SNAP_LEFT ? internal::SnapSizer::LEFT_EDGE : |
| internal::SnapSizer::RIGHT_EDGE); |
| @@ -879,7 +1086,8 @@ bool AcceleratorController::PerformAction(int action, |
| return true; |
| } |
| case WINDOW_POSITION_CENTER: { |
| - content::RecordAction(content::UserMetricsAction("Accel_Center")); |
| + content::RecordAction( |
| + content::UserMetricsAction("Accel_Window_Position_Center")); |
| aura::Window* window = wm::GetActiveWindow(); |
| // Docked windows do not support centering and ignore accelerator. |
| if (window && !wm::GetWindowState(window)->IsDocked()) { |