Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Unified Diff: ui/views/mus/desktop_window_tree_host_mus.cc

Issue 2473233005: Wires up transients for DesktopWindowTreeHostMus (Closed)
Patch Set: super nitty nits Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/mus/desktop_window_tree_host_mus.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..14fa94cba930b335a638f10622577464a63bcd64 100644
--- a/ui/views/mus/desktop_window_tree_host_mus.cc
+++ b/ui/views/mus/desktop_window_tree_host_mus.cc
@@ -46,6 +46,10 @@ 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());
+ parent_->children_.insert(this);
+ }
native_widget_delegate_->OnNativeWidgetCreated(true);
}
@@ -73,6 +77,19 @@ void DesktopWindowTreeHostMus::Close() {
void DesktopWindowTreeHostMus::CloseNow() {
native_widget_delegate_->OnNativeWidgetDestroying();
+
+ // 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)
+ child->CloseNow();
+ DCHECK(children_.empty());
+
+ if (parent_) {
+ parent_->children_.erase(this);
+ parent_ = nullptr;
+ }
+
DestroyCompositor();
desktop_native_widget_aura_->OnHostClosed();
}
« no previous file with comments | « ui/views/mus/desktop_window_tree_host_mus.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698