| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |