| 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_util.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" |
| 11 #include "ash/wm/mru_window_tracker.h" | 11 #include "ash/wm/mru_window_tracker.h" |
| 12 #include "ash/wm/window_resizer.h" | 12 #include "ash/wm/window_resizer.h" |
| 13 #include "ash/wm/window_state.h" | 13 #include "ash/wm/window_state.h" |
| 14 #include "ash/wm/window_util.h" | 14 #include "ash/wm/window_util.h" |
| 15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 16 #include "ui/aura/root_window.h" | 16 #include "ui/aura/root_window.h" |
| 17 #include "ui/aura/window.h" | 17 #include "ui/aura/window.h" |
| 18 #include "ui/aura/window_delegate.h" | 18 #include "ui/aura/window_delegate.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 gfx::Rect GetWorkAreaForWindowInParent(aura::Window* window) { | 78 gfx::Rect GetWorkAreaForWindowInParent(aura::Window* window) { |
| 79 #if defined(OS_WIN) | 79 #if defined(OS_WIN) |
| 80 // On Win 8, the host window can't be resized, so | 80 // On Win 8, the host window can't be resized, so |
| 81 // use window's bounds instead. | 81 // use window's bounds instead. |
| 82 // TODO(oshima): Emulate host window resize on win8. | 82 // TODO(oshima): Emulate host window resize on win8. |
| 83 gfx::Rect work_area = gfx::Rect(window->parent()->bounds().size()); | 83 gfx::Rect work_area = gfx::Rect(window->parent()->bounds().size()); |
| 84 work_area.Inset(Shell::GetScreen()->GetDisplayMatching( | 84 work_area.Inset(Shell::GetScreen()->GetDisplayMatching( |
| 85 window->parent()->GetBoundsInScreen()).GetWorkAreaInsets()); | 85 window->parent()->GetBoundsInScreen()).GetWorkAreaInsets()); |
| 86 return work_area; | 86 return work_area; |
| 87 #else | 87 #else |
| 88 return ScreenAsh::GetDisplayWorkAreaBoundsInParent(window); | 88 return ScreenUtil::GetDisplayWorkAreaBoundsInParent(window); |
| 89 #endif | 89 #endif |
| 90 } | 90 } |
| 91 | 91 |
| 92 // Move the given |bounds| on the available |work_area| in the direction | 92 // Move the given |bounds| on the available |work_area| in the direction |
| 93 // indicated by |move_right|. If |move_right| is true, the rectangle gets moved | 93 // indicated by |move_right|. If |move_right| is true, the rectangle gets moved |
| 94 // to the right edge, otherwise to the left one. | 94 // to the right edge, otherwise to the left one. |
| 95 bool MoveRectToOneSide(const gfx::Rect& work_area, | 95 bool MoveRectToOneSide(const gfx::Rect& work_area, |
| 96 bool move_right, | 96 bool move_right, |
| 97 gfx::Rect* bounds) { | 97 gfx::Rect* bounds) { |
| 98 if (move_right) { | 98 if (move_right) { |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 // 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 |
| 537 // alignment for that call. | 537 // alignment for that call. |
| 538 if (abs(pos.right() - work_area.right()) < grid) | 538 if (abs(pos.right() - work_area.right()) < grid) |
| 539 x = work_area.right() - w; | 539 x = work_area.right() - w; |
| 540 if (abs(pos.bottom() - work_area.bottom()) < grid) | 540 if (abs(pos.bottom() - work_area.bottom()) < grid) |
| 541 y = work_area.bottom() - h; | 541 y = work_area.bottom() - h; |
| 542 return gfx::Rect(x, y, w, h); | 542 return gfx::Rect(x, y, w, h); |
| 543 } | 543 } |
| 544 | 544 |
| 545 } // namespace ash | 545 } // namespace ash |
| OLD | NEW |