| Index: ui/gfx/screen_aura.cc
|
| diff --git a/ui/gfx/screen_aura.cc b/ui/gfx/screen_aura.cc
|
| index b343f36b3bf562b74b09855c028daf635571f061..db21a926bbc2cdbc0763780fe023ea1a003d08d0 100644
|
| --- a/ui/gfx/screen_aura.cc
|
| +++ b/ui/gfx/screen_aura.cc
|
| @@ -9,21 +9,22 @@
|
| #endif
|
|
|
| #include "base/logging.h"
|
| -#include "ui/aura/desktop.h"
|
| -#include "ui/aura/window.h"
|
| #include "ui/gfx/native_widget_types.h"
|
|
|
| -namespace {
|
| +namespace gfx {
|
|
|
| -gfx::Rect GetMonitorAreaOrWorkAreaNearestPoint(const gfx::Point& point,
|
| - bool work_area) {
|
| - // TODO(oshima): Take point/work_area into account. Support multiple monitors.
|
| - return gfx::Rect(aura::Desktop::GetInstance()->GetSize());
|
| -}
|
| +// gfx can't depend upon aura, otherwise we have circular dependencies. So,
|
| +// gfx::Screen is pluggable for aura and Desktop plugs in the real
|
| +// implementation.
|
|
|
| -} // namespace
|
| +// static
|
| +Screen* Screen::instance_ = NULL;
|
|
|
| -namespace gfx {
|
| +// static
|
| +void Screen::SetInstance(Screen* screen) {
|
| + delete instance_;
|
| + instance_ = screen;
|
| +}
|
|
|
| // static
|
| gfx::Point Screen::GetCursorScreenPoint() {
|
| @@ -38,31 +39,31 @@ gfx::Point Screen::GetCursorScreenPoint() {
|
|
|
| // static
|
| gfx::Rect Screen::GetMonitorWorkAreaNearestWindow(gfx::NativeWindow window) {
|
| - gfx::Rect bounds = GetMonitorAreaNearestWindow(window);
|
| - // Emulate that a work area can be smaller than its monitor.
|
| - bounds.Inset(10, 10, 10, 10);
|
| - return bounds;
|
| + DCHECK(instance_);
|
| + return instance_->GetMonitorWorkAreaNearestWindowImpl(window);
|
| }
|
|
|
| // static
|
| gfx::Rect Screen::GetMonitorAreaNearestWindow(gfx::NativeWindow window) {
|
| - // TODO(oshima): Take point/work_area into account. Support multiple monitors.
|
| - return gfx::Rect(aura::Desktop::GetInstance()->GetSize());
|
| + DCHECK(instance_);
|
| + return instance_->GetMonitorAreaNearestWindowImpl(window);
|
| }
|
|
|
| // static
|
| gfx::Rect Screen::GetMonitorWorkAreaNearestPoint(const gfx::Point& point) {
|
| - return GetMonitorAreaOrWorkAreaNearestPoint(point, true);
|
| + DCHECK(instance_);
|
| + return instance_->GetMonitorWorkAreaNearestPointImpl(point);
|
| }
|
|
|
| // static
|
| gfx::Rect Screen::GetMonitorAreaNearestPoint(const gfx::Point& point) {
|
| - return GetMonitorAreaOrWorkAreaNearestPoint(point, false);
|
| + DCHECK(instance_);
|
| + return instance_->GetMonitorAreaNearestPointImpl(point);
|
| }
|
|
|
| gfx::NativeWindow Screen::GetWindowAtCursorScreenPoint() {
|
| - NOTIMPLEMENTED();
|
| - return NULL;
|
| + DCHECK(instance_);
|
| + return instance_->GetWindowAtCursorScreenPointImpl();
|
| }
|
|
|
| } // namespace gfx
|
|
|