persistent_window_info.cc 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  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/display/persistent_window_info.h"
  5. #include "ash/wm/window_state.h"
  6. #include "ui/aura/window.h"
  7. #include "ui/display/display.h"
  8. #include "ui/display/screen.h"
  9. namespace ash {
  10. PersistentWindowInfo::PersistentWindowInfo(aura::Window* window,
  11. bool is_landscape_before_rotation)
  12. : is_landscape(is_landscape_before_rotation) {
  13. const auto& display =
  14. display::Screen::GetScreen()->GetDisplayNearestWindow(window);
  15. window_bounds_in_screen = window->GetBoundsInScreen();
  16. display_id = display.id();
  17. display_bounds_in_screen = display.bounds();
  18. WindowState* window_state = WindowState::Get(window);
  19. DCHECK(window_state);
  20. if (window_state->HasRestoreBounds())
  21. restore_bounds_in_screen = window_state->GetRestoreBoundsInScreen();
  22. }
  23. PersistentWindowInfo::PersistentWindowInfo(const PersistentWindowInfo& other) =
  24. default;
  25. PersistentWindowInfo::~PersistentWindowInfo() = default;
  26. } // namespace ash