| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/mus/ws/window_manager_state.h" | 5 #include "components/mus/ws/window_manager_state.h" |
| 6 | 6 |
| 7 #include "components/mus/ws/connection_manager.h" | 7 #include "components/mus/ws/connection_manager.h" |
| 8 #include "components/mus/ws/display_manager.h" |
| 8 #include "components/mus/ws/server_window.h" | 9 #include "components/mus/ws/server_window.h" |
| 9 #include "mojo/shell/public/interfaces/connector.mojom.h" | 10 #include "mojo/shell/public/interfaces/connector.mojom.h" |
| 10 | 11 |
| 11 namespace mus { | 12 namespace mus { |
| 12 namespace ws { | 13 namespace ws { |
| 13 | 14 |
| 14 WindowManagerState::WindowManagerState(Display* display) | 15 WindowManagerState::WindowManagerState(Display* display) |
| 15 : WindowManagerState(display, false, mojo::shell::mojom::kRootUserID) {} | 16 : WindowManagerState(display, false, mojo::shell::mojom::kRootUserID) {} |
| 16 | 17 |
| 17 WindowManagerState::WindowManagerState(Display* display, const UserId& user_id) | 18 WindowManagerState::WindowManagerState(Display* display, const UserId& user_id) |
| 18 : WindowManagerState(display, true, user_id) {} | 19 : WindowManagerState(display, true, user_id) {} |
| 19 | 20 |
| 20 WindowManagerState::~WindowManagerState() {} | 21 WindowManagerState::~WindowManagerState() {} |
| 21 | 22 |
| 22 WindowManagerState::WindowManagerState(Display* display, | 23 WindowManagerState::WindowManagerState(Display* display, |
| 23 bool is_user_id_valid, | 24 bool is_user_id_valid, |
| 24 const UserId& user_id) | 25 const UserId& user_id) |
| 25 : display_(display), | 26 : display_(display), |
| 26 is_user_id_valid_(is_user_id_valid), | 27 is_user_id_valid_(is_user_id_valid), |
| 27 user_id_(user_id) { | 28 user_id_(user_id) { |
| 28 ConnectionManager* connection_manager = display_->connection_manager(); | 29 ConnectionManager* connection_manager = display_->connection_manager(); |
| 29 root_.reset(connection_manager->CreateServerWindow( | 30 root_.reset(connection_manager->CreateServerWindow( |
| 30 RootWindowId(connection_manager->GetAndAdvanceNextRootId()), | 31 connection_manager->display_manager()->GetAndAdvanceNextRootId(), |
| 31 ServerWindow::Properties())); | 32 ServerWindow::Properties())); |
| 32 // Our root is always a child of the Display's root. Do this | 33 // Our root is always a child of the Display's root. Do this |
| 33 // before the WindowTree has been created so that the client doesn't get | 34 // before the WindowTree has been created so that the client doesn't get |
| 34 // notified of the add, bounds change and visibility change. | 35 // notified of the add, bounds change and visibility change. |
| 35 root_->SetBounds(gfx::Rect(display->root_window()->bounds().size())); | 36 root_->SetBounds(gfx::Rect(display->root_window()->bounds().size())); |
| 36 root_->SetVisible(true); | 37 root_->SetVisible(true); |
| 37 display->root_window()->Add(root_.get()); | 38 display->root_window()->Add(root_.get()); |
| 38 } | 39 } |
| 39 | 40 |
| 40 } // namespace ws | 41 } // namespace ws |
| 41 } // namespace mus | 42 } // namespace mus |
| OLD | NEW |