| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_positioning_utils.h" | 5 #include "ash/common/wm/window_positioning_utils.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/common/wm/wm_screen_util.h" | 9 #include "ash/common/wm/wm_screen_util.h" |
| 10 #include "ash/common/wm/wm_window.h" | 10 #include "ash/common/wm_window.h" |
| 11 #include "ui/gfx/geometry/rect.h" | 11 #include "ui/gfx/geometry/rect.h" |
| 12 #include "ui/gfx/geometry/size.h" | 12 #include "ui/gfx/geometry/size.h" |
| 13 | 13 |
| 14 namespace ash { | 14 namespace ash { |
| 15 namespace wm { | 15 namespace wm { |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 // Returns the default width of a snapped window. | 19 // Returns the default width of a snapped window. |
| 20 int GetDefaultSnappedWindowWidth(WmWindow* window) { | 20 int GetDefaultSnappedWindowWidth(WmWindow* window) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 if (bounds->y() < visible_area.y()) | 56 if (bounds->y() < visible_area.y()) |
| 57 bounds->set_y(visible_area.y()); | 57 bounds->set_y(visible_area.y()); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void AdjustBoundsToEnsureMinimumWindowVisibility(const gfx::Rect& visible_area, | 60 void AdjustBoundsToEnsureMinimumWindowVisibility(const gfx::Rect& visible_area, |
| 61 gfx::Rect* bounds) { | 61 gfx::Rect* bounds) { |
| 62 AdjustBoundsToEnsureWindowVisibility(visible_area, kMinimumOnScreenArea, | 62 AdjustBoundsToEnsureWindowVisibility(visible_area, kMinimumOnScreenArea, |
| 63 kMinimumOnScreenArea, bounds); | 63 kMinimumOnScreenArea, bounds); |
| 64 } | 64 } |
| 65 | 65 |
| 66 gfx::Rect GetDefaultLeftSnappedWindowBoundsInParent(wm::WmWindow* window) { | 66 gfx::Rect GetDefaultLeftSnappedWindowBoundsInParent(WmWindow* window) { |
| 67 gfx::Rect work_area_in_parent(GetDisplayWorkAreaBoundsInParent(window)); | 67 gfx::Rect work_area_in_parent(GetDisplayWorkAreaBoundsInParent(window)); |
| 68 return gfx::Rect(work_area_in_parent.x(), work_area_in_parent.y(), | 68 return gfx::Rect(work_area_in_parent.x(), work_area_in_parent.y(), |
| 69 GetDefaultSnappedWindowWidth(window), | 69 GetDefaultSnappedWindowWidth(window), |
| 70 work_area_in_parent.height()); | 70 work_area_in_parent.height()); |
| 71 } | 71 } |
| 72 | 72 |
| 73 gfx::Rect GetDefaultRightSnappedWindowBoundsInParent(wm::WmWindow* window) { | 73 gfx::Rect GetDefaultRightSnappedWindowBoundsInParent(WmWindow* window) { |
| 74 gfx::Rect work_area_in_parent(GetDisplayWorkAreaBoundsInParent(window)); | 74 gfx::Rect work_area_in_parent(GetDisplayWorkAreaBoundsInParent(window)); |
| 75 int width = GetDefaultSnappedWindowWidth(window); | 75 int width = GetDefaultSnappedWindowWidth(window); |
| 76 return gfx::Rect(work_area_in_parent.right() - width, work_area_in_parent.y(), | 76 return gfx::Rect(work_area_in_parent.right() - width, work_area_in_parent.y(), |
| 77 width, work_area_in_parent.height()); | 77 width, work_area_in_parent.height()); |
| 78 } | 78 } |
| 79 | 79 |
| 80 } // namespace wm | 80 } // namespace wm |
| 81 } // namespace ash | 81 } // namespace ash |
| OLD | NEW |