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

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: cc/ fixes 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 } else { 211 } else {
212 // In case that there was a bound given we need to make sure that it is 212 // In case that there was a bound given we need to make sure that it is
213 // visible and fits on the screen. 213 // visible and fits on the screen.
214 // Find the size of the work area of the monitor that intersects the bounds 214 // Find the size of the work area of the monitor that intersects the bounds
215 // of the anchor window. Note: AdjustBoundsToBeVisibleOnMonitorContaining 215 // of the anchor window. Note: AdjustBoundsToBeVisibleOnMonitorContaining
216 // does not exactly what we want: It makes only sure that "a minimal part" 216 // does not exactly what we want: It makes only sure that "a minimal part"
217 // is visible on the screen. 217 // is visible on the screen.
218 gfx::Rect work_area = 218 gfx::Rect work_area =
219 monitor_info_provider_->GetMonitorWorkAreaMatching(*bounds); 219 monitor_info_provider_->GetMonitorWorkAreaMatching(*bounds);
220 // Resize so that it fits. 220 // Resize so that it fits.
221 *bounds = bounds->AdjustToFit(work_area); 221 bounds->AdjustToFit(work_area);
222 } 222 }
223 } 223 }
224 224
225 bool WindowSizer::GetLastWindowBounds(gfx::Rect* bounds, 225 bool WindowSizer::GetLastWindowBounds(gfx::Rect* bounds,
226 ui::WindowShowState* show_state) const { 226 ui::WindowShowState* show_state) const {
227 DCHECK(bounds); 227 DCHECK(bounds);
228 DCHECK(show_state); 228 DCHECK(show_state);
229 if (!state_provider_.get() || 229 if (!state_provider_.get() ||
230 !state_provider_->GetLastActiveWindowState(bounds, show_state)) 230 !state_provider_->GetLastActiveWindowState(bounds, show_state))
231 return false; 231 return false;
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 396
397 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kStartMaximized)) 397 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kStartMaximized))
398 return ui::SHOW_STATE_MAXIMIZED; 398 return ui::SHOW_STATE_MAXIMIZED;
399 399
400 if (browser_->initial_show_state() != ui::SHOW_STATE_DEFAULT) 400 if (browser_->initial_show_state() != ui::SHOW_STATE_DEFAULT)
401 return browser_->initial_show_state(); 401 return browser_->initial_show_state();
402 402
403 // Otherwise we use the default which can be overridden later on. 403 // Otherwise we use the default which can be overridden later on.
404 return ui::SHOW_STATE_DEFAULT; 404 return ui::SHOW_STATE_DEFAULT;
405 } 405 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/toolbar_view.cc ('k') | chrome/browser/ui/window_sizer/window_sizer_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698