diff options
author | ynovikov@chromium.org <ynovikov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-19 16:24:08 +0000 |
---|---|---|
committer | ynovikov@chromium.org <ynovikov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-19 16:24:08 +0000 |
commit | b33657be291b673090595c3b3ef62da78d01405d (patch) | |
tree | b5aa3e421063c77235b6c81123f6951c9b84bd13 /ui | |
parent | 0ace10fa0cb5b8852c825e743fbb7c0a77fe14f2 (diff) | |
download | chromium_src-b33657be291b673090595c3b3ef62da78d01405d.zip chromium_src-b33657be291b673090595c3b3ef62da78d01405d.tar.gz chromium_src-b33657be291b673090595c3b3ef62da78d01405d.tar.bz2 |
Add IsInternal property to gfx::Display
Move knowledge whether a display is internal or not
from ash::DisplayManager into gfx::Display.
BUG=171310
TEST=ash_unittests, ui_unittests, unit_tests pass
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=182494
Review URL: https://chromiumcodereview.appspot.com/12217120
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@183230 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/gfx/display.cc | 30 | ||||
-rw-r--r-- | ui/gfx/display.h | 7 |
2 files changed, 30 insertions, 7 deletions
diff --git a/ui/gfx/display.cc b/ui/gfx/display.cc index 40608a1..7aa1241 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 diff --git a/ui/gfx/display.h b/ui/gfx/display.h index 8b3f346..4df69b7 100644 --- a/ui/gfx/display.h +++ b/ui/gfx/display.h @@ -101,6 +101,13 @@ class UI_EXPORT Display { // True if the display contains valid display id. bool is_valid() const { return id_ != kInvalidDisplayID; } + // True if the display corresponds to internal panel. + bool IsInternal() const; + + // Gets/Sets an id of display corresponding to internal panel. + static int64 InternalDisplayId(); + static void SetInternalDisplayId(int64 internal_display_id); + static const int64 kInvalidDisplayID; private: |