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

Unified Diff: ash/accelerators/accelerator_controller.cc

Issue 1594683002: Introduce DisplayConfigurationController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue_576375_display1b1
Patch Set: Rebase Created 4 years, 11 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_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() {
« no previous file with comments | « ash/BUILD.gn ('k') | ash/ash.gyp » ('j') | ash/display/display_configuration_controller.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698