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 61ce2f2205611a724a838ebb705b713a088f2055..c7f8cd6f45bf28f790b84a939700b501d6613eeb 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,19 @@ 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) { |
| + // Update state so screen rotation notifications can be suppressed. |
|
flackr
2014/05/14 21:13:23
Actually, it's evident from the code what it's doi
bruthig
2014/05/14 21:19:51
Done.
|
| + base::AutoReset<bool> auto_in_set_screen_rotation( |
| + &in_set_screen_rotation_, true); |
| + display_manager->SetDisplayRotation(gfx::Display::InternalDisplayId(), |
| + rotation); |
| +} |
| + |
| } // namespace ash |