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

Unified Diff: chrome/browser/ui/window_sizer_win.cc

Issue 8549008: Extract MonitorInfoProvider from WindowSizer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add docs Created 9 years 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 | « chrome/browser/ui/window_sizer_unittest.cc ('k') | ui/gfx/screen.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/window_sizer_win.cc
diff --git a/chrome/browser/ui/window_sizer_win.cc b/chrome/browser/ui/window_sizer_win.cc
index 9a4fa370d20eebdd504f161a251cbb377ee888ab..6c7fd282830ad4c9464049985740e722b3fa41f1 100644
--- a/chrome/browser/ui/window_sizer_win.cc
+++ b/chrome/browser/ui/window_sizer_win.cc
@@ -12,66 +12,6 @@
// opened windows.
const int WindowSizer::kWindowTilePixels = 10;
-// An implementation of WindowSizer::MonitorInfoProvider that gets the actual
-// monitor information from Windows.
-class DefaultMonitorInfoProvider : public WindowSizer::MonitorInfoProvider {
- public:
- DefaultMonitorInfoProvider() { }
-
- // Overridden from WindowSizer::MonitorInfoProvider:
- virtual gfx::Rect GetPrimaryMonitorWorkArea() const {
- return gfx::Rect(GetMonitorInfoForMonitor(MonitorFromWindow(NULL,
- MONITOR_DEFAULTTOPRIMARY)).rcWork);
- }
-
- virtual gfx::Rect GetPrimaryMonitorBounds() const {
- return gfx::Rect(GetMonitorInfoForMonitor(MonitorFromWindow(NULL,
- MONITOR_DEFAULTTOPRIMARY)).rcMonitor);
- }
-
- virtual gfx::Rect GetMonitorWorkAreaMatching(
- const gfx::Rect& match_rect) const {
- RECT other_bounds_rect = match_rect.ToRECT();
- MONITORINFO monitor_info = GetMonitorInfoForMonitor(MonitorFromRect(
- &other_bounds_rect, MONITOR_DEFAULTTONEAREST));
- return gfx::Rect(monitor_info.rcWork);
- }
-
- void UpdateWorkAreas() {
- work_areas_.clear();
- EnumDisplayMonitors(NULL, NULL,
- &DefaultMonitorInfoProvider::MonitorEnumProc,
- reinterpret_cast<LPARAM>(&work_areas_));
- }
-
- private:
- // A callback for EnumDisplayMonitors that records the work area of the
- // current monitor in the enumeration.
- static BOOL CALLBACK MonitorEnumProc(HMONITOR monitor,
- HDC monitor_dc,
- LPRECT monitor_rect,
- LPARAM data) {
- reinterpret_cast<std::vector<gfx::Rect>*>(data)->push_back(
- gfx::Rect(GetMonitorInfoForMonitor(monitor).rcWork));
- return TRUE;
- }
-
- static MONITORINFO GetMonitorInfoForMonitor(HMONITOR monitor) {
- MONITORINFO monitor_info = { 0 };
- monitor_info.cbSize = sizeof(monitor_info);
- GetMonitorInfo(monitor, &monitor_info);
- return monitor_info;
- }
-
- DISALLOW_COPY_AND_ASSIGN(DefaultMonitorInfoProvider);
-};
-
-// static
-WindowSizer::MonitorInfoProvider*
-WindowSizer::CreateDefaultMonitorInfoProvider() {
- return new DefaultMonitorInfoProvider();
-}
-
// static
gfx::Point WindowSizer::GetDefaultPopupOrigin(const gfx::Size& size) {
RECT area;
« no previous file with comments | « chrome/browser/ui/window_sizer_unittest.cc ('k') | ui/gfx/screen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698