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

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

Issue 267743010: Suppressed screen rotation notifications triggeres by the accelerometer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated to not add display notifications when screen rotations are being changed by the MaximizeMod… 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 61ce2f2205611a724a838ebb705b713a088f2055..6336a3d2c1b76905e0b33ec04516859c70765aa9 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,21 @@ 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) {
+ // Suppress message centre notifications for screen rotations caused
flackr 2014/05/14 20:12:41 This isn't actually suppressing the notifications,
bruthig 2014/05/14 21:07:35 Done.
+ // by accelerometer events because it should be obvious why the orientation
+ // changed.
+ base::AutoReset<bool> auto_in_set_screen_rotation(
+ &in_set_screen_rotation_, true);
+ display_manager->SetDisplayRotation(gfx::Display::InternalDisplayId(),
+ rotation);
+}
+
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698