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