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

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: sync 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
« no previous file with comments | « ash/screen_ash.h ('k') | ash/shell.cc » ('j') | no next file with comments »
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 ad679a15615b645dd62882635741f37f52b2bd96..98a9f3cfb1c3a6f7093aed8ea03ba98188de511f 100644
--- a/ash/screen_ash.cc
+++ b/ash/screen_ash.cc
@@ -8,16 +8,13 @@
#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_manager.h"
#include "ui/aura/root_window.h"
+#include "ui/gfx/monitor.h"
+#include "ui/gfx/screen.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 +38,41 @@ 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::Rect ScreenAsh::GetMonitorAreaNearestWindowImpl(
- gfx::NativeWindow window) {
- // See the comment at the top.
- return gfx::Rect(
- GetMonitorManager()->GetMonitorNearestWindow(window)->size());
+gfx::NativeWindow ScreenAsh::GetWindowAtCursorScreenPoint() {
+ const gfx::Point point = gfx::Screen::GetCursorScreenPoint();
+ return root_window_->GetTopWindowContainingPoint(point);
}
-gfx::Rect ScreenAsh::GetMonitorWorkAreaNearestPointImpl(
- const gfx::Point& point) {
- return GetMonitorManager()->GetMonitorNearestPoint(point)->
- GetWorkAreaBounds();
+int ScreenAsh::GetNumMonitors() {
+ return GetMonitorManager()->GetNumMonitors();
}
-gfx::Rect ScreenAsh::GetMonitorAreaNearestPointImpl(const gfx::Point& point) {
- // See the comment at the top.
- return gfx::Rect(GetMonitorManager()->GetMonitorNearestPoint(point)->size());
-}
-gfx::NativeWindow ScreenAsh::GetWindowAtCursorScreenPointImpl() {
- const gfx::Point point = GetCursorScreenPoint();
- return root_window_->GetTopWindowContainingPoint(point);
+gfx::Monitor ScreenAsh::GetMonitorNearestWindow(gfx::NativeView window) const {
+ gfx::Monitor monitor = GetMonitorManager()->GetMonitorNearestWindow(window);
+ // TODO(oshima): For m19, work area/monitor bounds that chrome/webapps sees
+ // has (0, 0) origin because it's simpler and enough. Fix this when
+ // real multi monitor support is implemented.
+ monitor.SetBoundsAndUpdateWorkArea(gfx::Rect(monitor.size()));
+ return monitor;
}
-gfx::Size ScreenAsh::GetPrimaryMonitorSizeImpl() {
- return GetMonitorManager()->GetMonitorAt(0)->size();
+gfx::Monitor ScreenAsh::GetMonitorNearestPoint(const gfx::Point& point) const {
+ gfx::Monitor monitor = GetMonitorManager()->GetMonitorNearestPoint(point);
+ // See comment above.
+ monitor.SetBoundsAndUpdateWorkArea(gfx::Rect(monitor.size()));
+ return monitor;
}
-int ScreenAsh::GetNumMonitorsImpl() {
- return GetMonitorManager()->GetNumMonitors();
+gfx::Monitor ScreenAsh::GetPrimaryMonitor() const {
+ gfx::Monitor monitor = GetMonitorManager()->GetMonitorAt(0);
+ // See comment above.
+ monitor.SetBoundsAndUpdateWorkArea(gfx::Rect(monitor.size()));
+ return monitor;
}
} // namespace ash
« no previous file with comments | « ash/screen_ash.h ('k') | ash/shell.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698