Chromium Code Reviews| Index: ui/views/mus/desktop_window_tree_host_mus.cc |
| diff --git a/ui/views/mus/desktop_window_tree_host_mus.cc b/ui/views/mus/desktop_window_tree_host_mus.cc |
| index 478dfb93fa70c09ad16107f3db46aa0226626030..6fe0eb1422be10153da70ef11c43448e68c5f7cd 100644 |
| --- a/ui/views/mus/desktop_window_tree_host_mus.cc |
| +++ b/ui/views/mus/desktop_window_tree_host_mus.cc |
| @@ -46,6 +46,11 @@ void DesktopWindowTreeHostMus::Init(aura::Window* content_window, |
| void DesktopWindowTreeHostMus::OnNativeWidgetCreated( |
| const Widget::InitParams& params) { |
| + if (params.parent && params.parent->GetHost()) { |
| + parent_ = static_cast<DesktopWindowTreeHostMus*>(params.parent->GetHost()); |
| + DCHECK(parent_); |
|
msw
2016/11/04 23:21:43
nit: seems unnecessary to DCHECK a non-null value
sky
2016/11/04 23:30:50
Done.
|
| + parent_->children_.insert(this); |
| + } |
| native_widget_delegate_->OnNativeWidgetCreated(true); |
| } |
| @@ -72,6 +77,18 @@ void DesktopWindowTreeHostMus::Close() { |
| } |
| void DesktopWindowTreeHostMus::CloseNow() { |
| + // If we have children, close them. Use a copy for iteration because they'll |
| + // remove themselves from |children_|. |
| + std::set<DesktopWindowTreeHostMus*> children_copy = children_; |
| + for (DesktopWindowTreeHostMus* child : children_copy) |
|
msw
2016/11/04 23:21:43
totally optional nit: convert the corresponding De
sky
2016/11/04 23:30:50
I'm leaving that code alone.
|
| + child->CloseNow(); |
| + DCHECK(children_.empty()); |
| + |
| + if (parent_) { |
| + parent_->children_.erase(this); |
| + parent_ = nullptr; |
| + } |
| + |
| native_widget_delegate_->OnNativeWidgetDestroying(); |
|
msw
2016/11/04 23:21:43
q: DesktopWindowTreeHostX11 orders this before chi
sky
2016/11/04 23:30:50
Good catch. Updated.
|
| DestroyCompositor(); |
| desktop_native_widget_aura_->OnHostClosed(); |