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 = |
| 155 CommandLine::ForCurrentProcess()->HasSwitch(switches::kViewerConnect); |
| 156 #endif |
149 // Use the target display on ash. | 157 // Use the target display on ash. |
150 if (chrome::ShouldOpenAshOnStartup()) { | 158 if (chrome::ShouldOpenAshOnStartup() || force_ash) { |
151 aura::Window* target = ash::Shell::GetTargetRootWindow(); | 159 aura::Window* target = ash::Shell::GetTargetRootWindow(); |
152 return screen->GetDisplayNearestWindow(target); | 160 return screen->GetDisplayNearestWindow(target); |
153 } | 161 } |
154 #endif | 162 #endif |
155 // Find the size of the work area of the monitor that intersects the bounds | 163 // Find the size of the work area of the monitor that intersects the bounds |
156 // of the anchor window. | 164 // of the anchor window. |
157 return screen->GetDisplayMatching(bounds); | 165 return screen->GetDisplayMatching(bounds); |
158 } | 166 } |
159 | 167 |
160 private: | 168 private: |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 | 428 |
421 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kStartMaximized)) | 429 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kStartMaximized)) |
422 return ui::SHOW_STATE_MAXIMIZED; | 430 return ui::SHOW_STATE_MAXIMIZED; |
423 | 431 |
424 if (browser_->initial_show_state() != ui::SHOW_STATE_DEFAULT) | 432 if (browser_->initial_show_state() != ui::SHOW_STATE_DEFAULT) |
425 return browser_->initial_show_state(); | 433 return browser_->initial_show_state(); |
426 | 434 |
427 // Otherwise we use the default which can be overridden later on. | 435 // Otherwise we use the default which can be overridden later on. |
428 return ui::SHOW_STATE_DEFAULT; | 436 return ui::SHOW_STATE_DEFAULT; |
429 } | 437 } |
OLD | NEW |