summaryrefslogtreecommitdiffstats
path: root/ash/screen_ash.cc
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-14 18:22:44 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-14 18:22:44 +0000
commit8a45c9775a4ccf87bf30a73df8954fe9446d6e2a (patch)
treefd100c56b428bb56b19f47291d95e4466d10e8bf /ash/screen_ash.cc
parent23589b731fa97a94db920670795c9c91250c25f1 (diff)
downloadchromium_src-8a45c9775a4ccf87bf30a73df8954fe9446d6e2a.zip
chromium_src-8a45c9775a4ccf87bf30a73df8954fe9446d6e2a.tar.gz
chromium_src-8a45c9775a4ccf87bf30a73df8954fe9446d6e2a.tar.bz2
MonitorManager to manage multiple monitors.
This is clone of issue 9689027, which I can't access due to some internal error. BUG=115510 TEST=none Review URL: https://chromiumcodereview.appspot.com/9699013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126685 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/screen_ash.cc')
-rw-r--r--ash/screen_ash.cc35
1 files changed, 17 insertions, 18 deletions
diff --git a/ash/screen_ash.cc b/ash/screen_ash.cc
index bbdf9e8..9847480 100644
--- a/ash/screen_ash.cc
+++ b/ash/screen_ash.cc
@@ -5,12 +5,19 @@
#include "ash/screen_ash.h"
#include "base/logging.h"
+#include "ui/aura/env.h"
+#include "ui/aura/monitor.h"
+#include "ui/aura/monitor_manager.h"
#include "ui/aura/root_window.h"
-#include "ui/aura/window.h"
-#include "ui/gfx/native_widget_types.h"
namespace ash {
+namespace {
+const aura::MonitorManager* GetMonitorManager() {
+ return aura::Env::GetInstance()->monitor_manager();
+}
+} // namespace
+
ScreenAsh::ScreenAsh(aura::RootWindow* root_window)
: root_window_(root_window) {
}
@@ -24,21 +31,23 @@ gfx::Point ScreenAsh::GetCursorScreenPointImpl() {
gfx::Rect ScreenAsh::GetMonitorWorkAreaNearestWindowImpl(
gfx::NativeWindow window) {
- return GetWorkAreaBounds();
+ return GetMonitorManager()->GetMonitorNearestWindow(window)->
+ GetWorkAreaBounds();
}
gfx::Rect ScreenAsh::GetMonitorAreaNearestWindowImpl(
gfx::NativeWindow window) {
- return GetBounds();
+ return GetMonitorManager()->GetMonitorNearestWindow(window)->bounds();
}
gfx::Rect ScreenAsh::GetMonitorWorkAreaNearestPointImpl(
const gfx::Point& point) {
- return GetWorkAreaBounds();
+ return GetMonitorManager()->GetMonitorNearestPoint(point)->
+ GetWorkAreaBounds();
}
gfx::Rect ScreenAsh::GetMonitorAreaNearestPointImpl(const gfx::Point& point) {
- return GetBounds();
+ return GetMonitorManager()->GetMonitorNearestPoint(point)->bounds();
}
gfx::NativeWindow ScreenAsh::GetWindowAtCursorScreenPointImpl() {
@@ -46,22 +55,12 @@ gfx::NativeWindow ScreenAsh::GetWindowAtCursorScreenPointImpl() {
return root_window_->GetTopWindowContainingPoint(point);
}
-gfx::Rect ScreenAsh::GetBounds() {
- return gfx::Rect(root_window_->bounds().size());
-}
-
-gfx::Rect ScreenAsh::GetWorkAreaBounds() {
- gfx::Rect bounds(GetBounds());
- bounds.Inset(work_area_insets_);
- return bounds;
-}
-
gfx::Size ScreenAsh::GetPrimaryMonitorSizeImpl() {
- return GetMonitorWorkAreaNearestPoint(gfx::Point()).size();
+ return GetMonitorManager()->GetPrimaryMonitor()->size();
}
int ScreenAsh::GetNumMonitorsImpl() {
- return 1;
+ return GetMonitorManager()->GetNumMonitors();
}
} // namespace ash