| 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 "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/wm/window_cycle_controller.h" | 9 #include "ash/wm/window_cycle_controller.h" |
| 10 #include "ash/wm/window_util.h" | 10 #include "ash/wm/window_util.h" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 ui::WindowShowState* show_state) const { | 152 ui::WindowShowState* show_state) const { |
| 153 DCHECK(show_state); | 153 DCHECK(show_state); |
| 154 DCHECK(bounds_in_screen); | 154 DCHECK(bounds_in_screen); |
| 155 | 155 |
| 156 if (browser_ && | 156 if (browser_ && |
| 157 browser_->host_desktop_type() != chrome::HOST_DESKTOP_TYPE_ASH) { | 157 browser_->host_desktop_type() != chrome::HOST_DESKTOP_TYPE_ASH) { |
| 158 return false; | 158 return false; |
| 159 } | 159 } |
| 160 bounds_in_screen->SetRect(0, 0, 0, 0); | 160 bounds_in_screen->SetRect(0, 0, 0, 0); |
| 161 | 161 |
| 162 // Experiment: Force the maximize mode for all windows. |
| 163 if (ash::Shell::IsForcedMaximizeMode()) { |
| 164 // Exceptions: Do not maximize popups and do not maximize windowed V1 apps |
| 165 // which explicitly specify a |show_state| (they might be tuned for a |
| 166 // particular resolution / type). |
| 167 bool is_tabbed = browser_ && browser_->is_type_tabbed(); |
| 168 bool is_popup = browser_ && browser_->is_type_popup(); |
| 169 if (!is_popup && (is_tabbed || *show_state == ui::SHOW_STATE_DEFAULT)) |
| 170 *show_state = ui::SHOW_STATE_MAXIMIZED; |
| 171 } |
| 172 |
| 162 ui::WindowShowState passed_show_state = *show_state; | 173 ui::WindowShowState passed_show_state = *show_state; |
| 163 if (!GetSavedWindowBounds(bounds_in_screen, show_state)) | 174 if (!GetSavedWindowBounds(bounds_in_screen, show_state)) |
| 164 GetDefaultWindowBounds(bounds_in_screen); | 175 GetDefaultWindowBounds(bounds_in_screen); |
| 165 | 176 |
| 166 if (browser_ && browser_->is_type_tabbed()) { | 177 if (browser_ && browser_->is_type_tabbed()) { |
| 167 aura::RootWindow* active = ash::Shell::GetActiveRootWindow(); | 178 aura::RootWindow* active = ash::Shell::GetActiveRootWindow(); |
| 168 // Always open new window in the active display. | 179 // Always open new window in the active display. |
| 169 gfx::Rect active_area = active->GetBoundsInScreen(); | 180 gfx::Rect active_area = active->GetBoundsInScreen(); |
| 170 gfx::Rect work_area = | 181 gfx::Rect work_area = |
| 171 monitor_info_provider_->GetMonitorWorkAreaMatching(active_area); | 182 monitor_info_provider_->GetMonitorWorkAreaMatching(active_area); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 if (default_width > kMaximumWindowWidth) { | 249 if (default_width > kMaximumWindowWidth) { |
| 239 // The window should get centered on the screen and not follow the grid. | 250 // The window should get centered on the screen and not follow the grid. |
| 240 offset_x = (work_area.width() - kMaximumWindowWidth) / 2; | 251 offset_x = (work_area.width() - kMaximumWindowWidth) / 2; |
| 241 default_width = kMaximumWindowWidth; | 252 default_width = kMaximumWindowWidth; |
| 242 } | 253 } |
| 243 default_bounds->SetRect(work_area.x() + offset_x, | 254 default_bounds->SetRect(work_area.x() + offset_x, |
| 244 work_area.y() + kDesktopBorderSize, | 255 work_area.y() + kDesktopBorderSize, |
| 245 default_width, | 256 default_width, |
| 246 default_height); | 257 default_height); |
| 247 } | 258 } |
| OLD | NEW |