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

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: . 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
Index: ui/gfx/screen.h
diff --git a/ui/gfx/screen.h b/ui/gfx/screen.h
index a451130216815d063dbf266deef258f4339dbebb..c9687e493feb4ea5556e3bcf682fa81549066389 100644
--- a/ui/gfx/screen.h
+++ b/ui/gfx/screen.h
@@ -9,80 +9,62 @@
#include "ui/gfx/native_widget_types.h"
#include "ui/gfx/point.h"
#include "ui/gfx/rect.h"
-#include "ui/gfx/size.h"
namespace gfx {
+class Monitor;
+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;
-
-private:
-#if defined(USE_AURA)
- // The singleton screen instance. Only used on aura.
- static Screen* instance_;
-#endif
+ // Returns the monitor nearest the specified window in the |monitor_out|
+ // parameter.
+ static void GetMonitorNearestWindow(gfx::NativeView view,
+ gfx::Monitor* monitor_out);
+
+ // Returns the the monitor nearest the specified point in the |monitor_out|
+ // parameter.
+ static void GetMonitorNearestPoint(const gfx::Point& point,
+ gfx::Monitor* monitor_out);
Ben Goodger (Google) 2012/04/13 19:57:19 Now that I've seen all the call sites, I think thi
oshima 2012/04/13 21:18:41 Ok, will do that.
+
+ // Returns the bounds of the work area of the primary monitor in the
+ // |monitor_out| parameter.
+ static void GetPrimaryMonitor(gfx::Monitor* monitor_out);
+
+ // Returns the monitor that most closely intersects the provided bounds
+ // in the |monitor_out| parameter.
+ static void GetMonitorMatching(const gfx::Rect& match_rect,
+ gfx::Monitor* monitor_out);
+
+ // Utility functions to get Monitor bounds/WorkArea bounds.
+ static gfx::Rect GetMonitorAreaNearestWindow(gfx::NativeView view);
+ static gfx::Rect GetMonitorWorkAreaNearestWindow(gfx::NativeView view);
+ static gfx::Rect GetMonitorAreaNearestPoint(const gfx::Point& point);
+ static gfx::Rect GetMonitorWorkAreaNearestPoint(const gfx::Point& point);
+ static gfx::Rect GetPrimaryMonitorBounds();
+ static gfx::Rect GetPrimaryMonitorWorkArea();
};
} // namespace gfx

Powered by Google App Engine
This is Rietveld 408576698