Index: ui/gfx/screen.cc |
diff --git a/ui/gfx/screen.cc b/ui/gfx/screen.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4b0c0367ddfc3cf8c78f3bdd40e43d236595cdf4 |
--- /dev/null |
+++ b/ui/gfx/screen.cc |
@@ -0,0 +1,49 @@ |
+// 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/screen.h" |
+ |
+#include "ui/gfx/monitor.h" |
+ |
+namespace gfx { |
+ |
+// Utility functions to get Monitor bounds/WorkArea bounds. |
+// static |
+gfx::Rect Screen::GetMonitorAreaNearestWindow(gfx::NativeView view) { |
+ Monitor monitor; |
+ GetMonitorNearestWindow(view, &monitor); |
+ return monitor.bounds(); |
+} |
+ |
+gfx::Rect Screen::GetMonitorWorkAreaNearestWindow(gfx::NativeView view) { |
+ Monitor monitor; |
+ GetMonitorNearestWindow(view, &monitor); |
+ return monitor.work_area(); |
+} |
+ |
+gfx::Rect Screen::GetMonitorAreaNearestPoint(const gfx::Point& point) { |
+ Monitor monitor; |
+ GetMonitorNearestPoint(point, &monitor); |
+ return monitor.bounds(); |
+} |
+ |
+gfx::Rect Screen::GetMonitorWorkAreaNearestPoint(const gfx::Point& point) { |
+ Monitor monitor; |
+ GetMonitorNearestPoint(point, &monitor); |
+ return monitor.work_area(); |
+} |
+ |
+gfx::Rect Screen::GetPrimaryMonitorBounds() { |
+ Monitor monitor; |
+ GetPrimaryMonitor(&monitor); |
+ return monitor.bounds(); |
+} |
+ |
+gfx::Rect Screen::GetPrimaryMonitorWorkArea() { |
+ Monitor monitor; |
+ GetPrimaryMonitor(&monitor); |
+ return monitor.work_area(); |
+} |
+ |
+} // namespace gfx |