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

Unified Diff: ui/gfx/display.cc

Issue 12217120: Add IsInternal property to gfx::Display (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Get rid of static initializer Created 7 years, 10 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
« no previous file with comments | « ui/gfx/display.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/display.cc
diff --git a/ui/gfx/display.cc b/ui/gfx/display.cc
index 40608a1d21127d265463131cb069199d6015942b..7aa12416b4af84cee4694b556bc6a4bd8099396e 100644
--- a/ui/gfx/display.cc
+++ b/ui/gfx/display.cc
@@ -32,9 +32,11 @@ float GetForcedDeviceScaleFactorImpl() {
return static_cast<float>(scale_in_double);
}
-} // namespace
+const int64 kInvalidDisplayIDForCompileTimeInit = -1;
+int64 internal_display_id_ = kInvalidDisplayIDForCompileTimeInit;
+} // namespace
-const int64 Display::kInvalidDisplayID = -1;
+const int64 Display::kInvalidDisplayID = kInvalidDisplayIDForCompileTimeInit;
// static
float Display::GetForcedDeviceScaleFactor() {
@@ -129,11 +131,25 @@ gfx::Size Display::GetSizeInPixel() const {
}
std::string Display::ToString() const {
- return base::StringPrintf("Display[%lld] bounds=%s, workarea=%s, scale=%f",
- static_cast<long long int>(id_),
- bounds_.ToString().c_str(),
- work_area_.ToString().c_str(),
- device_scale_factor_);
+ return base::StringPrintf(
+ "Display[%lld] bounds=%s, workarea=%s, scale=%f, %s",
+ static_cast<long long int>(id_),
+ bounds_.ToString().c_str(),
+ work_area_.ToString().c_str(),
+ device_scale_factor_,
+ IsInternal() ? "internal" : "external");
+}
+
+bool Display::IsInternal() const {
+ return is_valid() && (id_ == internal_display_id_);
+}
+
+int64 Display::InternalDisplayId() {
+ return internal_display_id_;
+}
+
+void Display::SetInternalDisplayId(int64 internal_display_id) {
+ internal_display_id_ = internal_display_id;
}
} // namespace gfx
« no previous file with comments | « ui/gfx/display.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698