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

Unified Diff: services/ui/ws/window_tree.cc

Issue 2349003002: Makes WindowTree::DeleteWindow() unembed for roots (Closed)
Patch Set: comment Created 4 years, 3 months 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 | « services/ui/ws/window_tree.h ('k') | services/ui/ws/window_tree_client_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/ws/window_tree.cc
diff --git a/services/ui/ws/window_tree.cc b/services/ui/ws/window_tree.cc
index 4af13d6344f88bff5fe8d9d25d18bb83540519eb..7853e3e0c783014fb99208a7906a1c9d56fdaff4 100644
--- a/services/ui/ws/window_tree.cc
+++ b/services/ui/ws/window_tree.cc
@@ -202,7 +202,7 @@ void WindowTree::OnWindowDestroyingTreeImpl(WindowTree* tree) {
if (event_source_wms_ && event_source_wms_->window_tree() == tree)
event_source_wms_ = nullptr;
- // Notify our client if |tree| was embedded in any of our views.
+ // Notify our client if |tree| was embedded in any of our windows.
for (const auto* tree_root : tree->roots_) {
const bool owns_tree_root = tree_root->id().client_id == id_;
if (owns_tree_root) {
@@ -605,7 +605,7 @@ void WindowTree::ProcessWindowReorder(const ServerWindow* window,
window_server_->OnTreeMessagedClient(id_);
}
-void WindowTree::ProcessWindowDeleted(const ServerWindow* window,
+void WindowTree::ProcessWindowDeleted(ServerWindow* window,
bool originated_change) {
if (window->id().client_id == id_)
created_window_map_.erase(window->id());
@@ -887,8 +887,7 @@ void WindowTree::RemoveFromKnown(const ServerWindow* window,
RemoveFromKnown(child, local_windows);
}
-void WindowTree::RemoveRoot(const ServerWindow* window,
- RemoveRootReason reason) {
+void WindowTree::RemoveRoot(ServerWindow* window, RemoveRootReason reason) {
DCHECK(roots_.count(window) > 0);
roots_.erase(window);
@@ -910,6 +909,17 @@ void WindowTree::RemoveRoot(const ServerWindow* window,
RemoveFromKnown(window, &local_windows);
for (size_t i = 0; i < local_windows.size(); ++i)
local_windows[i]->parent()->Remove(local_windows[i]);
+
+ if (reason == RemoveRootReason::UNEMBED) {
+ window->OnEmbeddedAppDisconnected();
+
+ // Notify the owner of the window it no longer has a client embedded in it.
+ WindowTree* owning_tree =
+ window_server_->GetTreeWithId(window->id().client_id);
+ DCHECK(owning_tree && owning_tree != this);
+ owning_tree->client()->OnEmbeddedAppDisconnected(
+ owning_tree->ClientWindowIdForWindow(window).id);
+ }
}
Array<mojom::WindowDataPtr> WindowTree::WindowsToWindowDatas(
@@ -1113,12 +1123,17 @@ void WindowTree::DeleteWindow(uint32_t change_id, Id transport_window_id) {
ServerWindow* window =
GetWindowByClientId(ClientWindowId(transport_window_id));
bool success = false;
- bool should_close = window && (access_policy_->CanDeleteWindow(window) ||
- ShouldRouteToWindowManager(window));
- if (should_close) {
- WindowTree* tree =
- window_server_->GetTreeWithId(window->id().client_id);
- success = tree && tree->DeleteWindowImpl(this, window);
+ if (window && roots_.count(window) > 0) {
+ success = true;
+ window_server_->OnTreeMessagedClient(id_);
+ RemoveRoot(window, RemoveRootReason::UNEMBED);
+ } else {
+ bool should_close = window && (access_policy_->CanDeleteWindow(window) ||
+ ShouldRouteToWindowManager(window));
+ if (should_close) {
+ WindowTree* tree = window_server_->GetTreeWithId(window->id().client_id);
+ success = tree && tree->DeleteWindowImpl(this, window);
+ }
}
client()->OnChangeCompleted(change_id, success);
}
« no previous file with comments | « services/ui/ws/window_tree.h ('k') | services/ui/ws/window_tree_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698