| 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/common/wm/window_positioner.h" | 5 #include "ash/common/wm/window_positioner.h" |
| 6 | 6 |
| 7 #include "ash/common/wm/mru_window_tracker.h" | 7 #include "ash/common/wm/mru_window_tracker.h" |
| 8 #include "ash/common/wm/window_positioning_utils.h" | 8 #include "ash/common/wm/window_positioning_utils.h" |
| 9 #include "ash/common/wm/window_state.h" | 9 #include "ash/common/wm/window_state.h" |
| 10 #include "ash/common/wm/wm_screen_util.h" | 10 #include "ash/common/wm/wm_screen_util.h" |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 } | 210 } |
| 211 | 211 |
| 212 // static | 212 // static |
| 213 void WindowPositioner::GetBoundsAndShowStateForNewWindow( | 213 void WindowPositioner::GetBoundsAndShowStateForNewWindow( |
| 214 const WmWindow* new_window, | 214 const WmWindow* new_window, |
| 215 bool is_saved_bounds, | 215 bool is_saved_bounds, |
| 216 ui::WindowShowState show_state_in, | 216 ui::WindowShowState show_state_in, |
| 217 gfx::Rect* bounds_in_out, | 217 gfx::Rect* bounds_in_out, |
| 218 ui::WindowShowState* show_state_out) { | 218 ui::WindowShowState* show_state_out) { |
| 219 // Always open new window in the target display. | 219 // Always open new window in the target display. |
| 220 WmWindow* target = WmShell::Get()->GetRootWindowForNewWindows(); | 220 WmWindow* target = WmShell::Get()->root_window_for_new_windows(); |
| 221 | 221 |
| 222 WmWindow* top_window = GetReferenceWindow(target, nullptr, nullptr); | 222 WmWindow* top_window = GetReferenceWindow(target, nullptr, nullptr); |
| 223 // Our window should not have any impact if we are already on top. | 223 // Our window should not have any impact if we are already on top. |
| 224 if (top_window == new_window) | 224 if (top_window == new_window) |
| 225 top_window = nullptr; | 225 top_window = nullptr; |
| 226 | 226 |
| 227 // If there is no valid other window we take and adjust the passed coordinates | 227 // If there is no valid other window we take and adjust the passed coordinates |
| 228 // and show state. | 228 // and show state. |
| 229 if (!top_window) { | 229 if (!top_window) { |
| 230 gfx::Rect work_area = target->GetDisplayNearestWindow().work_area(); | 230 gfx::Rect work_area = target->GetDisplayNearestWindow().work_area(); |
| (...skipping 324 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 |