overlay_layout_manager.cc 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. #include "ash/wm/overlay_layout_manager.h"
  5. #include "ash/wm/window_state.h"
  6. #include "ash/wm/wm_event.h"
  7. #include "base/check.h"
  8. #include "ui/aura/window.h"
  9. #include "ui/display/display.h"
  10. #include "ui/display/screen.h"
  11. using display::Screen;
  12. namespace ash {
  13. OverlayLayoutManager::OverlayLayoutManager(aura::Window* overlay_container)
  14. : overlay_container_(overlay_container) {
  15. DCHECK(overlay_container_);
  16. }
  17. OverlayLayoutManager::~OverlayLayoutManager() = default;
  18. void OverlayLayoutManager::OnDisplayMetricsChanged(
  19. const display::Display& display,
  20. uint32_t changed_metrics) {
  21. if (display.id() !=
  22. Screen::GetScreen()->GetDisplayNearestWindow(overlay_container_).id()) {
  23. // The update wasn't for this container's display.
  24. return;
  25. }
  26. for (aura::Window* child : overlay_container_->children()) {
  27. WindowState* window_state = WindowState::Get(child);
  28. if (window_state->IsFullscreen()) {
  29. const WMEvent event(WM_EVENT_WORKAREA_BOUNDS_CHANGED);
  30. window_state->OnWMEvent(&event);
  31. }
  32. }
  33. }
  34. } // namespace ash