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

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

Issue 78002: Reorganize fullscreen mode handling. Now nearly everything is in WindowWin. ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/views/frame/opaque_browser_frame_view.cc ('k') | chrome/common/win_util.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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> 7 #include <atlbase.h>
8 #include <atlapp.h> 8 #include <atlapp.h>
9 #include <atlmisc.h> 9 #include <atlmisc.h>
10 10
(...skipping 23 matching lines...) Expand all
34 34
35 virtual gfx::Rect GetPrimaryMonitorBounds() const { 35 virtual gfx::Rect GetPrimaryMonitorBounds() const {
36 return gfx::Rect(GetMonitorInfoForMonitor(MonitorFromWindow(NULL, 36 return gfx::Rect(GetMonitorInfoForMonitor(MonitorFromWindow(NULL,
37 MONITOR_DEFAULTTOPRIMARY)).rcMonitor); 37 MONITOR_DEFAULTTOPRIMARY)).rcMonitor);
38 } 38 }
39 39
40 virtual gfx::Rect GetMonitorWorkAreaMatching( 40 virtual gfx::Rect GetMonitorWorkAreaMatching(
41 const gfx::Rect& match_rect) const { 41 const gfx::Rect& match_rect) const {
42 CRect other_bounds_crect = match_rect.ToRECT(); 42 CRect other_bounds_crect = match_rect.ToRECT();
43 MONITORINFO monitor_info = GetMonitorInfoForMonitor(MonitorFromRect( 43 MONITORINFO monitor_info = GetMonitorInfoForMonitor(MonitorFromRect(
44 &other_bounds_crect, MONITOR_DEFAULTTOPRIMARY)); 44 &other_bounds_crect, MONITOR_DEFAULTTONEAREST));
45 return gfx::Rect(monitor_info.rcWork); 45 return gfx::Rect(monitor_info.rcWork);
46 } 46 }
47 47
48 virtual gfx::Point GetBoundsOffsetMatching( 48 virtual gfx::Point GetBoundsOffsetMatching(
49 const gfx::Rect& match_rect) const { 49 const gfx::Rect& match_rect) const {
50 CRect other_bounds_crect = match_rect.ToRECT(); 50 CRect other_bounds_crect = match_rect.ToRECT();
51 MONITORINFO monitor_info = GetMonitorInfoForMonitor(MonitorFromRect( 51 MONITORINFO monitor_info = GetMonitorInfoForMonitor(MonitorFromRect(
52 &other_bounds_crect, MONITOR_DEFAULTTOPRIMARY)); 52 &other_bounds_crect, MONITOR_DEFAULTTONEAREST));
53 return gfx::Point(monitor_info.rcWork.left - monitor_info.rcMonitor.left, 53 return gfx::Point(monitor_info.rcWork.left - monitor_info.rcMonitor.left,
54 monitor_info.rcWork.top - monitor_info.rcMonitor.top); 54 monitor_info.rcWork.top - monitor_info.rcMonitor.top);
55 } 55 }
56 56
57 void UpdateWorkAreas() { 57 void UpdateWorkAreas() {
58 work_areas_.clear(); 58 work_areas_.clear();
59 EnumDisplayMonitors(NULL, NULL, 59 EnumDisplayMonitors(NULL, NULL,
60 &DefaultMonitorInfoProvider::MonitorEnumProc, 60 &DefaultMonitorInfoProvider::MonitorEnumProc,
61 reinterpret_cast<LPARAM>(&work_areas_)); 61 reinterpret_cast<LPARAM>(&work_areas_));
62 } 62 }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 virtual bool GetLastActiveWindowState(gfx::Rect* bounds) const { 123 virtual bool GetLastActiveWindowState(gfx::Rect* bounds) const {
124 // Applications are always restored with the same position. 124 // Applications are always restored with the same position.
125 if (!app_name_.empty()) 125 if (!app_name_.empty())
126 return false; 126 return false;
127 127
128 BrowserList::const_reverse_iterator it = BrowserList::begin_last_active(); 128 BrowserList::const_reverse_iterator it = BrowserList::begin_last_active();
129 BrowserList::const_reverse_iterator end = BrowserList::end_last_active(); 129 BrowserList::const_reverse_iterator end = BrowserList::end_last_active();
130 for (; it != end; ++it) { 130 for (; it != end; ++it) {
131 Browser* last_active = *it; 131 Browser* last_active = *it;
132 if (last_active && last_active->type() == Browser::TYPE_NORMAL) { 132 if (last_active && last_active->type() == Browser::TYPE_NORMAL) {
133 BrowserWindow* frame = last_active->window(); 133 BrowserWindow* window = last_active->window();
134 DCHECK(frame); 134 DCHECK(window);
135 *bounds = frame->GetNormalBounds(); 135 *bounds = window->GetNormalBounds();
136 return true; 136 return true;
137 } 137 }
138 } 138 }
139 139
140 return false; 140 return false;
141 } 141 }
142 142
143 private: 143 private:
144 std::wstring app_name_; 144 std::wstring app_name_;
145 145
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 // Now that we've tried to correct the x/y position to something reasonable, 353 // Now that we've tried to correct the x/y position to something reasonable,
354 // see if the window is still too tall or wide to fit, and resize it if need 354 // see if the window is still too tall or wide to fit, and resize it if need
355 // be. 355 // be.
356 if ((bottom_offscreen || top_offscreen) && 356 if ((bottom_offscreen || top_offscreen) &&
357 bounds->bottom() > work_area.bottom()) 357 bounds->bottom() > work_area.bottom())
358 bounds->set_height(work_area.height() - 2 * kWindowTilePixels); 358 bounds->set_height(work_area.height() - 2 * kWindowTilePixels);
359 if ((left_offscreen || right_offscreen) && 359 if ((left_offscreen || right_offscreen) &&
360 bounds->right() > work_area.right()) 360 bounds->right() > work_area.right())
361 bounds->set_width(work_area.width() - 2 * kWindowTilePixels); 361 bounds->set_width(work_area.width() - 2 * kWindowTilePixels);
362 } 362 }
OLDNEW
« no previous file with comments | « chrome/browser/views/frame/opaque_browser_frame_view.cc ('k') | chrome/common/win_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698