Index: ash/accelerators/accelerator_controller.cc |
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc |
index 25fde9c36bfe09aa2b58c0fb5bcdbf70dc8a99f6..cc4edc52e59ddcc637618e44ad3c4a610832d001 100644 |
--- a/ash/accelerators/accelerator_controller.cc |
+++ b/ash/accelerators/accelerator_controller.cc |
@@ -25,6 +25,7 @@ |
#include "ash/root_window_controller.h" |
#include "ash/rotator/screen_rotation_animator.h" |
#include "ash/rotator/window_rotation.h" |
+#include "ash/screen_util.h" |
#include "ash/screenshot_delegate.h" |
#include "ash/session/session_state_delegate.h" |
#include "ash/shelf/shelf.h" |
@@ -75,6 +76,7 @@ |
#include "ui/views/controls/webview/webview.h" |
#if defined(OS_CHROMEOS) |
+#include "ash/display/display_configuration_controller.h" |
#include "ash/system/chromeos/keyboard_brightness_controller.h" |
#include "base/sys_info.h" |
#include "ui/base/ime/chromeos/ime_keyboard.h" |
@@ -635,7 +637,17 @@ void HandleSilenceSpokenFeedback() { |
void HandleSwapPrimaryDisplay() { |
base::RecordAction(UserMetricsAction("Accel_Swap_Primary_Display")); |
+#if defined(OS_CHROMEOS) |
oshima
2016/01/19 18:49:16
I think you don't have to worry about other platfo
stevenjb
2016/01/19 20:32:04
Currently display_configuration_controller() only
oshima
2016/01/19 20:59:30
ack. hopefully we can remove ifdef soon.
stevenjb
2016/01/20 01:25:36
Actually, I went ahead and fixed this.
|
+ DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
+ if (display_manager->GetNumDisplays() < 2) |
+ return; |
+ Shell::GetInstance()->display_configuration_controller()->SetPrimaryDisplayId( |
+ ScreenUtil::GetSecondaryDisplay().id(), true /* user_action */); |
+#else |
+ // On non Chrome OS platforms this will swap the display immediately with |
+ // no animation or frequencey limiter. |
Shell::GetInstance()->window_tree_host_manager()->SwapPrimaryDisplay(); |
+#endif |
} |
bool CanHandleCycleUser() { |
@@ -684,7 +696,15 @@ void HandleToggleCapsLock() { |
void HandleToggleMirrorMode() { |
base::RecordAction(UserMetricsAction("Accel_Toggle_Mirror_Mode")); |
+ bool mirror = !Shell::GetInstance()->display_manager()->IsInMirrorMode(); |
+#if defined(OS_CHROMEOS) |
+ Shell::GetInstance()->display_configuration_controller()->SetMirrorMode( |
+ mirror, true /* user_action */); |
+#else |
+ // On non Chrome OS platforms this toggle mirror mode immediately with |
+ // no animation or frequencey limiter. |
Shell::GetInstance()->window_tree_host_manager()->ToggleMirrorMode(); |
+#endif |
} |
void HandleToggleSpokenFeedback() { |