diff options
Diffstat (limited to 'ash/accelerators')
-rw-r--r-- | ash/accelerators/accelerator_controller.cc | 9 | ||||
-rw-r--r-- | ash/accelerators/accelerator_controller_unittest.cc | 24 | ||||
-rw-r--r-- | ash/accelerators/accelerator_table.cc | 15 | ||||
-rw-r--r-- | ash/accelerators/accelerator_table.h | 3 |
4 files changed, 37 insertions, 14 deletions
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc index daa013a..43e2dac 100644 --- a/ash/accelerators/accelerator_controller.cc +++ b/ash/accelerators/accelerator_controller.cc @@ -525,8 +525,11 @@ bool AcceleratorController::PerformAction(int action, HandleCycleWindowLinear(CYCLE_FORWARD); return true; #if defined(OS_CHROMEOS) - case CYCLE_DISPLAY_MODE: - Shell::GetInstance()->display_controller()->CycleDisplayMode(); + case ADD_REMOVE_DISPLAY: + Shell::GetInstance()->display_manager()->AddRemoveDisplay(); + return true; + case TOGGLE_MIRROR_MODE: + Shell::GetInstance()->display_controller()->ToggleMirrorMode(); return true; case LOCK_SCREEN: if (key_code == ui::VKEY_L) @@ -852,7 +855,7 @@ bool AcceleratorController::PerformAction(int action, case TOGGLE_ROOT_WINDOW_FULL_SCREEN: return HandleToggleRootWindowFullScreen(); case DEBUG_TOGGLE_DEVICE_SCALE_FACTOR: - internal::DisplayManager::ToggleDisplayScaleFactor(); + Shell::GetInstance()->display_manager()->ToggleDisplayScaleFactor(); return true; case DEBUG_TOGGLE_SHOW_DEBUG_BORDERS: ash::debug::ToggleShowDebugBorders(); diff --git a/ash/accelerators/accelerator_controller_unittest.cc b/ash/accelerators/accelerator_controller_unittest.cc index 292cc3e..933d0a5 100644 --- a/ash/accelerators/accelerator_controller_unittest.cc +++ b/ash/accelerators/accelerator_controller_unittest.cc @@ -1205,26 +1205,38 @@ TEST_F(AcceleratorControllerTest, ReservedAccelerators) { #if defined(OS_CHROMEOS) TEST_F(AcceleratorControllerTest, DisallowedAtModalWindow) { - std::set<AcceleratorAction> allActions; + std::set<AcceleratorAction> all_actions; for (size_t i = 0 ; i < kAcceleratorDataLength; ++i) - allActions.insert(kAcceleratorData[i].action); + all_actions.insert(kAcceleratorData[i].action); +#if !defined(NDEBUG) + std::set<AcceleratorAction> all_desktop_actions; + for (size_t i = 0 ; i < kDesktopAcceleratorDataLength; ++i) + all_desktop_actions.insert(kDesktopAcceleratorData[i].action); +#endif + std::set<AcceleratorAction> actionsAllowedAtModalWindow; for (size_t k = 0 ; k < kActionsAllowedAtModalWindowLength; ++k) actionsAllowedAtModalWindow.insert(kActionsAllowedAtModalWindow[k]); for (std::set<AcceleratorAction>::const_iterator it = actionsAllowedAtModalWindow.begin(); it != actionsAllowedAtModalWindow.end(); ++it) { - EXPECT_FALSE(allActions.find(*it) == allActions.end()) + EXPECT_TRUE(all_actions.find(*it) != all_actions.end() + +#if !defined(NDEBUG) + || all_desktop_actions.find(*it) != all_desktop_actions.end() +#endif + ) << " action from kActionsAllowedAtModalWindow" - << " not found in kAcceleratorData. action: " << *it; + << " not found in kAcceleratorData or kDesktopAcceleratorData. " + << "action: " << *it; } scoped_ptr<aura::Window> window( CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); const ui::Accelerator dummy; wm::ActivateWindow(window.get()); Shell::GetInstance()->SimulateModalWindowOpenForTesting(true); - for (std::set<AcceleratorAction>::const_iterator it = allActions.begin(); - it != allActions.end(); ++it) { + for (std::set<AcceleratorAction>::const_iterator it = all_actions.begin(); + it != all_actions.end(); ++it) { if (actionsAllowedAtModalWindow.find(*it) == actionsAllowedAtModalWindow.end()) { EXPECT_TRUE(GetController()->PerformAction(*it, dummy)) diff --git a/ash/accelerators/accelerator_table.cc b/ash/accelerators/accelerator_table.cc index d9a6813..ec32f2c 100644 --- a/ash/accelerators/accelerator_table.cc +++ b/ash/accelerators/accelerator_table.cc @@ -44,7 +44,7 @@ const AcceleratorData kAcceleratorData[] = { { true, ui::VKEY_KBD_BRIGHTNESS_DOWN, ui::EF_NONE, KEYBOARD_BRIGHTNESS_DOWN }, { true, ui::VKEY_KBD_BRIGHTNESS_UP, ui::EF_NONE, KEYBOARD_BRIGHTNESS_UP }, // Maximize button. - { true, ui::VKEY_MEDIA_LAUNCH_APP2, ui::EF_CONTROL_DOWN, CYCLE_DISPLAY_MODE }, + { true, ui::VKEY_MEDIA_LAUNCH_APP2, ui::EF_CONTROL_DOWN, TOGGLE_MIRROR_MODE }, { true, ui::VKEY_MEDIA_LAUNCH_APP2, ui::EF_ALT_DOWN, SWAP_PRIMARY_DISPLAY }, // Cycle windows button. { true, ui::VKEY_MEDIA_LAUNCH_APP1, ui::EF_CONTROL_DOWN, TAKE_SCREENSHOT }, @@ -186,6 +186,8 @@ const AcceleratorData kDesktopAcceleratorData[] = { { true, ui::VKEY_L, ui::EF_ALT_DOWN, LOCK_SCREEN }, { true, ui::VKEY_POWER, ui::EF_SHIFT_DOWN, LOCK_PRESSED }, { false, ui::VKEY_POWER, ui::EF_SHIFT_DOWN, LOCK_RELEASED }, + { true, ui::VKEY_D, ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN, + ADD_REMOVE_DISPLAY }, #endif // Extra shortcut for display swaping as alt-f4 is taken on linux desktop. { true, ui::VKEY_S, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN, @@ -264,8 +266,9 @@ const AcceleratorAction kActionsAllowedAtLoginOrLockScreen[] = { VOLUME_MUTE, VOLUME_UP, #if defined(OS_CHROMEOS) - CYCLE_DISPLAY_MODE, + ADD_REMOVE_DISPLAY, DISABLE_GPU_WATCHDOG, + TOGGLE_MIRROR_MODE, #endif #if defined(OS_CHROMEOS) && !defined(NDEBUG) POWER_PRESSED, @@ -315,8 +318,11 @@ const AcceleratorAction kActionsAllowedAtModalWindow[] = { VOLUME_MUTE, VOLUME_UP, #if defined(OS_CHROMEOS) - CYCLE_DISPLAY_MODE, +#if !defined(NDEBUG) + ADD_REMOVE_DISPLAY, +#endif LOCK_SCREEN, + TOGGLE_MIRROR_MODE, #endif }; @@ -382,8 +388,9 @@ const AcceleratorAction kActionsAllowedInAppMode[] = { VOLUME_MUTE, VOLUME_UP, #if defined(OS_CHROMEOS) - CYCLE_DISPLAY_MODE, + ADD_REMOVE_DISPLAY, DISABLE_GPU_WATCHDOG, + TOGGLE_MIRROR_MODE, #endif // defined(OS_CHROMEOS) }; diff --git a/ash/accelerators/accelerator_table.h b/ash/accelerators/accelerator_table.h index 70e57d8d..ee635f4 100644 --- a/ash/accelerators/accelerator_table.h +++ b/ash/accelerators/accelerator_table.h @@ -98,7 +98,8 @@ enum AcceleratorAction { WINDOW_SNAP_LEFT, WINDOW_SNAP_RIGHT, #if defined(OS_CHROMEOS) - CYCLE_DISPLAY_MODE, + ADD_REMOVE_DISPLAY, + TOGGLE_MIRROR_MODE, DISABLE_GPU_WATCHDOG, LOCK_SCREEN, OPEN_CROSH, |