Commit af5e62c3 authored by oshima@chromium.org's avatar oshima@chromium.org

Remove root window from screen_ash

BUG=123160
TEST=none


Review URL: https://chromiumcodereview.appspot.com/10533041

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141176 0039d316-1c4b-4281-b951-d872f2087c98
parent 17a4590a
...@@ -21,8 +21,7 @@ aura::MonitorManager* GetMonitorManager() { ...@@ -21,8 +21,7 @@ aura::MonitorManager* GetMonitorManager() {
} }
} // namespace } // namespace
ScreenAsh::ScreenAsh(aura::RootWindow* root_window) ScreenAsh::ScreenAsh() {
: root_window_(root_window) {
} }
ScreenAsh::~ScreenAsh() { ScreenAsh::~ScreenAsh() {
...@@ -30,21 +29,29 @@ ScreenAsh::~ScreenAsh() { ...@@ -30,21 +29,29 @@ ScreenAsh::~ScreenAsh() {
// static // static
gfx::Rect ScreenAsh::GetMaximizedWindowBounds(aura::Window* window) { 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 // static
gfx::Rect ScreenAsh::GetUnmaximizedWorkAreaBounds(aura::Window* window) { 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() { 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() { gfx::NativeWindow ScreenAsh::GetWindowAtCursorScreenPoint() {
const gfx::Point point = gfx::Screen::GetCursorScreenPoint(); 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() { int ScreenAsh::GetNumMonitors() {
......
...@@ -12,17 +12,13 @@ ...@@ -12,17 +12,13 @@
#include "ui/gfx/rect.h" #include "ui/gfx/rect.h"
#include "ui/gfx/screen_impl.h" #include "ui/gfx/screen_impl.h"
namespace aura {
class RootWindow;
}
namespace ash { namespace ash {
// Aura implementation of gfx::Screen. Implemented here to avoid circular // Aura implementation of gfx::Screen. Implemented here to avoid circular
// dependencies. // dependencies.
class ASH_EXPORT ScreenAsh : public gfx::ScreenImpl { class ASH_EXPORT ScreenAsh : public gfx::ScreenImpl {
public: public:
explicit ScreenAsh(aura::RootWindow* root_window); ScreenAsh();
virtual ~ScreenAsh(); virtual ~ScreenAsh();
// Returns the bounds for maximized windows. Maximized windows trigger // Returns the bounds for maximized windows. Maximized windows trigger
...@@ -44,8 +40,6 @@ class ASH_EXPORT ScreenAsh : public gfx::ScreenImpl { ...@@ -44,8 +40,6 @@ class ASH_EXPORT ScreenAsh : public gfx::ScreenImpl {
virtual gfx::Monitor GetPrimaryMonitor() const OVERRIDE; virtual gfx::Monitor GetPrimaryMonitor() const OVERRIDE;
private: private:
aura::RootWindow* root_window_;
DISALLOW_COPY_AND_ASSIGN(ScreenAsh); DISALLOW_COPY_AND_ASSIGN(ScreenAsh);
}; };
......
...@@ -553,7 +553,7 @@ internal::WorkspaceController* Shell::TestApi::workspace_controller() { ...@@ -553,7 +553,7 @@ internal::WorkspaceController* Shell::TestApi::workspace_controller() {
Shell::Shell(ShellDelegate* delegate) Shell::Shell(ShellDelegate* delegate)
: root_window_(aura::MonitorManager::CreateRootWindowForPrimaryMonitor()), : root_window_(aura::MonitorManager::CreateRootWindowForPrimaryMonitor()),
screen_(new ScreenAsh(root_window_.get())), screen_(new ScreenAsh),
env_filter_(NULL), env_filter_(NULL),
delegate_(delegate), delegate_(delegate),
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment