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

Unified Diff: ui/gfx/screen.h

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/monitor_unittest.cc ('k') | ui/gfx/screen_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/screen.h
diff --git a/ui/gfx/screen.h b/ui/gfx/screen.h
index a451130216815d063dbf266deef258f4339dbebb..8e5d273aa3efed65e4255cf1fcc530be3d12da9a 100644
--- a/ui/gfx/screen.h
+++ b/ui/gfx/screen.h
@@ -7,82 +7,48 @@
#pragma once
#include "ui/gfx/native_widget_types.h"
+#include "ui/gfx/monitor.h"
#include "ui/gfx/point.h"
-#include "ui/gfx/rect.h"
-#include "ui/gfx/size.h"
namespace gfx {
+class Rect;
+class ScreenImpl;
// A utility class for getting various info about screen size, monitors,
// cursor position, etc.
-// TODO(erikkay) add more of those methods here
class UI_EXPORT Screen {
public:
virtual ~Screen() {}
-#if defined(USE_ASH)
+#if defined(USE_AURA)
// Sets the instance to use. This takes owernship of |screen|, deleting the
// old instance. This is used on aura to avoid circular dependencies between
// ui and aura.
- static void SetInstance(Screen* screen);
+ static void SetInstance(ScreenImpl* screen);
#endif
// Returns the current absolute position of the mouse pointer.
static gfx::Point GetCursorScreenPoint();
- // Returns the work area of the monitor nearest the specified window.
- static gfx::Rect GetMonitorWorkAreaNearestWindow(gfx::NativeView view);
-
- // Returns the bounds of the monitor nearest the specified window.
- static gfx::Rect GetMonitorAreaNearestWindow(gfx::NativeView view);
-
- // Returns the work area of the monitor nearest the specified point.
- static gfx::Rect GetMonitorWorkAreaNearestPoint(const gfx::Point& point);
-
- // Returns the monitor area (not the work area, but the complete bounds) of
- // the monitor nearest the specified point.
- static gfx::Rect GetMonitorAreaNearestPoint(const gfx::Point& point);
-
- // Returns the bounds of the work area of the primary monitor.
- static gfx::Rect GetPrimaryMonitorWorkArea();
-
- // Returns the bounds of the primary monitor.
- static gfx::Rect GetPrimaryMonitorBounds();
-
- // Returns the bounds of the work area of the monitor that most closely
- // intersects the provided bounds.
- static gfx::Rect GetMonitorWorkAreaMatching(
- const gfx::Rect& match_rect);
-
// Returns the window under the cursor.
static gfx::NativeWindow GetWindowAtCursorScreenPoint();
- // Returns the dimensions of the primary monitor in pixels.
- static gfx::Size GetPrimaryMonitorSize();
-
// Returns the number of monitors.
// Mirrored displays are excluded; this method is intended to return the
// number of distinct, usable displays.
static int GetNumMonitors();
- protected:
- virtual gfx::Point GetCursorScreenPointImpl() = 0;
- virtual gfx::Rect GetMonitorWorkAreaNearestWindowImpl(
- gfx::NativeView view) = 0;
- virtual gfx::Rect GetMonitorAreaNearestWindowImpl(
- gfx::NativeView view) = 0;
- virtual gfx::Rect GetMonitorWorkAreaNearestPointImpl(
- const gfx::Point& point) = 0;
- virtual gfx::Rect GetMonitorAreaNearestPointImpl(const gfx::Point& point) = 0;
- virtual gfx::NativeWindow GetWindowAtCursorScreenPointImpl() = 0;
- virtual gfx::Size GetPrimaryMonitorSizeImpl() = 0;
- virtual int GetNumMonitorsImpl() = 0;
+ // Returns the monitor nearest the specified window.
+ static gfx::Monitor GetMonitorNearestWindow(gfx::NativeView view);
-private:
-#if defined(USE_AURA)
- // The singleton screen instance. Only used on aura.
- static Screen* instance_;
-#endif
+ // Returns the the monitor nearest the specified point.
+ static gfx::Monitor GetMonitorNearestPoint(const gfx::Point& point);
+
+ // Returns the bounds of the work area of the primary monitor.
+ static gfx::Monitor GetPrimaryMonitor();
+
+ // Returns the monitor that most closely intersects the provided bounds.
+ static gfx::Monitor GetMonitorMatching(const gfx::Rect& match_rect);
};
} // namespace gfx
« no previous file with comments | « ui/gfx/monitor_unittest.cc ('k') | ui/gfx/screen_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698