Chromium Code Reviews| 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..78d7a202baa244c465f5fd5908b620f2d5665f00 100644 |
| --- a/ash/wm/maximize_mode/maximize_mode_controller.cc |
| +++ b/ash/wm/maximize_mode/maximize_mode_controller.cc |
| @@ -138,13 +138,27 @@ 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); |
| + } |
| Shell::GetInstance()->EnableMaximizeModeWindowManager(false); |
| event_blocker_.reset(); |
|
oshima
2014/05/06 16:04:10
Would you mind defining MaximizeModeController::En
jonross
2014/05/06 21:49:00
I don't know if we want to do this. By having the
|
| } else if (!maximize_mode_engaged && |
| angle > kEnterMaximizeModeAngle) { |
| + // TODO(jonross): Create a property on the display to track user rotations. |
| + // We should lock based on this property. Furthermore we should apply the |
| + // lock if the user changes the display settings while we are in maximize |
| + // mode. https://code.google.com/p/chromium/issues/detail?id=370443 |
|
flackr
2014/05/06 15:47:25
nit: just use http://crbug.com/370443
jonross
2014/05/06 21:49:00
Done.
|
| + rotation_locked_ = current_rotation != gfx::Display::ROTATE_0; |
| Shell::GetInstance()->EnableMaximizeModeWindowManager(true); |
| event_blocker_.reset(new MaximizeModeEventBlocker); |
| } |
| @@ -154,31 +168,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); |