| 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 61ce2f2205611a724a838ebb705b713a088f2055..a969a91a07eca81e03746771c5cca4be2365de9f 100644
|
| --- a/ash/wm/maximize_mode/maximize_mode_controller.cc
|
| +++ b/ash/wm/maximize_mode/maximize_mode_controller.cc
|
| @@ -11,6 +11,7 @@
|
| #include "ash/display/display_manager.h"
|
| #include "ash/shell.h"
|
| #include "ash/wm/maximize_mode/maximize_mode_event_blocker.h"
|
| +#include "base/auto_reset.h"
|
| #include "base/command_line.h"
|
| #include "ui/base/accelerators/accelerator.h"
|
| #include "ui/events/event.h"
|
| @@ -132,7 +133,8 @@ void ScreenshotActionHandler::OnKeyEvent(ui::KeyEvent* event) {
|
|
|
| MaximizeModeController::MaximizeModeController()
|
| : rotation_locked_(false),
|
| - have_seen_accelerometer_data_(false) {
|
| + have_seen_accelerometer_data_(false),
|
| + in_set_screen_rotation_(false) {
|
| Shell::GetInstance()->accelerometer_controller()->AddObserver(this);
|
| }
|
|
|
| @@ -235,8 +237,8 @@ void MaximizeModeController::HandleScreenRotation(const gfx::Vector3dF& lid) {
|
| // 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);
|
| + SetDisplayRotation(display_manager,
|
| + gfx::Display::ROTATE_0);
|
| }
|
| rotation_locked_ = false;
|
| return;
|
| @@ -294,9 +296,18 @@ void MaximizeModeController::HandleScreenRotation(const gfx::Vector3dF& lid) {
|
| // match screen orientation.
|
| if (new_rotation == gfx::Display::ROTATE_0 ||
|
| maximize_mode_engaged) {
|
| - display_manager->SetDisplayRotation(gfx::Display::InternalDisplayId(),
|
| - new_rotation);
|
| + SetDisplayRotation(display_manager,
|
| + new_rotation);
|
| }
|
| }
|
|
|
| +void MaximizeModeController::SetDisplayRotation(
|
| + DisplayManager* display_manager,
|
| + gfx::Display::Rotation rotation) {
|
| + base::AutoReset<bool> auto_in_set_screen_rotation(
|
| + &in_set_screen_rotation_, true);
|
| + display_manager->SetDisplayRotation(gfx::Display::InternalDisplayId(),
|
| + rotation);
|
| +}
|
| +
|
| } // namespace ash
|
|
|