overlay_layout_manager.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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_WM_OVERLAY_LAYOUT_MANAGER_H_
  5. #define ASH_WM_OVERLAY_LAYOUT_MANAGER_H_
  6. #include "ash/ash_export.h"
  7. #include "ash/wm/wm_default_layout_manager.h"
  8. #include "ui/display/display_observer.h"
  9. namespace aura {
  10. class Window;
  11. }
  12. namespace ash {
  13. // Updates the bounds of widgets in the overlay container whenever the display
  14. // bounds change. Keeps children snapped to pixel bounds.
  15. class ASH_EXPORT OverlayLayoutManager : public WmDefaultLayoutManager,
  16. public display::DisplayObserver {
  17. public:
  18. explicit OverlayLayoutManager(aura::Window* overlay_container);
  19. OverlayLayoutManager(const OverlayLayoutManager&) = delete;
  20. OverlayLayoutManager& operator=(const OverlayLayoutManager&) = delete;
  21. ~OverlayLayoutManager() override;
  22. // display::DisplayObserver:
  23. void OnDisplayMetricsChanged(const display::Display& display,
  24. uint32_t changed_metrics) override;
  25. private:
  26. aura::Window* overlay_container_;
  27. display::ScopedDisplayObserver display_observer_{this};
  28. };
  29. } // namespace ash
  30. #endif // ASH_WM_OVERLAY_LAYOUT_MANAGER_H_