Chromium Code Reviews| Index: chrome/browser/ui/window_sizer.h |
| diff --git a/chrome/browser/ui/window_sizer.h b/chrome/browser/ui/window_sizer.h |
| index 20fe2d163e6017adeb1d20a849d3703d279254df..8a6d36056424ca51a70b5ad1ffc55744b1837d47 100644 |
| --- a/chrome/browser/ui/window_sizer.h |
| +++ b/chrome/browser/ui/window_sizer.h |
| @@ -6,14 +6,30 @@ |
| #define CHROME_BROWSER_UI_WINDOW_SIZER_H_ |
| #pragma once |
| -#include <vector> |
| - |
| #include "base/basictypes.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "ui/gfx/rect.h" |
| class Browser; |
| +// An interface implemented by an object that can retrieve information about |
| +// the monitors on the system. |
| +class MonitorInfoProvider { |
| + public: |
| + virtual ~MonitorInfoProvider() {} |
| + |
| + // Returns the bounds of the work area of the primary monitor. |
| + virtual gfx::Rect GetPrimaryMonitorWorkArea() const = 0; |
| + |
| + // Returns the bounds of the primary monitor. |
| + virtual gfx::Rect GetPrimaryMonitorBounds() const = 0; |
| + |
| + // Returns the bounds of the work area of the monitor that most closely |
| + // intersects the provided bounds. |
| + virtual gfx::Rect GetMonitorWorkAreaMatching( |
| + const gfx::Rect& match_rect) const = 0; |
| +}; |
| + |
| /////////////////////////////////////////////////////////////////////////////// |
| // WindowSizer |
| // |
| @@ -27,56 +43,14 @@ class Browser; |
| // |
| class WindowSizer { |
| public: |
| - class MonitorInfoProvider; |
| class StateProvider; |
| - // The WindowSizer assumes ownership of these objects. |
| + // WindowSizer owns |state_provider| and |monitor_info_provider|. |
|
Ben Goodger (Google)
2011/12/07 17:17:35
Also add this comment for the first function:
Win
|
| + explicit WindowSizer(StateProvider* state_provider); |
| WindowSizer(StateProvider* state_provider, |
| MonitorInfoProvider* monitor_info_provider); |
| virtual ~WindowSizer(); |
| - // Static factory methods to create default MonitorInfoProvider |
| - // instances. The returned object is owned by the caller. |
| - static MonitorInfoProvider* CreateDefaultMonitorInfoProvider(); |
| - |
| - // An interface implemented by an object that can retrieve information about |
| - // the monitors on the system. |
| - class MonitorInfoProvider { |
| - public: |
| - MonitorInfoProvider() {} |
| - virtual ~MonitorInfoProvider() {} |
| - |
| - // Returns the bounds of the work area of the primary monitor. |
| - virtual gfx::Rect GetPrimaryMonitorWorkArea() const = 0; |
| - |
| - // Returns the bounds of the primary monitor. |
| - virtual gfx::Rect GetPrimaryMonitorBounds() const = 0; |
| - |
| - // Returns the bounds of the work area of the monitor that most closely |
| - // intersects the provided bounds. |
| - virtual gfx::Rect GetMonitorWorkAreaMatching( |
| - const gfx::Rect& match_rect) const = 0; |
| - |
| - // Ensures number and coordinates of work areas are up-to-date. You must |
| - // call this before calling either of the below functions, as work areas can |
| - // change while the program is running. |
| - virtual void UpdateWorkAreas() = 0; |
| - |
| - // Returns the number of monitors on the system. |
| - size_t GetMonitorCount() const { |
| - return work_areas_.size(); |
| - } |
| - |
| - // Returns the bounds of the work area of the monitor at the specified |
| - // index. |
| - gfx::Rect GetWorkAreaAt(size_t index) const { |
| - return work_areas_[index]; |
| - } |
| - |
| - protected: |
| - std::vector<gfx::Rect> work_areas_; |
| - }; |
| - |
| // An interface implemented by an object that can retrieve state from either a |
| // persistent store or an existing window. |
| class StateProvider { |
| @@ -140,10 +114,6 @@ class WindowSizer { |
| // size based on monitor size, etc. |
| void GetDefaultWindowBounds(gfx::Rect* default_bounds) const; |
| - // Returns true if the specified position is "offscreen" for the given edge, |
| - // meaning that it's outside all work areas in the direction of that edge. |
| - bool PositionIsOffscreen(int position, Edge edge) const; |
| - |
| // Adjusts |bounds| to be visible onscreen, biased toward the work area of the |
| // monitor containing |other_bounds|. Despite the name, this doesn't |
| // guarantee the bounds are fully contained within this monitor's work rect; |