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 maximize mode on for all windows (unless explicitly | |
163 // specified otherwise). | |
164 if ((*show_state == ui::SHOW_STATE_DEFAULT || browser_) && | |
sky
2013/05/01 21:01:56
Just to be sure, popups don't hit this code path,
Mr4D (OOO till 08-26)
2013/05/01 22:48:49
Tests said it would not, but I looked at the code
| |
165 ash::Shell::IsForcedMaximizeMode()) | |
166 *show_state = ui::SHOW_STATE_MAXIMIZED; | |
167 | |
162 ui::WindowShowState passed_show_state = *show_state; | 168 ui::WindowShowState passed_show_state = *show_state; |
163 if (!GetSavedWindowBounds(bounds_in_screen, show_state)) | 169 if (!GetSavedWindowBounds(bounds_in_screen, show_state)) |
164 GetDefaultWindowBounds(bounds_in_screen); | 170 GetDefaultWindowBounds(bounds_in_screen); |
165 | 171 |
166 if (browser_ && browser_->is_type_tabbed()) { | 172 if (browser_ && browser_->is_type_tabbed()) { |
167 aura::RootWindow* active = ash::Shell::GetActiveRootWindow(); | 173 aura::RootWindow* active = ash::Shell::GetActiveRootWindow(); |
168 // Always open new window in the active display. | 174 // Always open new window in the active display. |
169 gfx::Rect active_area = active->GetBoundsInScreen(); | 175 gfx::Rect active_area = active->GetBoundsInScreen(); |
170 gfx::Rect work_area = | 176 gfx::Rect work_area = |
171 monitor_info_provider_->GetMonitorWorkAreaMatching(active_area); | 177 monitor_info_provider_->GetMonitorWorkAreaMatching(active_area); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
238 if (default_width > kMaximumWindowWidth) { | 244 if (default_width > kMaximumWindowWidth) { |
239 // The window should get centered on the screen and not follow the grid. | 245 // The window should get centered on the screen and not follow the grid. |
240 offset_x = (work_area.width() - kMaximumWindowWidth) / 2; | 246 offset_x = (work_area.width() - kMaximumWindowWidth) / 2; |
241 default_width = kMaximumWindowWidth; | 247 default_width = kMaximumWindowWidth; |
242 } | 248 } |
243 default_bounds->SetRect(work_area.x() + offset_x, | 249 default_bounds->SetRect(work_area.x() + offset_x, |
244 work_area.y() + kDesktopBorderSize, | 250 work_area.y() + kDesktopBorderSize, |
245 default_width, | 251 default_width, |
246 default_height); | 252 default_height); |
247 } | 253 } |
OLD | NEW |