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

Unified Diff: ash/screen_ash.cc

Issue 9960042: Refactor screen/monitor so that gfx::Screen returns monitor object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix command line Created 8 years, 8 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
Index: ash/screen_ash.cc
diff --git a/ash/screen_ash.cc b/ash/screen_ash.cc
index ad679a15615b645dd62882635741f37f52b2bd96..f72ed7c0fdb4d6f5dd7ceef8e630ce633aaa90fc 100644
--- a/ash/screen_ash.cc
+++ b/ash/screen_ash.cc
@@ -8,16 +8,12 @@
#include "ash/wm/shelf_layout_manager.h"
#include "base/logging.h"
#include "ui/aura/env.h"
-#include "ui/aura/monitor.h"
+#include "ui/aura/monitor_aura.h"
#include "ui/aura/monitor_manager.h"
#include "ui/aura/root_window.h"
namespace ash {
-// TODO(oshima): For m19, the origin of work area/monitor bounds for
-// views/aura is (0,0) because it's simple and enough. Fix this when
-// real multi monitor support is implemented.
-
namespace {
aura::MonitorManager* GetMonitorManager() {
return aura::Env::GetInstance()->monitor_manager();
@@ -41,45 +37,39 @@ gfx::Rect ScreenAsh::GetUnmaximizedWorkAreaBounds(aura::Window* window) {
return Shell::GetInstance()->shelf()->GetUnmaximizedWorkAreaBounds(window);
}
-gfx::Point ScreenAsh::GetCursorScreenPointImpl() {
+gfx::Point ScreenAsh::GetCursorScreenPoint() {
return root_window_->last_mouse_location();
}
-gfx::Rect ScreenAsh::GetMonitorWorkAreaNearestWindowImpl(
- gfx::NativeWindow window) {
- return GetMonitorManager()->GetMonitorNearestWindow(window)->
- GetWorkAreaBounds();
+gfx::NativeWindow ScreenAsh::GetWindowAtCursorScreenPoint() {
+ const gfx::Point point = gfx::Screen::GetCursorScreenPoint();
+ return root_window_->GetTopWindowContainingPoint(point);
}
-gfx::Rect ScreenAsh::GetMonitorAreaNearestWindowImpl(
- gfx::NativeWindow window) {
- // See the comment at the top.
- return gfx::Rect(
- GetMonitorManager()->GetMonitorNearestWindow(window)->size());
+int ScreenAsh::GetNumMonitors() {
+ return GetMonitorManager()->GetNumMonitors();
}
-gfx::Rect ScreenAsh::GetMonitorWorkAreaNearestPointImpl(
- const gfx::Point& point) {
- return GetMonitorManager()->GetMonitorNearestPoint(point)->
- GetWorkAreaBounds();
+const gfx::Monitor* ScreenAsh::GetMonitorNearestWindow(
+ gfx::NativeWindow window) {
+ return GetMonitorManager()->GetMonitorNearestWindow(window);
}
-gfx::Rect ScreenAsh::GetMonitorAreaNearestPointImpl(const gfx::Point& point) {
- // See the comment at the top.
- return gfx::Rect(GetMonitorManager()->GetMonitorNearestPoint(point)->size());
+const gfx::Monitor* ScreenAsh::GetMonitorNearestPoint(
+ const gfx::Point& point) {
+ return GetMonitorManager()->GetMonitorNearestPoint(point);
}
-gfx::NativeWindow ScreenAsh::GetWindowAtCursorScreenPointImpl() {
- const gfx::Point point = GetCursorScreenPoint();
- return root_window_->GetTopWindowContainingPoint(point);
+const gfx::Monitor* ScreenAsh::GetPrimaryMonitor() {
+ return GetMonitorManager()->GetMonitorAt(0);
}
-gfx::Size ScreenAsh::GetPrimaryMonitorSizeImpl() {
- return GetMonitorManager()->GetMonitorAt(0)->size();
+void ScreenAsh::AddMonitorObserver(gfx::MonitorObserver* observer) {
+ return GetMonitorManager()->AddObserver(observer);
}
-int ScreenAsh::GetNumMonitorsImpl() {
- return GetMonitorManager()->GetNumMonitors();
+void ScreenAsh::RemoveMonitorObserver(gfx::MonitorObserver* observer) {
+ return GetMonitorManager()->RemoveObserver(observer);
}
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698