Index: ash/screen_ash.cc |
diff --git a/ash/screen_ash.cc b/ash/screen_ash.cc |
index ed83c46d4501f1e2746cafe4d47d7bcd8e9f7612..c7d9cb94187e2fa0ade73b2f86f9204588cf84ac 100644 |
--- a/ash/screen_ash.cc |
+++ b/ash/screen_ash.cc |
@@ -21,8 +21,7 @@ aura::MonitorManager* GetMonitorManager() { |
} |
} // namespace |
-ScreenAsh::ScreenAsh(aura::RootWindow* root_window) |
- : root_window_(root_window) { |
+ScreenAsh::ScreenAsh() { |
} |
ScreenAsh::~ScreenAsh() { |
@@ -30,21 +29,29 @@ ScreenAsh::~ScreenAsh() { |
// static |
gfx::Rect ScreenAsh::GetMaximizedWindowBounds(aura::Window* window) { |
- return Shell::GetInstance()->shelf()->GetMaximizedWindowBounds(window); |
+ if (window->GetRootWindow() == Shell::GetPrimaryRootWindow()) |
+ return Shell::GetInstance()->shelf()->GetMaximizedWindowBounds(window); |
+ else |
+ return gfx::Screen::GetMonitorNearestWindow(window).bounds(); |
} |
// static |
gfx::Rect ScreenAsh::GetUnmaximizedWorkAreaBounds(aura::Window* window) { |
- return Shell::GetInstance()->shelf()->GetUnmaximizedWorkAreaBounds(window); |
+ if (window->GetRootWindow() == Shell::GetPrimaryRootWindow()) |
+ return Shell::GetInstance()->shelf()->GetUnmaximizedWorkAreaBounds(window); |
+ else |
+ return gfx::Screen::GetMonitorNearestWindow(window).work_area(); |
} |
gfx::Point ScreenAsh::GetCursorScreenPoint() { |
- return root_window_->last_mouse_location(); |
+ // TODO(oshima): Support multiple root window. |
+ return Shell::GetPrimaryRootWindow()->last_mouse_location(); |
} |
gfx::NativeWindow ScreenAsh::GetWindowAtCursorScreenPoint() { |
const gfx::Point point = gfx::Screen::GetCursorScreenPoint(); |
- return root_window_->GetTopWindowContainingPoint(point); |
+ // TODO(oshima): convert point to relateive to the root window. |
+ return Shell::GetRootWindowAt(point)->GetTopWindowContainingPoint(point); |
} |
int ScreenAsh::GetNumMonitors() { |