blob: 7cdf1feba2357220d136c2e1bacd9a881ed89ac8 [file] [log] [blame]
[email protected]55ad8c12014-01-17 18:24:331// 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"
avidb567a8a2015-12-20 17:07:249#include "base/macros.h"
[email protected]55ad8c12014-01-17 18:24:3310
11namespace aura {
12class Window;
13}
14
15namespace gfx {
16class Display;
17class Rect;
18class Point;
19}
20
oshimaf84b0da722016-04-27 19:47:1921namespace display {
22using Display = gfx::Display;
23}
24
[email protected]55ad8c12014-01-17 18:24:3325namespace ash {
26
27class 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.
oshimaf84b0da722016-04-27 19:47:1932 static display::Display FindDisplayContainingPoint(const gfx::Point& point);
[email protected]55ad8c12014-01-17 18:24:3333
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
oshima96f6a502015-05-02 08:43:3244 // 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.
oshimac0c9eb72015-11-04 02:16:3651 static gfx::Rect GetShelfDisplayBoundsInRoot(aura::Window* window);
oshima96f6a502015-05-02 08:43:3252
[email protected]55ad8c12014-01-17 18:24:3353 // 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
oshimaf84b0da722016-04-27 19:47:1964 // Returns a display::Display object for secondary display. Returns
[email protected]55ad8c12014-01-17 18:24:3365 // invalid display if there is no secondary display connected.
oshimaf84b0da722016-04-27 19:47:1966 static const display::Display& GetSecondaryDisplay();
[email protected]55ad8c12014-01-17 18:24:3367
[email protected]24f5e242014-07-22 02:16:0968 private:
[email protected]55ad8c12014-01-17 18:24:3369 ScreenUtil() {}
70 ~ScreenUtil() {}
71
72 DISALLOW_COPY_AND_ASSIGN(ScreenUtil);
73};
74
75} // namespace ash
76
77#endif // ASH_SCREEN_UTIL_H_