Index: components/mus/ws/connection_manager.cc |
diff --git a/components/mus/ws/connection_manager.cc b/components/mus/ws/connection_manager.cc |
index 673307629ab1cbfd8d19ca7be8e51805e6d8e972..c5cc71c1273aa08420ada93ddc50132baeeda979 100644 |
--- a/components/mus/ws/connection_manager.cc |
+++ b/components/mus/ws/connection_manager.cc |
@@ -138,6 +138,11 @@ void ConnectionManager::OnHostConnectionClosed( |
host_connection_map_.erase(it); |
OnConnectionError(service_connection_it->second); |
+ for (auto& pair : connection_map_) { |
+ pair.second->service()->OnWillDestroyWindowTreeHost( |
+ connection->window_tree_host()); |
+ } |
+ |
// If we have no more roots left, let the app know so it can terminate. |
if (!host_connection_map_.size()) |
delegate_->OnNoMoreRootConnections(); |
@@ -270,6 +275,32 @@ void ConnectionManager::WindowManagerChangeCompleted( |
connection->OnChangeCompleted(change.client_change_id, success); |
} |
+void ConnectionManager::WindowManagerCreatedTopLevelWindow( |
+ WindowTreeImpl* wm_connection, |
+ uint32_t window_manager_change_id, |
+ Id transport_window_id) { |
+ InFlightWindowManagerChange change; |
+ if (!GetAndClearInFlightWindowManagerChange(window_manager_change_id, |
+ &change)) { |
+ return; |
+ } |
+ |
+ const WindowId window_id(WindowIdFromTransportId(transport_window_id)); |
+ const ServerWindow* window = GetWindow(window_id); |
+ WindowTreeImpl* connection = GetConnection(change.connection_id); |
+ // The window manager should have created the window already, and it should |
+ // be ready for embedding. |
+ if (!connection->IsWaitingForNewTopLevelWindow(window_manager_change_id) || |
+ !window || window->id().connection_id != wm_connection->id() || |
+ !window->children().empty() || GetConnectionWithRoot(window)) { |
+ WindowManagerSentBogusMessage(connection); |
+ return; |
+ } |
+ |
+ connection->OnWindowManagerCreatedTopLevelWindow( |
+ window_manager_change_id, change.client_change_id, window_id); |
+} |
+ |
void ConnectionManager::ProcessWindowBoundsChanged( |
const ServerWindow* window, |
const gfx::Rect& old_bounds, |