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

Unified Diff: ash/mus/disconnected_app_handler.cc

Issue 2072343002: Changes how window manager obtains WindowTree from mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: include Created 4 years, 6 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 | « ash/mus/disconnected_app_handler.h ('k') | ash/mus/manifest.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/mus/disconnected_app_handler.cc
diff --git a/ash/mus/disconnected_app_handler.cc b/ash/mus/disconnected_app_handler.cc
index 5631a7b9ff9f213ecaceb2daee6c45cb62e48798..9499bbf5cf78d962ce9b722bb4c767b8e1d88f73 100644
--- a/ash/mus/disconnected_app_handler.cc
+++ b/ash/mus/disconnected_app_handler.cc
@@ -4,16 +4,65 @@
#include "ash/mus/disconnected_app_handler.h"
+#include "ash/common/shell_window_ids.h"
+#include "ash/mus/bridge/wm_window_mus.h"
+
namespace ash {
namespace mus {
+namespace {
+
+bool IsContainer(::mus::Window* window) {
+ return WmWindowMus::Get(window)->IsContainer();
+}
+
+} // namespace
+
+DisconnectedAppHandler::DisconnectedAppHandler(::mus::Window* root_window) {
+ WmWindowMus* root = WmWindowMus::Get(root_window);
+ for (int shell_window_id = kShellWindowId_Min;
+ shell_window_id < kShellWindowId_Max; ++shell_window_id) {
+ // kShellWindowId_VirtualKeyboardContainer is lazily created.
+ // TODO(sky): http://crbug.com/616909 .
+ // kShellWindowId_PhantomWindow is not a container, but a window.
+ if (shell_window_id == kShellWindowId_VirtualKeyboardContainer ||
+ shell_window_id == kShellWindowId_PhantomWindow)
+ continue;
+
+// kShellWindowId_MouseCursorContainer is chromeos specific.
+#if !defined(OS_CHROMEOS)
+ if (shell_window_id == kShellWindowId_MouseCursorContainer)
+ continue;
+#endif
-DisconnectedAppHandler::DisconnectedAppHandler() {}
+ WmWindowMus* container = WmWindowMus::AsWmWindowMus(
+ root->GetChildByShellWindowId(shell_window_id));
+ Add(container->mus_window());
+
+ // Add any pre-existing windows in the container to
+ // |disconnected_app_handler_|.
+ for (::mus::Window* child : container->mus_window()->children()) {
+ if (!IsContainer(child))
+ Add(child);
+ }
+ }
+}
DisconnectedAppHandler::~DisconnectedAppHandler() {}
void DisconnectedAppHandler::OnWindowEmbeddedAppDisconnected(
::mus::Window* window) {
- window->Destroy();
+ if (!IsContainer(window))
+ window->Destroy();
+}
+
+void DisconnectedAppHandler::OnTreeChanging(const TreeChangeParams& params) {
+ if (params.old_parent == params.receiver && IsContainer(params.old_parent))
+ Remove(params.target);
+
+ if (params.new_parent == params.receiver && IsContainer(params.new_parent))
+ Add(params.target);
+
+ ::mus::WindowTracker::OnTreeChanging(params);
}
} // namespace mus
« no previous file with comments | « ash/mus/disconnected_app_handler.h ('k') | ash/mus/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698