screen_util.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. #ifndef ASH_SCREEN_UTIL_H_
  5. #define ASH_SCREEN_UTIL_H_
  6. #include "ash/ash_export.h"
  7. namespace aura {
  8. class Window;
  9. } // namespace aura
  10. namespace gfx {
  11. class Rect;
  12. } // namespace gfx
  13. namespace ash {
  14. namespace screen_util {
  15. // Returns the bounds for maximized windows in parent coordinates.
  16. // Maximized windows trigger auto-hiding the shelf.
  17. ASH_EXPORT gfx::Rect GetMaximizedWindowBoundsInParent(aura::Window* window);
  18. // Returns the display bounds in parent coordinates.
  19. ASH_EXPORT gfx::Rect GetDisplayBoundsInParent(aura::Window* window);
  20. // Returns the bounds of fullscreened windows in the parent coordinates of
  21. // |window| taking into account the height of the Docked Magnifier and Chromevox
  22. // panel (if they are enabled).
  23. ASH_EXPORT gfx::Rect GetFullscreenWindowBoundsInParent(aura::Window* window);
  24. // Returns the display's work area bounds in parent coordinates.
  25. ASH_EXPORT gfx::Rect GetDisplayWorkAreaBoundsInParent(aura::Window* window);
  26. // Returns the display's work area bounds in parent coordinates on lock
  27. // screen, i.e. for work area with forced bottom alignment.
  28. // Note that unlike |GetDisplayWorkAreaBoundsInParent|, this method uses
  29. // work area bounds that are updated when the screen is locked. For example
  30. // if shelf alignment is set to right before screen lock,
  31. // |GetDisplayWorkAreaBoundsInParent| will return work are bounds for right
  32. // shelf alignment - this method will return work area for bottom shelf
  33. // alignment (which is always used on lock screen).
  34. ASH_EXPORT gfx::Rect GetDisplayWorkAreaBoundsInParentForLockScreen(
  35. aura::Window* window);
  36. // Returns the display's work area bounds on the active desk container.
  37. ASH_EXPORT gfx::Rect GetDisplayWorkAreaBoundsInParentForActiveDeskContainer(
  38. aura::Window* window);
  39. ASH_EXPORT gfx::Rect GetDisplayWorkAreaBoundsInScreenForActiveDeskContainer(
  40. aura::Window* window);
  41. // Returns the bounds of the physical display containing the shelf for
  42. // |window|. Physical displays can differ from logical displays in unified
  43. // desktop mode.
  44. // TODO(oshima): Consider using physical displays in window layout, instead of
  45. // root windows, and only use logical display in display management code.
  46. ASH_EXPORT gfx::Rect GetDisplayBoundsWithShelf(aura::Window* window);
  47. // Returns an adjusted bounds for the given |bounds| by false snapping it to the
  48. // edge of the display in pixel space. It will snap the bounds to the display
  49. // that contains |window|. This will prevent any 1px gaps that you might see at
  50. // the edges of the display. We achieve this by increasing the height and/or the
  51. // width of |bounds| so that in pixel space, they cover the edge of the dispaly.
  52. // |bounds| should be in screen space.
  53. ASH_EXPORT gfx::Rect SnapBoundsToDisplayEdge(const gfx::Rect& bounds,
  54. const aura::Window* window);
  55. // Returns the ideal bounds for the maximized/fullscreen/pinned state,
  56. // takig the shelf behavior into account. The maximized window state should
  57. // not be affected by the shelf bhavior change by fullscreen, but should
  58. // use the fullscreen bounds if the shelf is set to auto hide mode by a user.
  59. ASH_EXPORT gfx::Rect GetIdealBoundsForMaximizedOrFullscreenOrPinnedState(
  60. aura::Window* window);
  61. } // namespace screen_util
  62. } // namespace ash
  63. #endif // ASH_SCREEN_UTIL_H_