Index: ui/gfx/monitor.cc |
diff --git a/ui/gfx/monitor.cc b/ui/gfx/monitor.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b58b63cfa2dab78f96f0f54a4d273a1ecb8348b9 |
--- /dev/null |
+++ b/ui/gfx/monitor.cc |
@@ -0,0 +1,39 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "ui/gfx/monitor.h" |
+ |
+#include "ui/gfx/insets.h" |
+ |
+namespace gfx { |
+ |
+Monitor::Monitor() : device_scale_factor_(1.0) { |
+} |
+ |
+Monitor::Monitor(const gfx::Rect& bounds) |
+ : bounds_(bounds), work_area_(bounds), device_scale_factor_(1.0) { |
+} |
+ |
+Monitor::~Monitor() { |
+} |
+ |
+void Monitor::SetBoundsAndUpdateWorkArea(const gfx::Rect& bounds) { |
+ Insets insets(work_area_.y() - bounds_.y(), |
+ work_area_.x() - bounds_.x(), |
+ bounds_.bottom() - work_area_.bottom(), |
+ bounds_.right() - work_area_.right()); |
+ bounds_ = bounds; |
+ UpdateWorkAreaWithInsets(insets); |
+} |
+ |
+void Monitor::SetSizeAndUpdateWorkArea(const gfx::Size& size) { |
+ SetBoundsAndUpdateWorkArea(gfx::Rect(bounds_.origin(), size)); |
+} |
+ |
+void Monitor::UpdateWorkAreaWithInsets(const gfx::Insets& insets) { |
+ work_area_ = bounds_; |
+ work_area_.Inset(insets); |
+} |
+ |
+} // namespace gfx |