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

Unified Diff: ui/gfx/screen_aura.cc

Issue 9960042: Refactor screen/monitor so that gfx::Screen returns monitor object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 8 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
« no previous file with comments | « ui/gfx/screen_ash.cc ('k') | ui/gfx/screen_aurax11.cc » ('j') | 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
new file mode 100644
index 0000000000000000000000000000000000000000..163109515142ec57b6919459e053505390ff0414
--- /dev/null
+++ b/ui/gfx/screen_aura.cc
@@ -0,0 +1,67 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/gfx/screen.h"
+
+#include "base/logging.h"
+#include "ui/gfx/monitor.h"
+#include "ui/gfx/native_widget_types.h"
+#include "ui/gfx/screen_impl.h"
+
+namespace gfx {
+
+// gfx can't depend upon aura, otherwise we have circular dependencies. So,
+// gfx::Screen is pluggable and Desktop plugs in the real implementation.
+namespace {
+ScreenImpl* g_instance_ = NULL;
+}
+
+// static
+void Screen::SetInstance(ScreenImpl* screen) {
+ delete g_instance_;
+ g_instance_ = screen;
+}
+
+#if defined(USE_ASH)
+// TODO(oshima): Implement ScreenImpl for Linux/aura and remove this
+// ifdef.
+
+// static
+Point Screen::GetCursorScreenPoint() {
+ return g_instance_->GetCursorScreenPoint();
+}
+
+// static
+NativeWindow Screen::GetWindowAtCursorScreenPoint() {
+ return g_instance_->GetWindowAtCursorScreenPoint();
+}
+
+// static
+int Screen::GetNumMonitors() {
+ return g_instance_->GetNumMonitors();
+}
+
+// static
+Monitor Screen::GetMonitorNearestWindow(NativeView window) {
+ return g_instance_->GetMonitorNearestWindow(window);
+}
+
+// static
+Monitor Screen::GetMonitorNearestPoint(const Point& point) {
+ return g_instance_->GetMonitorNearestPoint(point);
+}
+
+// static
+Monitor Screen::GetPrimaryMonitor() {
+ return g_instance_->GetPrimaryMonitor();
+}
+
+// static
+Monitor Screen::GetMonitorMatching(const gfx::Rect& match_rect) {
+ return g_instance_->GetMonitorNearestPoint(match_rect.CenterPoint());
+}
+
+#endif
+
+} // namespace gfx
« no previous file with comments | « ui/gfx/screen_ash.cc ('k') | ui/gfx/screen_aurax11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698