| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef ASH_COMMON_WM_WINDOW_POSITIONING_UTILS_H_ | |
| 6 #define ASH_COMMON_WM_WINDOW_POSITIONING_UTILS_H_ | |
| 7 | |
| 8 #include "ash/ash_export.h" | |
| 9 | |
| 10 namespace display { | |
| 11 class Display; | |
| 12 } | |
| 13 | |
| 14 namespace gfx { | |
| 15 class Rect; | |
| 16 class Size; | |
| 17 } | |
| 18 | |
| 19 namespace ash { | |
| 20 | |
| 21 class WmWindow; | |
| 22 | |
| 23 namespace wm { | |
| 24 | |
| 25 // We force at least this many DIPs for any window on the screen. | |
| 26 const int kMinimumOnScreenArea = 25; | |
| 27 | |
| 28 // Adjusts |bounds| so that the size does not exceed |max_size|. | |
| 29 ASH_EXPORT void AdjustBoundsSmallerThan(const gfx::Size& max_size, | |
| 30 gfx::Rect* bounds); | |
| 31 | |
| 32 // Move the given bounds inside the given |visible_area| in parent coordinates, | |
| 33 // including a safety margin given by |min_width| and |min_height|. | |
| 34 // This also ensures that the top of the bounds is visible. | |
| 35 ASH_EXPORT void AdjustBoundsToEnsureWindowVisibility( | |
| 36 const gfx::Rect& visible_area, | |
| 37 int min_width, | |
| 38 int min_height, | |
| 39 gfx::Rect* bounds); | |
| 40 | |
| 41 // Move the given bounds inside the given |visible_area| in parent coordinates, | |
| 42 // including a safety margin given by |kMinimumOnScreenArea|. | |
| 43 // This also ensures that the top of the bounds is visible. | |
| 44 ASH_EXPORT void AdjustBoundsToEnsureMinimumWindowVisibility( | |
| 45 const gfx::Rect& visible_area, | |
| 46 gfx::Rect* bounds); | |
| 47 | |
| 48 // Returns the bounds of a left snapped window with default width in parent | |
| 49 // coordinates. | |
| 50 ASH_EXPORT gfx::Rect GetDefaultLeftSnappedWindowBoundsInParent( | |
| 51 WmWindow* window); | |
| 52 | |
| 53 // Returns the bounds of a right snapped window with default width in parent | |
| 54 // coordinates. | |
| 55 ASH_EXPORT gfx::Rect GetDefaultRightSnappedWindowBoundsInParent( | |
| 56 WmWindow* window); | |
| 57 | |
| 58 // Moves the window to the center of the display. | |
| 59 ASH_EXPORT void CenterWindow(WmWindow* window); | |
| 60 | |
| 61 // Sets the bounds of |window| to |bounds_in_screen|. This may move |window| | |
| 62 // to |display| if necessary. | |
| 63 ASH_EXPORT void SetBoundsInScreen(WmWindow* window, | |
| 64 const gfx::Rect& bounds_in_screen, | |
| 65 const display::Display& display); | |
| 66 | |
| 67 } // namespace wm | |
| 68 } // namespace ash | |
| 69 | |
| 70 #endif // ASH_COMMON_WM_WINDOW_POSITIONING_UTILS_H_ | |
| OLD | NEW |