[email protected] | 55ad8c1 | 2014-01-17 18:24:33 | [diff] [blame] | 1 | // Copyright 2014 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_SCREEN_UTIL_H_ |
| 6 | #define ASH_SCREEN_UTIL_H_ |
| 7 | |
| 8 | #include "ash/ash_export.h" |
avi | db567a8a | 2015-12-20 17:07:24 | [diff] [blame] | 9 | #include "base/macros.h" |
[email protected] | 55ad8c1 | 2014-01-17 18:24:33 | [diff] [blame] | 10 | |
| 11 | namespace aura { |
| 12 | class Window; |
| 13 | } |
| 14 | |
| 15 | namespace gfx { |
| 16 | class Display; |
| 17 | class Rect; |
| 18 | class Point; |
| 19 | } |
| 20 | |
oshima | f84b0da72 | 2016-04-27 19:47:19 | [diff] [blame] | 21 | namespace display { |
| 22 | using Display = gfx::Display; |
| 23 | } |
| 24 | |
[email protected] | 55ad8c1 | 2014-01-17 18:24:33 | [diff] [blame] | 25 | namespace ash { |
| 26 | |
| 27 | class ASH_EXPORT ScreenUtil { |
| 28 | public: |
| 29 | // Finds the display that contains |point| in screeen coordinates. |
| 30 | // Returns invalid display if there is no display that can satisfy |
| 31 | // the condition. |
oshima | f84b0da72 | 2016-04-27 19:47:19 | [diff] [blame] | 32 | static display::Display FindDisplayContainingPoint(const gfx::Point& point); |
[email protected] | 55ad8c1 | 2014-01-17 18:24:33 | [diff] [blame] | 33 | |
| 34 | // Returns the bounds for maximized windows in parent coordinates. |
| 35 | // Maximized windows trigger auto-hiding the shelf. |
| 36 | static gfx::Rect GetMaximizedWindowBoundsInParent(aura::Window* window); |
| 37 | |
| 38 | // Returns the display bounds in parent coordinates. |
| 39 | static gfx::Rect GetDisplayBoundsInParent(aura::Window* window); |
| 40 | |
| 41 | // Returns the display's work area bounds in parent coordinates. |
| 42 | static gfx::Rect GetDisplayWorkAreaBoundsInParent(aura::Window* window); |
| 43 | |
oshima | 96f6a50 | 2015-05-02 08:43:32 | [diff] [blame] | 44 | // Returns the physical display bounds containing the shelf that |
| 45 | // shares the same root window as |root|. Physical displays can |
| 46 | // differ from logical displays in unified desktop mode. |
| 47 | // TODO(oshima): If we need to expand the unified desktop support to |
| 48 | // general use, we should consider always using physical display in |
| 49 | // window layout instead of root window, and keep the logical |
| 50 | // display only in display management code. |
oshima | c0c9eb7 | 2015-11-04 02:16:36 | [diff] [blame] | 51 | static gfx::Rect GetShelfDisplayBoundsInRoot(aura::Window* window); |
oshima | 96f6a50 | 2015-05-02 08:43:32 | [diff] [blame] | 52 | |
[email protected] | 55ad8c1 | 2014-01-17 18:24:33 | [diff] [blame] | 53 | // TODO(oshima): Move following two to wm/coordinate_conversion.h |
| 54 | // Converts |rect| from |window|'s coordinates to the virtual screen |
| 55 | // coordinates. |
| 56 | static gfx::Rect ConvertRectToScreen(aura::Window* window, |
| 57 | const gfx::Rect& rect); |
| 58 | |
| 59 | // Converts |rect| from virtual screen coordinates to the |window|'s |
| 60 | // coordinates. |
| 61 | static gfx::Rect ConvertRectFromScreen(aura::Window* window, |
| 62 | const gfx::Rect& rect); |
| 63 | |
oshima | f84b0da72 | 2016-04-27 19:47:19 | [diff] [blame] | 64 | // Returns a display::Display object for secondary display. Returns |
[email protected] | 55ad8c1 | 2014-01-17 18:24:33 | [diff] [blame] | 65 | // invalid display if there is no secondary display connected. |
oshima | f84b0da72 | 2016-04-27 19:47:19 | [diff] [blame] | 66 | static const display::Display& GetSecondaryDisplay(); |
[email protected] | 55ad8c1 | 2014-01-17 18:24:33 | [diff] [blame] | 67 | |
[email protected] | 24f5e24 | 2014-07-22 02:16:09 | [diff] [blame] | 68 | private: |
[email protected] | 55ad8c1 | 2014-01-17 18:24:33 | [diff] [blame] | 69 | ScreenUtil() {} |
| 70 | ~ScreenUtil() {} |
| 71 | |
| 72 | DISALLOW_COPY_AND_ASSIGN(ScreenUtil); |
| 73 | }; |
| 74 | |
| 75 | } // namespace ash |
| 76 | |
| 77 | #endif // ASH_SCREEN_UTIL_H_ |