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

Unified Diff: ui/gfx/display.cc

Issue 1563183008: Added capability on Windows to get the physical dimensions of your attached monitors. Also added th… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 11 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: ui/gfx/display.cc
diff --git a/ui/gfx/display.cc b/ui/gfx/display.cc
index 1777e87e5433822f6769e053a6459a0cd18499dd..9461a03e3cdd30fd02d737f93c05ed2457b4449e 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,8 +78,7 @@ Display::Display()
: id_(kInvalidDisplayID),
device_scale_factor_(GetForcedDeviceScaleFactor()),
rotation_(ROTATE_0),
- touch_support_(TOUCH_SUPPORT_UNKNOWN) {
-}
+ touch_support_(TOUCH_SUPPORT_UNKNOWN) {}
Display::Display(int64_t id)
: id_(id),
@@ -195,6 +195,19 @@ bool Display::IsInternal() const {
return is_valid() && (id_ == internal_display_id_);
}
+bool Display::IsPhysicalSizeAvailable() const {
+ return physical_size_mm_.width() != 0 && physical_size_mm_.height() != 0;
+}
+
+gfx::Size Display::GetPhysicalSizeMm() const {
+ DCHECK(IsPhysicalSizeAvailable());
+ return physical_size_mm_;
+}
+
+void Display::SetPhysicalSizeMm(gfx::Size physical_size) {
+ physical_size_mm_ = physical_size;
+}
+
// static
int64_t Display::InternalDisplayId() {
DCHECK_NE(kInvalidDisplayID, internal_display_id_);

Powered by Google App Engine
This is Rietveld 408576698