| 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/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/shell_port.h" |
| 8 #include "ash/wm/mru_window_tracker.h" | 9 #include "ash/wm/mru_window_tracker.h" |
| 9 #include "ash/wm/window_positioning_utils.h" | 10 #include "ash/wm/window_positioning_utils.h" |
| 10 #include "ash/wm/window_state.h" | 11 #include "ash/wm/window_state.h" |
| 11 #include "ash/wm/window_util.h" | 12 #include "ash/wm/window_util.h" |
| 12 #include "ash/wm/wm_screen_util.h" | 13 #include "ash/wm/wm_screen_util.h" |
| 13 #include "ash/wm_shell.h" | |
| 14 #include "ash/wm_window.h" | 14 #include "ash/wm_window.h" |
| 15 #include "ui/compositor/layer.h" | 15 #include "ui/compositor/layer.h" |
| 16 #include "ui/display/display.h" | 16 #include "ui/display/display.h" |
| 17 #include "ui/display/screen.h" | 17 #include "ui/display/screen.h" |
| 18 #include "ui/gfx/geometry/insets.h" | 18 #include "ui/gfx/geometry/insets.h" |
| 19 | 19 |
| 20 namespace ash { | 20 namespace ash { |
| 21 | 21 |
| 22 const int WindowPositioner::kMinimumWindowOffset = 32; | 22 const int WindowPositioner::kMinimumWindowOffset = 32; |
| 23 | 23 |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 if (!top_window) { | 230 if (!top_window) { |
| 231 gfx::Rect work_area = target->GetDisplayNearestWindow().work_area(); | 231 gfx::Rect work_area = target->GetDisplayNearestWindow().work_area(); |
| 232 | 232 |
| 233 bounds_in_out->AdjustToFit(work_area); | 233 bounds_in_out->AdjustToFit(work_area); |
| 234 // Use adjusted saved bounds, if there is one. | 234 // Use adjusted saved bounds, if there is one. |
| 235 if (is_saved_bounds) | 235 if (is_saved_bounds) |
| 236 return; | 236 return; |
| 237 | 237 |
| 238 if (show_state_in == ui::SHOW_STATE_DEFAULT) { | 238 if (show_state_in == ui::SHOW_STATE_DEFAULT) { |
| 239 const bool maximize_first_window_on_first_run = | 239 const bool maximize_first_window_on_first_run = |
| 240 target->GetShell()->IsForceMaximizeOnFirstRun(); | 240 ShellPort::Get()->IsForceMaximizeOnFirstRun(); |
| 241 // We want to always open maximized on "small screens" or when policy | 241 // We want to always open maximized on "small screens" or when policy |
| 242 // tells us to. | 242 // tells us to. |
| 243 const bool set_maximized = | 243 const bool set_maximized = |
| 244 maximize_first_window || | 244 maximize_first_window || |
| 245 ((work_area.width() <= GetForceMaximizedWidthLimit() || | 245 ((work_area.width() <= GetForceMaximizedWidthLimit() || |
| 246 maximize_first_window_on_first_run) && | 246 maximize_first_window_on_first_run) && |
| 247 (!new_window || !new_window->GetWindowState()->IsFullscreen())); | 247 (!new_window || !new_window->GetWindowState()->IsFullscreen())); |
| 248 | 248 |
| 249 if (set_maximized) | 249 if (set_maximized) |
| 250 *show_state_out = ui::SHOW_STATE_MAXIMIZED; | 250 *show_state_out = ui::SHOW_STATE_MAXIMIZED; |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 // If the alignment was pushing the window out of the screen, we ignore the | 555 // If the alignment was pushing the window out of the screen, we ignore the |
| 556 // alignment for that call. | 556 // alignment for that call. |
| 557 if (abs(pos.right() - work_area.right()) < grid) | 557 if (abs(pos.right() - work_area.right()) < grid) |
| 558 x = work_area.right() - w; | 558 x = work_area.right() - w; |
| 559 if (abs(pos.bottom() - work_area.bottom()) < grid) | 559 if (abs(pos.bottom() - work_area.bottom()) < grid) |
| 560 y = work_area.bottom() - h; | 560 y = work_area.bottom() - h; |
| 561 return gfx::Rect(x, y, w, h); | 561 return gfx::Rect(x, y, w, h); |
| 562 } | 562 } |
| 563 | 563 |
| 564 } // namespace ash | 564 } // namespace ash |
| OLD | NEW |