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

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

Issue 11110004: Make gfx::Rect class operations consistently mutate the class they are called on. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 2 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/window_sizer/window_sizer.h" 5 #include "chrome/browser/ui/window_sizer/window_sizer.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/prefs/pref_service.h" 10 #include "chrome/browser/prefs/pref_service.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 } else { 204 } else {
205 // In case that there was a bound given we need to make sure that it is 205 // In case that there was a bound given we need to make sure that it is
206 // visible and fits on the screen. 206 // visible and fits on the screen.
207 // Find the size of the work area of the monitor that intersects the bounds 207 // Find the size of the work area of the monitor that intersects the bounds
208 // of the anchor window. Note: AdjustBoundsToBeVisibleOnMonitorContaining 208 // of the anchor window. Note: AdjustBoundsToBeVisibleOnMonitorContaining
209 // does not exactly what we want: It makes only sure that "a minimal part" 209 // does not exactly what we want: It makes only sure that "a minimal part"
210 // is visible on the screen. 210 // is visible on the screen.
211 gfx::Rect work_area = 211 gfx::Rect work_area =
212 monitor_info_provider_->GetMonitorWorkAreaMatching(*bounds); 212 monitor_info_provider_->GetMonitorWorkAreaMatching(*bounds);
213 // Resize so that it fits. 213 // Resize so that it fits.
214 *bounds = bounds->AdjustToFit(work_area); 214 bounds->AdjustToFit(work_area);
215 } 215 }
216 } 216 }
217 217
218 bool WindowSizer::GetLastWindowBounds(gfx::Rect* bounds, 218 bool WindowSizer::GetLastWindowBounds(gfx::Rect* bounds,
219 ui::WindowShowState* show_state) const { 219 ui::WindowShowState* show_state) const {
220 DCHECK(bounds); 220 DCHECK(bounds);
221 DCHECK(show_state); 221 DCHECK(show_state);
222 if (!state_provider_.get() || 222 if (!state_provider_.get() ||
223 !state_provider_->GetLastActiveWindowState(bounds, show_state)) 223 !state_provider_->GetLastActiveWindowState(bounds, show_state))
224 return false; 224 return false;
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 389
390 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kStartMaximized)) 390 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kStartMaximized))
391 return ui::SHOW_STATE_MAXIMIZED; 391 return ui::SHOW_STATE_MAXIMIZED;
392 392
393 if (browser_->initial_show_state() != ui::SHOW_STATE_DEFAULT) 393 if (browser_->initial_show_state() != ui::SHOW_STATE_DEFAULT)
394 return browser_->initial_show_state(); 394 return browser_->initial_show_state();
395 395
396 // Otherwise we use the default which can be overridden later on. 396 // Otherwise we use the default which can be overridden later on.
397 return ui::SHOW_STATE_DEFAULT; 397 return ui::SHOW_STATE_DEFAULT;
398 } 398 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698