persistent_window_info.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // Copyright 2018 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_DISPLAY_PERSISTENT_WINDOW_INFO_H_
  5. #define ASH_DISPLAY_PERSISTENT_WINDOW_INFO_H_
  6. #include <stdint.h>
  7. #include "ash/ash_export.h"
  8. #include "third_party/abseil-cpp/absl/types/optional.h"
  9. #include "ui/gfx/geometry/rect.h"
  10. namespace aura {
  11. class Window;
  12. } // namespace aura
  13. namespace ash {
  14. // Describes the information that each window needs to carry for persistent
  15. // window placement in multi-displays or screen rotation scenario.
  16. struct ASH_EXPORT PersistentWindowInfo {
  17. // `is_landscape_before_rotation` indicates the screen orientation before
  18. // screen rotation happens. This is used to help restore window bounds in
  19. // screen rotation scenario.
  20. PersistentWindowInfo(aura::Window* window, bool is_landscape_before_rotation);
  21. PersistentWindowInfo(const PersistentWindowInfo& other);
  22. ~PersistentWindowInfo();
  23. // Persistent window bounds in screen coordinates.
  24. gfx::Rect window_bounds_in_screen;
  25. // Indicates the display to restore to in multi-displays scenario or the
  26. // display on which screen rotation happens.
  27. int64_t display_id;
  28. // Indicates last display bounds for |display_id| in screen coordinates.
  29. gfx::Rect display_bounds_in_screen;
  30. // True if it is in landscape orientation before screen orientation happens.
  31. // Note, this is only meaningful in the screen rotation scenario.
  32. bool is_landscape;
  33. // Stores the restore bounds in screen coordinates if they exist.
  34. absl::optional<gfx::Rect> restore_bounds_in_screen;
  35. };
  36. } // namespace ash
  37. #endif // ASH_DISPLAY_PERSISTENT_WINDOW_INFO_H_