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

Unified Diff: ash/screen_ash.cc

Issue 9699013: MonitorManager to manage multiple monitors. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 9 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 | « ash/screen_ash.h ('k') | ash/shell.h » ('j') | ash/shell.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/screen_ash.cc
diff --git a/ash/screen_ash.cc b/ash/screen_ash.cc
index bbdf9e85f2f9f6e1253adac3f30b78af4a03bb0b..9847480f4336646220051bc71cf8b4a249f28b31 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
« no previous file with comments | « ash/screen_ash.h ('k') | ash/shell.h » ('j') | ash/shell.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698