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 dbd44652a2e6b39e6463ddcf4ada549c79e477db..859c6f8f9ed818bbb9b05ffac8d131e3ed679020 100644 |
--- a/ash/content/display/screen_orientation_controller_chromeos.cc |
+++ b/ash/content/display/screen_orientation_controller_chromeos.cc |
@@ -45,7 +45,7 @@ blink::WebScreenOrientationLockType GetDisplayNaturalOrientation() { |
ash::DisplayInfo info = |
display_manager->GetDisplayInfo(gfx::Display::InternalDisplayId()); |
gfx::Size size = info.size_in_pixel(); |
- switch (info.rotation()) { |
+ switch (info.GetActiveRotation()) { |
case gfx::Display::ROTATE_0: |
case gfx::Display::ROTATE_180: |
return size.height() >= size.width() |
@@ -112,7 +112,8 @@ void ScreenOrientationController::SetRotationLocked(bool rotation_locked) { |
} |
void ScreenOrientationController::SetDisplayRotation( |
- gfx::Display::Rotation rotation) { |
+ gfx::Display::Rotation rotation, |
+ gfx::Display::RotationSource source) { |
DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
if (!display_manager->HasInternalDisplay()) |
return; |
@@ -120,7 +121,7 @@ void ScreenOrientationController::SetDisplayRotation( |
base::AutoReset<bool> auto_ignore_display_configuration_updates( |
&ignore_display_configuration_updates_, true); |
ash::ScreenRotationAnimator(gfx::Display::InternalDisplayId()) |
- .Rotate(rotation); |
+ .Rotate(rotation, source); |
} |
void ScreenOrientationController::OnWindowActivated(aura::Window* gained_active, |
@@ -201,7 +202,7 @@ void ScreenOrientationController::OnDisplayConfigurationChanged() { |
return; |
gfx::Display::Rotation user_rotation = |
display_manager->GetDisplayInfo(gfx::Display::InternalDisplayId()) |
- .rotation(); |
+ .GetActiveRotation(); |
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 |
@@ -219,7 +220,7 @@ void ScreenOrientationController::OnMaximizeModeStarted() { |
if (display_manager->HasInternalDisplay()) { |
current_rotation_ = user_rotation_ = |
display_manager->GetDisplayInfo(gfx::Display::InternalDisplayId()) |
- .rotation(); |
+ .GetActiveRotation(); |
} |
if (!rotation_locked_) |
LoadDisplayRotationProperties(); |
@@ -231,13 +232,14 @@ void ScreenOrientationController::OnMaximizeModeEnded() { |
chromeos::AccelerometerReader::GetInstance()->RemoveObserver(this); |
Shell::GetInstance()->display_controller()->RemoveObserver(this); |
if (current_rotation_ != user_rotation_) |
- SetDisplayRotation(user_rotation_); |
+ SetDisplayRotation(user_rotation_, gfx::Display::ROTATION_SOURCE_USER); |
} |
void ScreenOrientationController::LockRotation( |
- gfx::Display::Rotation rotation) { |
+ gfx::Display::Rotation rotation, |
+ gfx::Display::RotationSource source) { |
SetRotationLocked(true); |
- SetDisplayRotation(rotation); |
+ SetDisplayRotation(rotation, source); |
} |
void ScreenOrientationController::LockRotationToOrientation( |
@@ -270,7 +272,8 @@ void ScreenOrientationController::LockRotationToOrientation( |
blink::WebScreenOrientationLockLandscape); |
break; |
case blink::WebScreenOrientationLockNatural: |
- LockRotation(gfx::Display::ROTATE_0); |
+ LockRotation(gfx::Display::ROTATE_0, |
+ gfx::Display::ROTATION_SOURCE_ACTIVE); |
break; |
default: |
NOTREACHED(); |
@@ -282,14 +285,16 @@ void ScreenOrientationController::LockRotationToPrimaryOrientation( |
blink::WebScreenOrientationLockType lock_orientation) { |
LockRotation(natural_orientation_ == lock_orientation |
? gfx::Display::ROTATE_0 |
- : gfx::Display::ROTATE_90); |
+ : gfx::Display::ROTATE_90, |
+ gfx::Display::ROTATION_SOURCE_ACTIVE); |
} |
void ScreenOrientationController::LockRotationToSecondaryOrientation( |
blink::WebScreenOrientationLockType lock_orientation) { |
LockRotation(natural_orientation_ == lock_orientation |
? gfx::Display::ROTATE_180 |
- : gfx::Display::ROTATE_270); |
+ : gfx::Display::ROTATE_270, |
+ gfx::Display::ROTATION_SOURCE_ACTIVE); |
} |
void ScreenOrientationController::LockToRotationMatchingOrientation( |
@@ -300,20 +305,22 @@ void ScreenOrientationController::LockToRotationMatchingOrientation( |
gfx::Display::Rotation rotation = |
display_manager->GetDisplayInfo(gfx::Display::InternalDisplayId()) |
- .rotation(); |
+ .GetActiveRotation(); |
if (natural_orientation_ == lock_orientation) { |
if (rotation == gfx::Display::ROTATE_0 || |
rotation == gfx::Display::ROTATE_180) { |
SetRotationLocked(true); |
} else { |
- LockRotation(gfx::Display::ROTATE_0); |
+ LockRotation(gfx::Display::ROTATE_0, |
+ gfx::Display::ROTATION_SOURCE_ACTIVE); |
} |
} else { |
if (rotation == gfx::Display::ROTATE_90 || |
rotation == gfx::Display::ROTATE_270) { |
SetRotationLocked(true); |
} else { |
- LockRotation(gfx::Display::ROTATE_90); |
+ LockRotation(gfx::Display::ROTATE_90, |
+ gfx::Display::ROTATION_SOURCE_ACTIVE); |
} |
} |
} |
@@ -365,14 +372,16 @@ void ScreenOrientationController::HandleScreenRotation( |
if (new_rotation != current_rotation_ && |
IsRotationAllowedInLockedState(new_rotation)) |
- SetDisplayRotation(new_rotation); |
+ SetDisplayRotation(new_rotation, |
+ gfx::Display::ROTATION_SOURCE_ACCELEROMETER); |
} |
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()); |
+ SetDisplayRotation(display_manager->registered_internal_display_rotation(), |
+ gfx::Display::ROTATION_SOURCE_ACCELEROMETER); |
SetRotationLocked(true); |
} |