OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ash/wm/window_positioner.h" | 5 #include "ash/wm/window_positioner.h" |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/screen_ash.h" | 8 #include "ash/screen_ash.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
230 // If there is no valid other window we take and adjust the passed coordinates | 230 // If there is no valid other window we take and adjust the passed coordinates |
231 // and show state. | 231 // and show state. |
232 if (!top_window) { | 232 if (!top_window) { |
233 gfx::Rect work_area = screen->GetDisplayNearestWindow(target).work_area(); | 233 gfx::Rect work_area = screen->GetDisplayNearestWindow(target).work_area(); |
234 | 234 |
235 bounds_in_out->AdjustToFit(work_area); | 235 bounds_in_out->AdjustToFit(work_area); |
236 // Use adjusted saved bounds, if there is one. | 236 // Use adjusted saved bounds, if there is one. |
237 if (is_saved_bounds) | 237 if (is_saved_bounds) |
238 return; | 238 return; |
239 // When using "small screens" we want to always open in full screen mode. | 239 // When using "small screens" we want to always open in full screen mode. |
240 // On Windows 8 ASH we default to SHOW_STATE_MAXIMIZED for the browser | |
241 // window. This is to ensure that we honor metro app conventions by | |
242 // default. | |
240 if (show_state_in == ui::SHOW_STATE_DEFAULT && | 243 if (show_state_in == ui::SHOW_STATE_DEFAULT && |
244 #if !defined(OS_WIN) | |
241 work_area.width() <= GetForceMaximizedWidthLimit() && | 245 work_area.width() <= GetForceMaximizedWidthLimit() && |
sky
2013/11/15 16:53:44
Can this be expressed as a property rather than a
ananta
2013/11/15 19:55:17
Done. Added a property kMaximizeFirstWindow to ash
| |
246 #endif | |
242 (!new_window || !wm::GetWindowState(new_window)->IsFullscreen())) { | 247 (!new_window || !wm::GetWindowState(new_window)->IsFullscreen())) { |
243 *show_state_out = ui::SHOW_STATE_MAXIMIZED; | 248 *show_state_out = ui::SHOW_STATE_MAXIMIZED; |
244 } | 249 } |
245 return; | 250 return; |
246 } | 251 } |
247 bool maximized = wm::GetWindowState(top_window)->IsMaximized(); | 252 bool maximized = wm::GetWindowState(top_window)->IsMaximized(); |
248 // We ignore the saved show state, but look instead for the top level | 253 // We ignore the saved show state, but look instead for the top level |
249 // window's show state. | 254 // window's show state. |
250 if (show_state_in == ui::SHOW_STATE_DEFAULT) { | 255 if (show_state_in == ui::SHOW_STATE_DEFAULT) { |
251 *show_state_out = maximized ? ui::SHOW_STATE_MAXIMIZED : | 256 *show_state_out = maximized ? ui::SHOW_STATE_MAXIMIZED : |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
531 // If the alignment was pushing the window out of the screen, we ignore the | 536 // If the alignment was pushing the window out of the screen, we ignore the |
532 // alignment for that call. | 537 // alignment for that call. |
533 if (abs(pos.right() - work_area.right()) < grid) | 538 if (abs(pos.right() - work_area.right()) < grid) |
534 x = work_area.right() - w; | 539 x = work_area.right() - w; |
535 if (abs(pos.bottom() - work_area.bottom()) < grid) | 540 if (abs(pos.bottom() - work_area.bottom()) < grid) |
536 y = work_area.bottom() - h; | 541 y = work_area.bottom() - h; |
537 return gfx::Rect(x, y, w, h); | 542 return gfx::Rect(x, y, w, h); |
538 } | 543 } |
539 | 544 |
540 } // namespace ash | 545 } // namespace ash |
OLD | NEW |