| Index: ui/aura/mus/window_tree_client.cc
|
| diff --git a/ui/aura/mus/window_tree_client.cc b/ui/aura/mus/window_tree_client.cc
|
| index a84e1e2f3c97cbfd89d7b88abfb30d4c2cb50f1f..dc4eeed067949ff8e32b816d11de5244d3b59931 100644
|
| --- a/ui/aura/mus/window_tree_client.cc
|
| +++ b/ui/aura/mus/window_tree_client.cc
|
| @@ -571,12 +571,13 @@ void WindowTreeClient::OnWindowMusCreated(WindowMus* window) {
|
| }
|
| }
|
|
|
| -void WindowTreeClient::OnWindowMusDestroyed(WindowMus* window) {
|
| +void WindowTreeClient::OnWindowMusDestroyed(WindowMus* window, Origin origin) {
|
| if (focus_synchronizer_->focused_window() == window)
|
| focus_synchronizer_->OnFocusedWindowDestroyed();
|
|
|
| // TODO: decide how to deal with windows not owned by this client.
|
| - if (WasCreatedByThisClient(window) || IsRoot(window)) {
|
| + if (origin == Origin::CLIENT &&
|
| + (WasCreatedByThisClient(window) || IsRoot(window))) {
|
| const uint32_t change_id =
|
| ScheduleInFlightChange(base::MakeUnique<CrashInFlightChange>(
|
| window, ChangeType::DELETE_WINDOW));
|
| @@ -1008,9 +1009,9 @@ void WindowTreeClient::OnWindowReordered(Id window_id,
|
| }
|
|
|
| void WindowTreeClient::OnWindowDeleted(Id window_id) {
|
| - // TODO(sky): decide how best to deal with this. It seems we should let the
|
| - // delegate do the actualy deletion.
|
| - delete GetWindowByServerId(window_id)->GetWindow();
|
| + WindowMus* window = GetWindowByServerId(window_id);
|
| + if (window)
|
| + window->DestroyFromServer();
|
| }
|
|
|
| void WindowTreeClient::OnWindowVisibilityChanged(Id window_id, bool visible) {
|
| @@ -1281,15 +1282,15 @@ void WindowTreeClient::WmNewDisplayAdded(const display::Display& display,
|
|
|
| void WindowTreeClient::WmDisplayRemoved(int64_t display_id) {
|
| DCHECK(window_manager_delegate_);
|
| - // TODO: route to WindowTreeHost.
|
| - /*
|
| - for (Window* root : roots_) {
|
| - if (root->display_id() == display_id) {
|
| - window_manager_delegate_->OnWmDisplayRemoved(root);
|
| + for (WindowMus* root : roots_) {
|
| + DCHECK(root->GetWindow()->GetHost());
|
| + WindowTreeHostMus* window_tree_host =
|
| + static_cast<WindowTreeHostMus*>(root->GetWindow()->GetHost());
|
| + if (window_tree_host->display_id() == display_id) {
|
| + window_manager_delegate_->OnWmDisplayRemoved(window_tree_host);
|
| return;
|
| }
|
| }
|
| - */
|
| }
|
|
|
| void WindowTreeClient::WmDisplayModified(const display::Display& display) {
|
|
|