Index: ash/display/display_info.cc |
diff --git a/ash/display/display_info.cc b/ash/display/display_info.cc |
index 873691de2bee01a0fb6bcdd85b7cc9473b9d52bf..23bf349914ebd77b51941932ffa930d4030a4868 100644 |
--- a/ash/display/display_info.cc |
+++ b/ash/display/display_info.cc |
@@ -156,7 +156,7 @@ DisplayInfo DisplayInfo::CreateFromSpecWithID(const std::string& spec, |
DisplayInfo display_info( |
id, base::StringPrintf("Display-%d", static_cast<int>(id)), has_overscan); |
display_info.set_device_scale_factor(device_scale_factor); |
- display_info.set_rotation(rotation); |
+ display_info.SetRotation(rotation, ui::USER); |
display_info.set_configured_ui_scale(ui_scale); |
display_info.SetBounds(bounds_in_native); |
display_info.set_display_modes(display_modes); |
@@ -177,7 +177,7 @@ DisplayInfo DisplayInfo::CreateFromSpecWithID(const std::string& spec, |
DisplayInfo::DisplayInfo() |
: id_(gfx::Display::kInvalidDisplayID), |
has_overscan_(false), |
- rotation_(gfx::Display::ROTATE_0), |
+ current_rotation_(gfx::Display::ROTATE_0), |
touch_support_(gfx::Display::TOUCH_SUPPORT_UNKNOWN), |
touch_device_id_(0), |
device_scale_factor_(1.0f), |
@@ -193,7 +193,7 @@ DisplayInfo::DisplayInfo(int64 id, |
: id_(id), |
name_(name), |
has_overscan_(has_overscan), |
- rotation_(gfx::Display::ROTATE_0), |
+ current_rotation_(gfx::Display::ROTATE_0), |
touch_support_(gfx::Display::TOUCH_SUPPORT_UNKNOWN), |
touch_device_id_(0), |
device_scale_factor_(1.0f), |
@@ -230,7 +230,8 @@ void DisplayInfo::Copy(const DisplayInfo& native_info) { |
// or unit tests. Don't copy if this native_info came from |
// DisplayChangeObserver. |
if (!native_info.native()) { |
- rotation_ = native_info.rotation_; |
+ current_rotation_ = native_info.current_rotation_; |
+ rotations_ = native_info.rotations_; |
configured_ui_scale_ = native_info.configured_ui_scale_; |
color_profile_ = native_info.color_profile(); |
} |
@@ -248,6 +249,17 @@ void DisplayInfo::SetBounds(const gfx::Rect& new_bounds_in_native) { |
UpdateDisplaySize(); |
} |
+gfx::Display::Rotation DisplayInfo::GetRotation(ui::RotationSource source) { |
+ return rotations_[source]; |
+} |
+ |
+void DisplayInfo::SetRotation(gfx::Display::Rotation rotation, |
+ ui::RotationSource source) { |
+ rotations_[source] = rotation; |
+ current_rotation_ = rotation; |
+} |
+ |
+ |
float DisplayInfo::GetEffectiveDeviceScaleFactor() const { |
if (allow_upgrade_to_high_dpi && configured_ui_scale_ < 1.0f && |
device_scale_factor_ == 1.0f) { |
@@ -278,8 +290,8 @@ void DisplayInfo::UpdateDisplaySize() { |
overscan_insets_in_dip_.Set(0, 0, 0, 0); |
} |
- if (rotation_ == gfx::Display::ROTATE_90 || |
- rotation_ == gfx::Display::ROTATE_270) |
+ if (current_rotation_ == gfx::Display::ROTATE_90 || |
+ current_rotation_ == gfx::Display::ROTATE_270) |
size_in_pixel_.SetSize(size_in_pixel_.height(), size_in_pixel_.width()); |
gfx::SizeF size_f(size_in_pixel_); |
size_f.Scale(GetEffectiveUIScale()); |
@@ -295,7 +307,7 @@ gfx::Insets DisplayInfo::GetOverscanInsetsInPixel() const { |
} |
std::string DisplayInfo::ToString() const { |
- int rotation_degree = static_cast<int>(rotation_) * 90; |
+ int rotation_degree = static_cast<int>(current_rotation_) * 90; |
return base::StringPrintf( |
"DisplayInfo[%lld] native bounds=%s, size=%s, scale=%f, " |
"overscan=%s, rotation=%d, ui-scale=%f, touchscreen=%s, " |