| Index: ui/gfx/display.cc
|
| diff --git a/ui/gfx/display.cc b/ui/gfx/display.cc
|
| index 1777e87e5433822f6769e053a6459a0cd18499dd..fcd860ee29de907e72a531fc438dd591664dea32 100644
|
| --- a/ui/gfx/display.cc
|
| +++ b/ui/gfx/display.cc
|
| @@ -5,6 +5,7 @@
|
| #include "ui/gfx/display.h"
|
|
|
| #include <algorithm>
|
| +#include <vector>
|
|
|
| #include "base/command_line.h"
|
| #include "base/logging.h"
|
| @@ -77,14 +78,17 @@ Display::Display()
|
| : id_(kInvalidDisplayID),
|
| device_scale_factor_(GetForcedDeviceScaleFactor()),
|
| rotation_(ROTATE_0),
|
| - touch_support_(TOUCH_SUPPORT_UNKNOWN) {
|
| -}
|
| + touch_support_(TOUCH_SUPPORT_UNKNOWN),
|
| + physical_width_mm_(0),
|
| + physical_height_mm_(0) {}
|
|
|
| Display::Display(int64_t id)
|
| : id_(id),
|
| device_scale_factor_(GetForcedDeviceScaleFactor()),
|
| rotation_(ROTATE_0),
|
| - touch_support_(TOUCH_SUPPORT_UNKNOWN) {}
|
| + touch_support_(TOUCH_SUPPORT_UNKNOWN),
|
| + physical_width_mm_(0),
|
| + physical_height_mm_(0) {}
|
|
|
| Display::Display(int64_t id, const gfx::Rect& bounds)
|
| : id_(id),
|
| @@ -92,7 +96,9 @@ Display::Display(int64_t id, const gfx::Rect& bounds)
|
| work_area_(bounds),
|
| device_scale_factor_(GetForcedDeviceScaleFactor()),
|
| rotation_(ROTATE_0),
|
| - touch_support_(TOUCH_SUPPORT_UNKNOWN) {
|
| + touch_support_(TOUCH_SUPPORT_UNKNOWN),
|
| + physical_width_mm_(0),
|
| + physical_height_mm_(0) {
|
| #if defined(USE_AURA)
|
| SetScaleAndBounds(device_scale_factor_, bounds);
|
| #endif
|
| @@ -195,6 +201,20 @@ bool Display::IsInternal() const {
|
| return is_valid() && (id_ == internal_display_id_);
|
| }
|
|
|
| +bool Display::IsPhysicalSizeAvailable() const {
|
| + return physical_width_mm_ != 0 && physical_height_mm_ != 0;
|
| +}
|
| +
|
| +gfx::Size Display::GetPhysicalSizeMm() const {
|
| + DCHECK(IsPhysicalSizeAvailable());
|
| + return gfx::Size(physical_width_mm_, physical_height_mm_);
|
| +}
|
| +
|
| +void Display::SetPhysicalSize(int width_mm, int height_mm) {
|
| + physical_width_mm_ = width_mm;
|
| + physical_height_mm_ = height_mm;
|
| +}
|
| +
|
| // static
|
| int64_t Display::InternalDisplayId() {
|
| DCHECK_NE(kInvalidDisplayID, internal_display_id_);
|
|
|