| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 // ASH. This ensures that the display gets the correct workarea, etc. | 150 // ASH. This ensures that the display gets the correct workarea, etc. |
| 151 // If the ASH shell does not exist then the current behavior is to open | 151 // If the ASH shell does not exist then the current behavior is to open |
| 152 // browser windows if any on the desktop. Preserve that for now. | 152 // browser windows if any on the desktop. Preserve that for now. |
| 153 // TODO(ananta). | 153 // TODO(ananta). |
| 154 // This effectively means that the running browser process is in a split | 154 // This effectively means that the running browser process is in a split |
| 155 // personality mode, part of it running in ASH and the other running in | 155 // personality mode, part of it running in ASH and the other running in |
| 156 // desktop. This may cause apps and other widgets to not work correctly. | 156 // desktop. This may cause apps and other widgets to not work correctly. |
| 157 // Revisit and address. | 157 // Revisit and address. |
| 158 #if defined(OS_WIN) | 158 #if defined(OS_WIN) |
| 159 force_ash = ash::Shell::HasInstance() && | 159 force_ash = ash::Shell::HasInstance() && |
| 160 CommandLine::ForCurrentProcess()->HasSwitch(switches::kViewerConnect); | 160 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 161 switches::kViewerConnect); |
| 161 #endif | 162 #endif |
| 162 // Use the target display on ash. | 163 // Use the target display on ash. |
| 163 if (chrome::ShouldOpenAshOnStartup() || force_ash) { | 164 if (chrome::ShouldOpenAshOnStartup() || force_ash) { |
| 164 aura::Window* target = ash::Shell::GetTargetRootWindow(); | 165 aura::Window* target = ash::Shell::GetTargetRootWindow(); |
| 165 return screen->GetDisplayNearestWindow(target); | 166 return screen->GetDisplayNearestWindow(target); |
| 166 } | 167 } |
| 167 #endif | 168 #endif |
| 168 // Find the size of the work area of the monitor that intersects the bounds | 169 // Find the size of the work area of the monitor that intersects the bounds |
| 169 // of the anchor window. | 170 // of the anchor window. |
| 170 return screen->GetDisplayMatching(bounds); | 171 return screen->GetDisplayMatching(bounds); |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 bool show_state = !browser_->is_type_tabbed() && !browser_->is_devtools(); | 425 bool show_state = !browser_->is_type_tabbed() && !browser_->is_devtools(); |
| 425 | 426 |
| 426 #if defined(USE_AURA) | 427 #if defined(USE_AURA) |
| 427 // We use the apps save state on aura. | 428 // We use the apps save state on aura. |
| 428 show_state &= !browser_->is_app(); | 429 show_state &= !browser_->is_app(); |
| 429 #endif | 430 #endif |
| 430 | 431 |
| 431 if (show_state) | 432 if (show_state) |
| 432 return browser_->initial_show_state(); | 433 return browser_->initial_show_state(); |
| 433 | 434 |
| 434 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kStartMaximized)) | 435 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 436 switches::kStartMaximized)) |
| 435 return ui::SHOW_STATE_MAXIMIZED; | 437 return ui::SHOW_STATE_MAXIMIZED; |
| 436 | 438 |
| 437 if (browser_->initial_show_state() != ui::SHOW_STATE_DEFAULT) | 439 if (browser_->initial_show_state() != ui::SHOW_STATE_DEFAULT) |
| 438 return browser_->initial_show_state(); | 440 return browser_->initial_show_state(); |
| 439 | 441 |
| 440 // Otherwise we use the default which can be overridden later on. | 442 // Otherwise we use the default which can be overridden later on. |
| 441 return ui::SHOW_STATE_DEFAULT; | 443 return ui::SHOW_STATE_DEFAULT; |
| 442 } | 444 } |
| OLD | NEW |