| Index: ash/display/screen_orientation_controller_chromeos.cc
|
| diff --git a/ash/display/screen_orientation_controller_chromeos.cc b/ash/display/screen_orientation_controller_chromeos.cc
|
| index 973f1551ff5ff9ee69c0b96bb641b3e2c12fe5ba..e6cd60723bad7f03d2c115c2f4f4478af562404c 100644
|
| --- a/ash/display/screen_orientation_controller_chromeos.cc
|
| +++ b/ash/display/screen_orientation_controller_chromeos.cc
|
| @@ -17,7 +17,7 @@
|
| #include "ui/aura/window.h"
|
| #include "ui/aura/window_observer.h"
|
| #include "ui/chromeos/accelerometer/accelerometer_util.h"
|
| -#include "ui/gfx/display.h"
|
| +#include "ui/display/display.h"
|
| #include "ui/gfx/geometry/size.h"
|
| #include "ui/wm/public/activation_client.h"
|
|
|
| @@ -35,21 +35,21 @@ const float kDisplayRotationStickyAngleDegrees = 60.0f;
|
| const float kMinimumAccelerationScreenRotation = 4.2f;
|
|
|
| blink::WebScreenOrientationLockType GetDisplayNaturalOrientation() {
|
| - if (!gfx::Display::HasInternalDisplay())
|
| + if (!display::Display::HasInternalDisplay())
|
| return blink::WebScreenOrientationLockLandscape;
|
|
|
| ash::DisplayInfo info =
|
| ash::Shell::GetInstance()->display_manager()->GetDisplayInfo(
|
| - gfx::Display::InternalDisplayId());
|
| + display::Display::InternalDisplayId());
|
| gfx::Size size = info.size_in_pixel();
|
| switch (info.GetActiveRotation()) {
|
| - case gfx::Display::ROTATE_0:
|
| - case gfx::Display::ROTATE_180:
|
| + case display::Display::ROTATE_0:
|
| + case display::Display::ROTATE_180:
|
| return size.height() >= size.width()
|
| ? blink::WebScreenOrientationLockPortrait
|
| : blink::WebScreenOrientationLockLandscape;
|
| - case gfx::Display::ROTATE_90:
|
| - case gfx::Display::ROTATE_270:
|
| + case display::Display::ROTATE_90:
|
| + case display::Display::ROTATE_270:
|
| return size.height() < size.width()
|
| ? blink::WebScreenOrientationLockPortrait
|
| : blink::WebScreenOrientationLockLandscape;
|
| @@ -67,8 +67,8 @@ ScreenOrientationController::ScreenOrientationController()
|
| ignore_display_configuration_updates_(false),
|
| rotation_locked_(false),
|
| rotation_locked_orientation_(blink::WebScreenOrientationLockAny),
|
| - user_rotation_(gfx::Display::ROTATE_0),
|
| - current_rotation_(gfx::Display::ROTATE_0) {
|
| + user_rotation_(display::Display::ROTATE_0),
|
| + current_rotation_(display::Display::ROTATE_0) {
|
| Shell::GetInstance()->AddShellObserver(this);
|
| }
|
|
|
| @@ -127,7 +127,7 @@ void ScreenOrientationController::SetRotationLocked(bool rotation_locked) {
|
| rotation_locked_orientation_ = blink::WebScreenOrientationLockAny;
|
| FOR_EACH_OBSERVER(Observer, observers_,
|
| OnRotationLockChanged(rotation_locked_));
|
| - if (!gfx::Display::HasInternalDisplay())
|
| + if (!display::Display::HasInternalDisplay())
|
| return;
|
| base::AutoReset<bool> auto_ignore_display_configuration_updates(
|
| &ignore_display_configuration_updates_, true);
|
| @@ -136,16 +136,16 @@ void ScreenOrientationController::SetRotationLocked(bool rotation_locked) {
|
| }
|
|
|
| void ScreenOrientationController::SetDisplayRotation(
|
| - gfx::Display::Rotation rotation,
|
| - gfx::Display::RotationSource source) {
|
| - if (!gfx::Display::HasInternalDisplay())
|
| + display::Display::Rotation rotation,
|
| + display::Display::RotationSource source) {
|
| + if (!display::Display::HasInternalDisplay())
|
| return;
|
| current_rotation_ = rotation;
|
| base::AutoReset<bool> auto_ignore_display_configuration_updates(
|
| &ignore_display_configuration_updates_, true);
|
|
|
| Shell::GetInstance()->display_configuration_controller()->SetDisplayRotation(
|
| - gfx::Display::InternalDisplayId(), rotation, source,
|
| + display::Display::InternalDisplayId(), rotation, source,
|
| true /* user_action */);
|
| }
|
|
|
| @@ -192,11 +192,11 @@ void ScreenOrientationController::OnAccelerometerUpdated(
|
| void ScreenOrientationController::OnDisplayConfigurationChanged() {
|
| if (ignore_display_configuration_updates_)
|
| return;
|
| - if (!gfx::Display::HasInternalDisplay())
|
| + if (!display::Display::HasInternalDisplay())
|
| return;
|
| DisplayManager* display_manager = Shell::GetInstance()->display_manager();
|
| - gfx::Display::Rotation user_rotation =
|
| - display_manager->GetDisplayInfo(gfx::Display::InternalDisplayId())
|
| + display::Display::Rotation user_rotation =
|
| + display_manager->GetDisplayInfo(display::Display::InternalDisplayId())
|
| .GetActiveRotation();
|
| if (user_rotation != current_rotation_) {
|
| // A user may change other display configuration settings. When the user
|
| @@ -211,11 +211,11 @@ void ScreenOrientationController::OnMaximizeModeStarted() {
|
| // Do not exit early, as the internal display can be determined after Maximize
|
| // Mode has started. (chrome-os-partner:38796)
|
| // Always start observing.
|
| - if (gfx::Display::HasInternalDisplay()) {
|
| + if (display::Display::HasInternalDisplay()) {
|
| current_rotation_ = user_rotation_ =
|
| Shell::GetInstance()
|
| ->display_manager()
|
| - ->GetDisplayInfo(gfx::Display::InternalDisplayId())
|
| + ->GetDisplayInfo(display::Display::InternalDisplayId())
|
| .GetActiveRotation();
|
| }
|
| if (!rotation_locked_)
|
| @@ -228,12 +228,12 @@ void ScreenOrientationController::OnMaximizeModeEnded() {
|
| chromeos::AccelerometerReader::GetInstance()->RemoveObserver(this);
|
| Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this);
|
| if (current_rotation_ != user_rotation_)
|
| - SetDisplayRotation(user_rotation_, gfx::Display::ROTATION_SOURCE_USER);
|
| + SetDisplayRotation(user_rotation_, display::Display::ROTATION_SOURCE_USER);
|
| }
|
|
|
| void ScreenOrientationController::LockRotation(
|
| - gfx::Display::Rotation rotation,
|
| - gfx::Display::RotationSource source) {
|
| + display::Display::Rotation rotation,
|
| + display::Display::RotationSource source) {
|
| SetRotationLocked(true);
|
| SetDisplayRotation(rotation, source);
|
| }
|
| @@ -268,8 +268,8 @@ void ScreenOrientationController::LockRotationToOrientation(
|
| blink::WebScreenOrientationLockLandscape);
|
| break;
|
| case blink::WebScreenOrientationLockNatural:
|
| - LockRotation(gfx::Display::ROTATE_0,
|
| - gfx::Display::ROTATION_SOURCE_ACTIVE);
|
| + LockRotation(display::Display::ROTATE_0,
|
| + display::Display::ROTATION_SOURCE_ACTIVE);
|
| break;
|
| default:
|
| NOTREACHED();
|
| @@ -280,43 +280,43 @@ void ScreenOrientationController::LockRotationToOrientation(
|
| void ScreenOrientationController::LockRotationToPrimaryOrientation(
|
| blink::WebScreenOrientationLockType lock_orientation) {
|
| LockRotation(natural_orientation_ == lock_orientation
|
| - ? gfx::Display::ROTATE_0
|
| - : gfx::Display::ROTATE_90,
|
| - gfx::Display::ROTATION_SOURCE_ACTIVE);
|
| + ? display::Display::ROTATE_0
|
| + : display::Display::ROTATE_90,
|
| + display::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::ROTATION_SOURCE_ACTIVE);
|
| + ? display::Display::ROTATE_180
|
| + : display::Display::ROTATE_270,
|
| + display::Display::ROTATION_SOURCE_ACTIVE);
|
| }
|
|
|
| void ScreenOrientationController::LockToRotationMatchingOrientation(
|
| blink::WebScreenOrientationLockType lock_orientation) {
|
| - if (!gfx::Display::HasInternalDisplay())
|
| + if (!display::Display::HasInternalDisplay())
|
| return;
|
|
|
| DisplayManager* display_manager = Shell::GetInstance()->display_manager();
|
| - gfx::Display::Rotation rotation =
|
| - display_manager->GetDisplayInfo(gfx::Display::InternalDisplayId())
|
| + display::Display::Rotation rotation =
|
| + display_manager->GetDisplayInfo(display::Display::InternalDisplayId())
|
| .GetActiveRotation();
|
| if (natural_orientation_ == lock_orientation) {
|
| - if (rotation == gfx::Display::ROTATE_0 ||
|
| - rotation == gfx::Display::ROTATE_180) {
|
| + if (rotation == display::Display::ROTATE_0 ||
|
| + rotation == display::Display::ROTATE_180) {
|
| SetRotationLocked(true);
|
| } else {
|
| - LockRotation(gfx::Display::ROTATE_0,
|
| - gfx::Display::ROTATION_SOURCE_ACTIVE);
|
| + LockRotation(display::Display::ROTATE_0,
|
| + display::Display::ROTATION_SOURCE_ACTIVE);
|
| }
|
| } else {
|
| - if (rotation == gfx::Display::ROTATE_90 ||
|
| - rotation == gfx::Display::ROTATE_270) {
|
| + if (rotation == display::Display::ROTATE_90 ||
|
| + rotation == display::Display::ROTATE_270) {
|
| SetRotationLocked(true);
|
| } else {
|
| - LockRotation(gfx::Display::ROTATE_90,
|
| - gfx::Display::ROTATION_SOURCE_ACTIVE);
|
| + LockRotation(display::Display::ROTATE_90,
|
| + display::Display::ROTATION_SOURCE_ACTIVE);
|
| }
|
| }
|
| }
|
| @@ -340,11 +340,11 @@ void ScreenOrientationController::HandleScreenRotation(
|
| // user must overcome to rotate the display and prevents frequent rotations
|
| // when holding the device near 45 degrees.
|
| gfx::Vector3dF down(0.0f, 0.0f, 0.0f);
|
| - if (current_rotation_ == gfx::Display::ROTATE_0)
|
| + if (current_rotation_ == display::Display::ROTATE_0)
|
| down.set_y(1.0f);
|
| - else if (current_rotation_ == gfx::Display::ROTATE_90)
|
| + else if (current_rotation_ == display::Display::ROTATE_90)
|
| down.set_x(1.0f);
|
| - else if (current_rotation_ == gfx::Display::ROTATE_180)
|
| + else if (current_rotation_ == display::Display::ROTATE_180)
|
| down.set_y(-1.0f);
|
| else
|
| down.set_x(-1.0f);
|
| @@ -358,18 +358,18 @@ void ScreenOrientationController::HandleScreenRotation(
|
| float angle = gfx::ClockwiseAngleBetweenVectorsInDegrees(
|
| rotation_reference, lid_flattened, gfx::Vector3dF(0.0f, 0.0f, 1.0f));
|
|
|
| - gfx::Display::Rotation new_rotation = gfx::Display::ROTATE_270;
|
| + display::Display::Rotation new_rotation = display::Display::ROTATE_270;
|
| if (angle < 90.0f)
|
| - new_rotation = gfx::Display::ROTATE_0;
|
| + new_rotation = display::Display::ROTATE_0;
|
| else if (angle < 180.0f)
|
| - new_rotation = gfx::Display::ROTATE_90;
|
| + new_rotation = display::Display::ROTATE_90;
|
| else if (angle < 270.0f)
|
| - new_rotation = gfx::Display::ROTATE_180;
|
| + new_rotation = display::Display::ROTATE_180;
|
|
|
| if (new_rotation != current_rotation_ &&
|
| IsRotationAllowedInLockedState(new_rotation)) {
|
| SetDisplayRotation(new_rotation,
|
| - gfx::Display::ROTATION_SOURCE_ACCELEROMETER);
|
| + display::Display::ROTATION_SOURCE_ACCELEROMETER);
|
| }
|
| }
|
|
|
| @@ -378,7 +378,7 @@ void ScreenOrientationController::LoadDisplayRotationProperties() {
|
| if (!display_manager->registered_internal_display_rotation_lock())
|
| return;
|
| SetDisplayRotation(display_manager->registered_internal_display_rotation(),
|
| - gfx::Display::ROTATION_SOURCE_ACCELEROMETER);
|
| + display::Display::ROTATION_SOURCE_ACCELEROMETER);
|
| SetRotationLocked(true);
|
| }
|
|
|
| @@ -396,7 +396,7 @@ void ScreenOrientationController::ApplyLockForActiveWindow() {
|
| }
|
|
|
| bool ScreenOrientationController::IsRotationAllowedInLockedState(
|
| - gfx::Display::Rotation rotation) {
|
| + display::Display::Rotation rotation) {
|
| if (!rotation_locked_)
|
| return true;
|
|
|
| @@ -404,11 +404,11 @@ bool ScreenOrientationController::IsRotationAllowedInLockedState(
|
| return false;
|
|
|
| if (natural_orientation_ == rotation_locked_orientation_) {
|
| - return rotation == gfx::Display::ROTATE_0 ||
|
| - rotation == gfx::Display::ROTATE_180;
|
| + return rotation == display::Display::ROTATE_0 ||
|
| + rotation == display::Display::ROTATE_180;
|
| } else {
|
| - return rotation == gfx::Display::ROTATE_90 ||
|
| - rotation == gfx::Display::ROTATE_270;
|
| + return rotation == display::Display::ROTATE_90 ||
|
| + rotation == display::Display::ROTATE_270;
|
| }
|
| return false;
|
| }
|
|
|