| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 DCHECK(show_state); | 181 DCHECK(show_state); |
| 182 // Pre-populate the window state with our default. | 182 // Pre-populate the window state with our default. |
| 183 *show_state = GetWindowDefaultShowState(); | 183 *show_state = GetWindowDefaultShowState(); |
| 184 *bounds = specified_bounds; | 184 *bounds = specified_bounds; |
| 185 if (bounds->IsEmpty()) { | 185 if (bounds->IsEmpty()) { |
| 186 #if defined(USE_ASH) | 186 #if defined(USE_ASH) |
| 187 // See if ash should decide the window placement. | 187 // See if ash should decide the window placement. |
| 188 if (IsTabbedBrowserInAsh()) { | 188 if (IsTabbedBrowserInAsh()) { |
| 189 GetTabbedBrowserBoundsAsh(bounds, show_state); | 189 GetTabbedBrowserBoundsAsh(bounds, show_state); |
| 190 return; | 190 return; |
| 191 } else if (chrome::ShouldOpenAshOnStartup() && | 191 } else if (browser_ && browser_->host_desktop_type() == |
| 192 browser_ && browser_->host_desktop_type() == | |
| 193 chrome::HOST_DESKTOP_TYPE_ASH) { | 192 chrome::HOST_DESKTOP_TYPE_ASH) { |
| 194 // In ash, saved show state takes precidence. If you have a | 193 // In ash, saved show state takes precidence. If you have a |
| 195 // question or an issue, please contact oshima@chromium.org. | 194 // question or an issue, please contact oshima@chromium.org. |
| 196 GetSavedWindowBounds(bounds, show_state); | 195 GetSavedWindowBounds(bounds, show_state); |
| 197 } | 196 } |
| 198 #endif | 197 #endif |
| 199 // See if there's last active window's placement information. | 198 // See if there's last active window's placement information. |
| 200 if (GetLastWindowBounds(bounds, show_state)) | 199 if (GetLastWindowBounds(bounds, show_state)) |
| 201 return; | 200 return; |
| 202 // See if there's saved placement information. | 201 // See if there's saved placement information. |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 | 391 |
| 393 if (browser_->initial_show_state() != ui::SHOW_STATE_DEFAULT) | 392 if (browser_->initial_show_state() != ui::SHOW_STATE_DEFAULT) |
| 394 return browser_->initial_show_state(); | 393 return browser_->initial_show_state(); |
| 395 | 394 |
| 396 // Otherwise we use the default which can be overridden later on. | 395 // Otherwise we use the default which can be overridden later on. |
| 397 return ui::SHOW_STATE_DEFAULT; | 396 return ui::SHOW_STATE_DEFAULT; |
| 398 } | 397 } |
| 399 | 398 |
| 400 #if defined(USE_ASH) | 399 #if defined(USE_ASH) |
| 401 bool WindowSizer::IsTabbedBrowserInAsh() const { | 400 bool WindowSizer::IsTabbedBrowserInAsh() const { |
| 402 // TODO(beng): insufficient but currently necessary. http://crbug.com/133312 | 401 return browser_ && |
| 403 return chrome::ShouldOpenAshOnStartup() && | |
| 404 browser_ && | |
| 405 browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH && | 402 browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH && |
| 406 browser_->is_type_tabbed(); | 403 browser_->is_type_tabbed(); |
| 407 } | 404 } |
| 408 | 405 |
| 409 bool WindowSizer::IsPopupBrowserInAsh() const { | 406 bool WindowSizer::IsPopupBrowserInAsh() const { |
| 410 // TODO(beng): insufficient but currently necessary. http://crbug.com/133312 | 407 return browser_ && |
| 411 return chrome::ShouldOpenAshOnStartup() && | |
| 412 browser_ && | |
| 413 browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH && | 408 browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH && |
| 414 browser_->is_type_popup(); | 409 browser_->is_type_popup(); |
| 415 } | 410 } |
| 416 #endif | 411 #endif |
| OLD | NEW |