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

Unified Diff: ash/content/display/screen_orientation_controller_chromeos.cc

Issue 1108343002: Revert of Merge Prevent DisplayPreferences from saving incorrect rotations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2357
Patch Set: Created 5 years, 8 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/content/display/screen_orientation_controller_chromeos.cc
diff --git a/ash/content/display/screen_orientation_controller_chromeos.cc b/ash/content/display/screen_orientation_controller_chromeos.cc
index 859c6f8f9ed818bbb9b05ffac8d131e3ed679020..dbd44652a2e6b39e6463ddcf4ada549c79e477db 100644
--- a/ash/content/display/screen_orientation_controller_chromeos.cc
+++ b/ash/content/display/screen_orientation_controller_chromeos.cc
@@ -45,7 +45,7 @@
ash::DisplayInfo info =
display_manager->GetDisplayInfo(gfx::Display::InternalDisplayId());
gfx::Size size = info.size_in_pixel();
- switch (info.GetActiveRotation()) {
+ switch (info.rotation()) {
case gfx::Display::ROTATE_0:
case gfx::Display::ROTATE_180:
return size.height() >= size.width()
@@ -112,8 +112,7 @@
}
void ScreenOrientationController::SetDisplayRotation(
- gfx::Display::Rotation rotation,
- gfx::Display::RotationSource source) {
+ gfx::Display::Rotation rotation) {
DisplayManager* display_manager = Shell::GetInstance()->display_manager();
if (!display_manager->HasInternalDisplay())
return;
@@ -121,7 +120,7 @@
base::AutoReset<bool> auto_ignore_display_configuration_updates(
&ignore_display_configuration_updates_, true);
ash::ScreenRotationAnimator(gfx::Display::InternalDisplayId())
- .Rotate(rotation, source);
+ .Rotate(rotation);
}
void ScreenOrientationController::OnWindowActivated(aura::Window* gained_active,
@@ -202,7 +201,7 @@
return;
gfx::Display::Rotation user_rotation =
display_manager->GetDisplayInfo(gfx::Display::InternalDisplayId())
- .GetActiveRotation();
+ .rotation();
if (user_rotation != current_rotation_) {
// A user may change other display configuration settings. When the user
// does change the rotation setting, then lock rotation to prevent the
@@ -220,7 +219,7 @@
if (display_manager->HasInternalDisplay()) {
current_rotation_ = user_rotation_ =
display_manager->GetDisplayInfo(gfx::Display::InternalDisplayId())
- .GetActiveRotation();
+ .rotation();
}
if (!rotation_locked_)
LoadDisplayRotationProperties();
@@ -232,14 +231,13 @@
chromeos::AccelerometerReader::GetInstance()->RemoveObserver(this);
Shell::GetInstance()->display_controller()->RemoveObserver(this);
if (current_rotation_ != user_rotation_)
- SetDisplayRotation(user_rotation_, gfx::Display::ROTATION_SOURCE_USER);
+ SetDisplayRotation(user_rotation_);
}
void ScreenOrientationController::LockRotation(
- gfx::Display::Rotation rotation,
- gfx::Display::RotationSource source) {
+ gfx::Display::Rotation rotation) {
SetRotationLocked(true);
- SetDisplayRotation(rotation, source);
+ SetDisplayRotation(rotation);
}
void ScreenOrientationController::LockRotationToOrientation(
@@ -272,8 +270,7 @@
blink::WebScreenOrientationLockLandscape);
break;
case blink::WebScreenOrientationLockNatural:
- LockRotation(gfx::Display::ROTATE_0,
- gfx::Display::ROTATION_SOURCE_ACTIVE);
+ LockRotation(gfx::Display::ROTATE_0);
break;
default:
NOTREACHED();
@@ -285,16 +282,14 @@
blink::WebScreenOrientationLockType lock_orientation) {
LockRotation(natural_orientation_ == lock_orientation
? gfx::Display::ROTATE_0
- : gfx::Display::ROTATE_90,
- gfx::Display::ROTATION_SOURCE_ACTIVE);
+ : gfx::Display::ROTATE_90);
}
void ScreenOrientationController::LockRotationToSecondaryOrientation(
blink::WebScreenOrientationLockType lock_orientation) {
LockRotation(natural_orientation_ == lock_orientation
? gfx::Display::ROTATE_180
- : gfx::Display::ROTATE_270,
- gfx::Display::ROTATION_SOURCE_ACTIVE);
+ : gfx::Display::ROTATE_270);
}
void ScreenOrientationController::LockToRotationMatchingOrientation(
@@ -305,22 +300,20 @@
gfx::Display::Rotation rotation =
display_manager->GetDisplayInfo(gfx::Display::InternalDisplayId())
- .GetActiveRotation();
+ .rotation();
if (natural_orientation_ == lock_orientation) {
if (rotation == gfx::Display::ROTATE_0 ||
rotation == gfx::Display::ROTATE_180) {
SetRotationLocked(true);
} else {
- LockRotation(gfx::Display::ROTATE_0,
- gfx::Display::ROTATION_SOURCE_ACTIVE);
+ LockRotation(gfx::Display::ROTATE_0);
}
} else {
if (rotation == gfx::Display::ROTATE_90 ||
rotation == gfx::Display::ROTATE_270) {
SetRotationLocked(true);
} else {
- LockRotation(gfx::Display::ROTATE_90,
- gfx::Display::ROTATION_SOURCE_ACTIVE);
+ LockRotation(gfx::Display::ROTATE_90);
}
}
}
@@ -372,16 +365,14 @@
if (new_rotation != current_rotation_ &&
IsRotationAllowedInLockedState(new_rotation))
- SetDisplayRotation(new_rotation,
- gfx::Display::ROTATION_SOURCE_ACCELEROMETER);
+ SetDisplayRotation(new_rotation);
}
void ScreenOrientationController::LoadDisplayRotationProperties() {
DisplayManager* display_manager = Shell::GetInstance()->display_manager();
if (!display_manager->registered_internal_display_rotation_lock())
return;
- SetDisplayRotation(display_manager->registered_internal_display_rotation(),
- gfx::Display::ROTATION_SOURCE_ACCELEROMETER);
+ SetDisplayRotation(display_manager->registered_internal_display_rotation());
SetRotationLocked(true);
}

Powered by Google App Engine
This is Rietveld 408576698