window_positioner.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // Copyright 2013 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_WM_WINDOW_POSITIONER_H_
  5. #define ASH_WM_WINDOW_POSITIONER_H_
  6. #include "ash/ash_export.h"
  7. #include "ui/base/ui_base_types.h"
  8. namespace aura {
  9. class Window;
  10. }
  11. namespace gfx {
  12. class Rect;
  13. }
  14. namespace ash {
  15. // A collection of utilities that assist with placing new windows.
  16. class ASH_EXPORT WindowPositioner {
  17. public:
  18. // Computes and returns the bounds and show state for new window
  19. // based on the parameter passed AND existing windows. |is_saved_bounds|
  20. // indicates the |bounds_in_out| is the saved bounds.
  21. static void GetBoundsAndShowStateForNewWindow(
  22. bool is_saved_bounds,
  23. ui::WindowShowState show_state_in,
  24. gfx::Rect* bounds_in_out,
  25. ui::WindowShowState* show_state_out);
  26. // Check if after removal or hide of the given |removed_window| an
  27. // automated desktop location management can be performed and
  28. // rearrange accordingly.
  29. static void RearrangeVisibleWindowOnHideOrRemove(
  30. const aura::Window* removed_window);
  31. // Turn the automatic positioning logic temporarily off. Returns the previous
  32. // state.
  33. static bool DisableAutoPositioning(bool ignore);
  34. // Check if after insertion or showing of the given |added_window|
  35. // an automated desktop location management can be performed and
  36. // rearrange accordingly.
  37. static void RearrangeVisibleWindowOnShow(aura::Window* added_window);
  38. WindowPositioner();
  39. WindowPositioner(const WindowPositioner&) = delete;
  40. WindowPositioner& operator=(const WindowPositioner&) = delete;
  41. ~WindowPositioner();
  42. protected:
  43. friend class WindowPositionerTest;
  44. static constexpr int kWindowOffset = 32;
  45. };
  46. } // namespace ash
  47. #endif // ASH_WM_WINDOW_POSITIONER_H_