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

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: Fixed maximize_mode_controller to use it's own SetDisplayRotation method. 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..3a86c16434eabc4bb98ce19fe9d93244cce61e5a 100644
--- a/ash/wm/maximize_mode/maximize_mode_controller.cc
+++ b/ash/wm/maximize_mode/maximize_mode_controller.cc
@@ -132,7 +132,8 @@ void ScreenshotActionHandler::OnKeyEvent(ui::KeyEvent* event) {
MaximizeModeController::MaximizeModeController()
: rotation_locked_(false),
- have_seen_accelerometer_data_(false) {
+ have_seen_accelerometer_data_(false),
+ show_display_notifications_(true) {
Shell::GetInstance()->accelerometer_controller()->AddObserver(this);
}
@@ -235,8 +236,9 @@ 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::InternalDisplayId(),
+ gfx::Display::ROTATE_0);
}
rotation_locked_ = false;
return;
@@ -294,9 +296,22 @@ 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,
+ gfx::Display::InternalDisplayId(),
+ new_rotation);
}
}
+void MaximizeModeController::SetDisplayRotation(
+ DisplayManager* display_manager,
+ int64 display_id,
jonross 2014/05/14 01:00:39 We only ever operate on the internal display, this
bruthig 2014/05/14 18:48:49 Done.
+ gfx::Display::Rotation rotation) {
+ // Suppress message centre notifications for screen rotations caused
+ // by accelerometer events because it should be obvious why the orientation
+ // changed.
+ show_display_notifications_ = false;
flackr 2014/05/14 01:48:33 nit: Use base::AutoReset.
bruthig 2014/05/14 18:48:49 Done.
+ display_manager->SetDisplayRotation(display_id, rotation);
+ show_display_notifications_ = true;
+}
+
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698