Index: services/ui/ws/window_tree.cc |
diff --git a/services/ui/ws/window_tree.cc b/services/ui/ws/window_tree.cc |
index f51b6ecbf80318f7f24e4524da7ad98e2e604b80..e4ad6630a5854f92e9733b038600869c49ff494d 100644 |
--- a/services/ui/ws/window_tree.cc |
+++ b/services/ui/ws/window_tree.cc |
@@ -585,10 +585,6 @@ void WindowTree::ProcessWindowHierarchyChanged(const ServerWindow* window, |
const ServerWindow* old_parent, |
bool originated_change) { |
const bool knows_new = new_parent && IsWindowKnown(new_parent); |
- if (originated_change && !IsWindowKnown(window) && knows_new) { |
- std::vector<const ServerWindow*> unused; |
- GetUnknownWindowsFrom(window, &unused); |
- } |
if (originated_change || (window_server_->current_operation_type() == |
OperationType::DELETE_WINDOW) || |
(window_server_->current_operation_type() == OperationType::EMBED) || |
@@ -899,9 +895,16 @@ bool WindowTree::DeleteWindowImpl(WindowTree* source, ServerWindow* window) { |
void WindowTree::GetUnknownWindowsFrom( |
const ServerWindow* window, |
std::vector<const ServerWindow*>* windows) { |
- if (IsWindowKnown(window) || !access_policy_->CanGetWindowTree(window)) |
+ if (!access_policy_->CanGetWindowTree(window)) |
return; |
+ |
+ // This function is called in the context of a hierarchy change when the |
+ // parent wasn't known. We need to tell the client about the window so that |
+ // it can set the parent correctly. |
windows->push_back(window); |
+ if (IsWindowKnown(window)) |
+ return; |
+ |
// There are two cases where this gets hit: |
// . During init, in which case using the window id as the client id is |
// fine. |