diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-25 20:03:41 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-25 20:03:41 +0000 |
commit | b82c42c45ee1b113377a2800b36d6e5e05b8b8e1 (patch) | |
tree | 6034126ffc720a18cabc0bdb211de7ca10233670 /ash/screen_ash.cc | |
parent | ce8d264d556f06a4b46b58b95bc82a884bb315d0 (diff) | |
download | chromium_src-b82c42c45ee1b113377a2800b36d6e5e05b8b8e1.zip chromium_src-b82c42c45ee1b113377a2800b36d6e5e05b8b8e1.tar.gz chromium_src-b82c42c45ee1b113377a2800b36d6e5e05b8b8e1.tar.bz2 |
* Separated implementation class from gfx::Screen
* Moved Monitor class to gfx/.
* Converted all use of gfx::Screen to match new API
BUG=115347,111990
TEST=none
Review URL: https://chromiumcodereview.appspot.com/9960042
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133961 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/screen_ash.cc')
-rw-r--r-- | ash/screen_ash.cc | 57 |
1 files changed, 25 insertions, 32 deletions
diff --git a/ash/screen_ash.cc b/ash/screen_ash.cc index ad679a1..98a9f3c 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 |