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

Unified Diff: ui/gfx/screen_aura.cc

Issue 8205018: Gets component build to work with aura. As part of this I needed to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 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
« ui/gfx/screen.h ('K') | « ui/gfx/screen.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« ui/gfx/screen.h ('K') | « ui/gfx/screen.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698