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

Unified Diff: components/mus/example/wm/window_manager_application.cc

Issue 1414943003: Moves move logic into WM instead of WS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile Created 5 years, 2 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
Index: components/mus/example/wm/window_manager_application.cc
diff --git a/components/mus/example/wm/window_manager_application.cc b/components/mus/example/wm/window_manager_application.cc
index 2ab82f8fa8bafe2225ee016e228a3d9b463c7ba5..175397e79bc78d766cf9a77c87acb79cb7196a01 100644
--- a/components/mus/example/wm/window_manager_application.cc
+++ b/components/mus/example/wm/window_manager_application.cc
@@ -43,13 +43,11 @@ bool WindowManagerApplication::ConfigureIncomingConnection(
void WindowManagerApplication::OnEmbed(mus::Window* root) {
root_ = root;
+ root_->AddObserver(this);
CreateContainers();
layout_.reset(
new WindowLayout(GetWindowForContainer(Container::USER_WINDOWS)));
- host_->EnableWindowDraggingForChildren(
- GetWindowForContainer(Container::USER_WINDOWS)->id());
-
window_manager_.reset(new WindowManagerImpl(this));
for (auto request : requests_)
window_manager_binding_.AddBinding(window_manager_.get(), request->Pass());
@@ -73,6 +71,15 @@ void WindowManagerApplication::Create(
}
}
+void WindowManagerApplication::OnWindowDestroyed(mus::Window* window) {
+ DCHECK_EQ(window, root_);
+ root_->RemoveObserver(this);
+ // Delete the |window_manager_| here so that WindowManager doesn't have to
+ // worry about the possibility of |root_| being null.
+ window_manager_.reset();
+ root_ = nullptr;
+}
+
void WindowManagerApplication::CreateContainers() {
for (uint16_t container =
static_cast<uint16_t>(Container::ALL_USER_BACKGROUND);
« no previous file with comments | « components/mus/example/wm/window_manager_application.h ('k') | components/mus/example/wm/window_manager_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698