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

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

Issue 2473233005: Wires up transients for DesktopWindowTreeHostMus (Closed)
Patch Set: 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
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();
« ui/views/mus/desktop_window_tree_host_mus.h ('K') | « 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