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

Unified Diff: ash/wm/maximize_mode/maximize_mode_controller.cc

Issue 261163004: Lock Rotation when screen is manually rotated (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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/wm/maximize_mode/maximize_mode_controller.cc
diff --git a/ash/wm/maximize_mode/maximize_mode_controller.cc b/ash/wm/maximize_mode/maximize_mode_controller.cc
index 0b9ee53b06e85477423adfcb9065b2fec5f046e2..a6421d6d9566c3b23b350e5f337ff2d226a9bbce 100644
--- a/ash/wm/maximize_mode/maximize_mode_controller.cc
+++ b/ash/wm/maximize_mode/maximize_mode_controller.cc
@@ -138,13 +138,24 @@ void MaximizeModeController::HandleHingeRotation(const gfx::Vector3dF& base,
// TODO(flackr): Make MaximizeModeController own the MaximizeModeWindowManager
// such that observations of state changes occur after the change and shell
// has fewer states to track.
+ DisplayManager* display_manager =
+ Shell::GetInstance()->display_manager();
+ gfx::Display::Rotation current_rotation = display_manager->GetDisplayInfo(
+ gfx::Display::InternalDisplayId()).rotation();
+
if (maximize_mode_engaged &&
angle > kFullyOpenAngleErrorTolerance &&
angle < kExitMaximizeModeAngle) {
+ if (!rotation_locked_ && current_rotation != gfx::Display::ROTATE_0) {
+ display_manager->SetDisplayRotation(gfx::Display::InternalDisplayId(),
+ gfx::Display::ROTATE_0);
+ }
+ rotation_locked_ = false;
flackr 2014/05/05 20:53:56 What if we don't reset the rotation lock on exitin
jonross 2014/05/06 15:07:54 Done.
Shell::GetInstance()->EnableMaximizeModeWindowManager(false);
event_blocker_.reset();
} else if (!maximize_mode_engaged &&
angle > kEnterMaximizeModeAngle) {
+ rotation_locked_ = current_rotation != gfx::Display::ROTATE_0;
flackr 2014/05/05 20:53:56 This seems like a good heuristic for manual extern
jonross 2014/05/06 15:07:54 Filed: https://code.google.com/p/chromium/issues/d
Shell::GetInstance()->EnableMaximizeModeWindowManager(true);
event_blocker_.reset(new MaximizeModeEventBlocker);
}
@@ -154,31 +165,14 @@ void MaximizeModeController::HandleScreenRotation(const gfx::Vector3dF& lid) {
bool maximize_mode_engaged =
Shell::GetInstance()->IsMaximizeModeWindowManagerEnabled();
+ if (!maximize_mode_engaged || rotation_locked_)
+ return;
+
DisplayManager* display_manager =
Shell::GetInstance()->display_manager();
gfx::Display::Rotation current_rotation = display_manager->GetDisplayInfo(
gfx::Display::InternalDisplayId()).rotation();
- // If maximize mode is not engaged, ensure the screen is not rotated and
- // do not rotate to match the current device orientation.
- if (!maximize_mode_engaged) {
- if (current_rotation != gfx::Display::ROTATE_0) {
- // TODO(flackr): Currently this will prevent setting a manual rotation on
- // the screen of a device with an accelerometer, this should only set it
- // back to ROTATE_0 if it was last set by the accelerometer.
- // Also, SetDisplayRotation will save the setting to the local store,
- // this should be stored in a way that we can distinguish what the
- // rotation was set by.
- display_manager->SetDisplayRotation(gfx::Display::InternalDisplayId(),
- gfx::Display::ROTATE_0);
- }
- rotation_locked_ = false;
- return;
- }
-
- if (rotation_locked_)
- return;
-
// After determining maximize mode state, determine if the screen should
// be rotated.
gfx::Vector3dF lid_flattened(lid.x(), lid.y(), 0.0f);

Powered by Google App Engine
This is Rietveld 408576698