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

Unified Diff: ui/aura/mus/window_tree_client.cc

Issue 2559703003: Converts WindowTreeClientTest to be in terms of aura (Closed)
Patch Set: tweak Created 4 years 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/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 03c333e8f365cbe8eb568f28ca76010030177651..3808bf2cae80ff0574fe816fff56c3e730ff2da5 100644
--- a/ui/aura/mus/window_tree_client.cc
+++ b/ui/aura/mus/window_tree_client.cc
@@ -264,6 +264,11 @@ void WindowTreeClient::Embed(
uint32_t flags,
const ui::mojom::WindowTree::EmbedCallback& callback) {
DCHECK(tree_);
+ if (!window->children().empty()) {
msw 2016/12/08 01:20:12 nit: add a comment, explaining why only one child
sky 2016/12/08 04:59:45 You mean no children I believe. I added a comment.
+ callback.Run(false);
+ return;
+ }
+
tree_->Embed(WindowMus::Get(window)->server_id(), std::move(client), flags,
callback);
}
@@ -595,9 +600,7 @@ void WindowTreeClient::OnWindowMusDestroyed(WindowMus* window, Origin origin) {
for (auto change_id : in_flight_change_ids_to_remove)
in_flight_map_.erase(change_id);
- const bool was_root = roots_.erase(window) > 0;
- if (!in_destructor_ && was_root && roots_.empty() && is_from_embed_)
- delegate_->OnEmbedRootDestroyed(window->GetWindow());
+ roots_.erase(window);
}
void WindowTreeClient::OnWindowMusBoundsChanged(WindowMus* window,
@@ -1001,8 +1004,15 @@ void WindowTreeClient::OnWindowReordered(Id window_id,
void WindowTreeClient::OnWindowDeleted(Id window_id) {
WindowMus* window = GetWindowByServerId(window_id);
- if (window)
+ if (!window)
+ return;
+
+ if (roots_.count(window)) {
msw 2016/12/08 01:20:12 nit: add a comment explaining the two paths here
sky 2016/12/08 04:59:45 Done.
+ window->PrepareForDestroy();
+ delegate_->OnEmbedRootDestroyed(GetWindowTreeHostMus(window));
+ } else {
window->DestroyFromServer();
+ }
}
void WindowTreeClient::OnWindowVisibilityChanged(Id window_id, bool visible) {

Powered by Google App Engine
This is Rietveld 408576698