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