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

Side by Side Diff: chrome/browser/window_sizer_win.cc

Issue 195036: Use RECT instead of CRect to reduce dependencies on ATL. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/dock_info_win.cc ('k') | views/controls/table/table_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/window_sizer.h" 5 #include "chrome/browser/window_sizer.h"
6 6
7 #include <atlbase.h>
8 #include <atlapp.h>
9 #include <atlmisc.h>
10
11 #include "chrome/browser/browser.h" 7 #include "chrome/browser/browser.h"
12 #include "chrome/browser/browser_list.h" 8 #include "chrome/browser/browser_list.h"
13 #include "chrome/browser/browser_window.h" 9 #include "chrome/browser/browser_window.h"
14 10
15 // How much horizontal and vertical offset there is between newly 11 // How much horizontal and vertical offset there is between newly
16 // opened windows. 12 // opened windows.
17 const int WindowSizer::kWindowTilePixels = 10; 13 const int WindowSizer::kWindowTilePixels = 10;
18 14
19 // An implementation of WindowSizer::MonitorInfoProvider that gets the actual 15 // An implementation of WindowSizer::MonitorInfoProvider that gets the actual
20 // monitor information from Windows. 16 // monitor information from Windows.
21 class DefaultMonitorInfoProvider : public WindowSizer::MonitorInfoProvider { 17 class DefaultMonitorInfoProvider : public WindowSizer::MonitorInfoProvider {
22 public: 18 public:
23 DefaultMonitorInfoProvider() { } 19 DefaultMonitorInfoProvider() { }
24 20
25 // Overridden from WindowSizer::MonitorInfoProvider: 21 // Overridden from WindowSizer::MonitorInfoProvider:
26 virtual gfx::Rect GetPrimaryMonitorWorkArea() const { 22 virtual gfx::Rect GetPrimaryMonitorWorkArea() const {
27 return gfx::Rect(GetMonitorInfoForMonitor(MonitorFromWindow(NULL, 23 return gfx::Rect(GetMonitorInfoForMonitor(MonitorFromWindow(NULL,
28 MONITOR_DEFAULTTOPRIMARY)).rcWork); 24 MONITOR_DEFAULTTOPRIMARY)).rcWork);
29 } 25 }
30 26
31 virtual gfx::Rect GetPrimaryMonitorBounds() const { 27 virtual gfx::Rect GetPrimaryMonitorBounds() const {
32 return gfx::Rect(GetMonitorInfoForMonitor(MonitorFromWindow(NULL, 28 return gfx::Rect(GetMonitorInfoForMonitor(MonitorFromWindow(NULL,
33 MONITOR_DEFAULTTOPRIMARY)).rcMonitor); 29 MONITOR_DEFAULTTOPRIMARY)).rcMonitor);
34 } 30 }
35 31
36 virtual gfx::Rect GetMonitorWorkAreaMatching( 32 virtual gfx::Rect GetMonitorWorkAreaMatching(
37 const gfx::Rect& match_rect) const { 33 const gfx::Rect& match_rect) const {
38 CRect other_bounds_crect = match_rect.ToRECT(); 34 RECT other_bounds_rect = match_rect.ToRECT();
39 MONITORINFO monitor_info = GetMonitorInfoForMonitor(MonitorFromRect( 35 MONITORINFO monitor_info = GetMonitorInfoForMonitor(MonitorFromRect(
40 &other_bounds_crect, MONITOR_DEFAULTTONEAREST)); 36 &other_bounds_rect, MONITOR_DEFAULTTONEAREST));
41 return gfx::Rect(monitor_info.rcWork); 37 return gfx::Rect(monitor_info.rcWork);
42 } 38 }
43 39
44 virtual gfx::Point GetBoundsOffsetMatching( 40 virtual gfx::Point GetBoundsOffsetMatching(
45 const gfx::Rect& match_rect) const { 41 const gfx::Rect& match_rect) const {
46 CRect other_bounds_crect = match_rect.ToRECT(); 42 RECT other_bounds_rect = match_rect.ToRECT();
47 MONITORINFO monitor_info = GetMonitorInfoForMonitor(MonitorFromRect( 43 MONITORINFO monitor_info = GetMonitorInfoForMonitor(MonitorFromRect(
48 &other_bounds_crect, MONITOR_DEFAULTTONEAREST)); 44 &other_bounds_rect, MONITOR_DEFAULTTONEAREST));
49 return gfx::Point(monitor_info.rcWork.left - monitor_info.rcMonitor.left, 45 return gfx::Point(monitor_info.rcWork.left - monitor_info.rcMonitor.left,
50 monitor_info.rcWork.top - monitor_info.rcMonitor.top); 46 monitor_info.rcWork.top - monitor_info.rcMonitor.top);
51 } 47 }
52 48
53 void UpdateWorkAreas() { 49 void UpdateWorkAreas() {
54 work_areas_.clear(); 50 work_areas_.clear();
55 EnumDisplayMonitors(NULL, NULL, 51 EnumDisplayMonitors(NULL, NULL,
56 &DefaultMonitorInfoProvider::MonitorEnumProc, 52 &DefaultMonitorInfoProvider::MonitorEnumProc,
57 reinterpret_cast<LPARAM>(&work_areas_)); 53 reinterpret_cast<LPARAM>(&work_areas_));
58 } 54 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 // Adjust corner to now overflow the work area left and top edges, so 99 // Adjust corner to now overflow the work area left and top edges, so
104 // that if a popup does not fit the title-bar is remains visible. 100 // that if a popup does not fit the title-bar is remains visible.
105 corner = gfx::Point( 101 corner = gfx::Point(
106 std::max(corner.x(), limit.x()), 102 std::max(corner.x(), limit.x()),
107 std::max(corner.y(), limit.y()) 103 std::max(corner.y(), limit.y())
108 ); 104 );
109 } 105 }
110 } 106 }
111 return corner; 107 return corner;
112 } 108 }
OLDNEW
« no previous file with comments | « chrome/browser/dock_info_win.cc ('k') | views/controls/table/table_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698