| 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 139 |
| 140 class DefaultTargetDisplayProvider : public WindowSizer::TargetDisplayProvider { | 140 class DefaultTargetDisplayProvider : public WindowSizer::TargetDisplayProvider { |
| 141 public: | 141 public: |
| 142 DefaultTargetDisplayProvider() {} | 142 DefaultTargetDisplayProvider() {} |
| 143 virtual ~DefaultTargetDisplayProvider() {} | 143 virtual ~DefaultTargetDisplayProvider() {} |
| 144 | 144 |
| 145 virtual gfx::Display GetTargetDisplay( | 145 virtual gfx::Display GetTargetDisplay( |
| 146 const gfx::Screen* screen, | 146 const gfx::Screen* screen, |
| 147 const gfx::Rect& bounds) const OVERRIDE { | 147 const gfx::Rect& bounds) const OVERRIDE { |
| 148 #if defined(USE_ASH) | 148 #if defined(USE_ASH) |
| 149 bool force_ash = false; |
| 150 // On Windows check if the browser is launched to serve ASH. If yes then |
| 151 // we should get the display for the corresponding root window created for |
| 152 // ASH. This ensures that the display gets the correct workarea, etc. |
| 153 #if defined(OS_WIN) |
| 154 force_ash = chrome::IsAshProcess(); |
| 155 #endif |
| 149 // Use the target display on ash. | 156 // Use the target display on ash. |
| 150 if (chrome::ShouldOpenAshOnStartup()) { | 157 if (chrome::ShouldOpenAshOnStartup() || force_ash) { |
| 151 aura::Window* target = ash::Shell::GetTargetRootWindow(); | 158 aura::Window* target = ash::Shell::GetTargetRootWindow(); |
| 152 return screen->GetDisplayNearestWindow(target); | 159 return screen->GetDisplayNearestWindow(target); |
| 153 } | 160 } |
| 154 #endif | 161 #endif |
| 155 // Find the size of the work area of the monitor that intersects the bounds | 162 // Find the size of the work area of the monitor that intersects the bounds |
| 156 // of the anchor window. | 163 // of the anchor window. |
| 157 return screen->GetDisplayMatching(bounds); | 164 return screen->GetDisplayMatching(bounds); |
| 158 } | 165 } |
| 159 | 166 |
| 160 private: | 167 private: |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 | 427 |
| 421 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kStartMaximized)) | 428 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kStartMaximized)) |
| 422 return ui::SHOW_STATE_MAXIMIZED; | 429 return ui::SHOW_STATE_MAXIMIZED; |
| 423 | 430 |
| 424 if (browser_->initial_show_state() != ui::SHOW_STATE_DEFAULT) | 431 if (browser_->initial_show_state() != ui::SHOW_STATE_DEFAULT) |
| 425 return browser_->initial_show_state(); | 432 return browser_->initial_show_state(); |
| 426 | 433 |
| 427 // Otherwise we use the default which can be overridden later on. | 434 // Otherwise we use the default which can be overridden later on. |
| 428 return ui::SHOW_STATE_DEFAULT; | 435 return ui::SHOW_STATE_DEFAULT; |
| 429 } | 436 } |
| OLD | NEW |