Index: athena/wm/window_manager_impl.cc |
diff --git a/athena/wm/window_manager_impl.cc b/athena/wm/window_manager_impl.cc |
index 39a1d75d236110e024529d3b8b298824007361a4..8539fe7bc326bb4074a4f2d71a0c696b5eb5934c 100644 |
--- a/athena/wm/window_manager_impl.cc |
+++ b/athena/wm/window_manager_impl.cc |
@@ -12,7 +12,8 @@ |
namespace athena { |
namespace { |
-class WindowManagerImpl : public WindowManager { |
+class WindowManagerImpl : public WindowManager, |
+ public aura::WindowObserver { |
public: |
WindowManagerImpl(); |
virtual ~WindowManagerImpl(); |
@@ -20,6 +21,12 @@ class WindowManagerImpl : public WindowManager { |
void Layout(); |
private: |
+ // aura::WindowObserver |
+ virtual void OnWindowDestroying(aura::Window* window) OVERRIDE { |
+ if (window == container_) |
+ container_ = NULL; |
+ } |
+ |
aura::Window* container_; |
DISALLOW_COPY_AND_ASSIGN(WindowManagerImpl); |
@@ -40,7 +47,9 @@ class AthenaContainerLayoutManager : public aura::LayoutManager { |
} |
virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE {} |
virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE { |
- instance->Layout(); |
+ // TODO(oshima): Delete root window after athena is cleaned up. |
Albert Bodenhamer
2014/05/22 19:22:02
File a bug to track the TODO so it doesn't get los
oshima
2014/05/22 21:23:05
The comment wasn't correct. If fixed the root caus
|
+ if (instance) |
+ instance->Layout(); |
} |
virtual void OnChildWindowVisibilityChanged(aura::Window* child, |
bool visible) OVERRIDE { |
@@ -56,16 +65,22 @@ class AthenaContainerLayoutManager : public aura::LayoutManager { |
}; |
WindowManagerImpl::WindowManagerImpl() |
- : container_(ScreenManager::Get()->GetContainerWindow()) { |
+ : container_( |
+ ScreenManager::Get()->CreateDefaultContainer("MainConttainer")) { |
Mr4D (OOO till 08-26)
2014/05/22 20:53:28
tt -> t
oshima
2014/05/22 21:23:05
Done.
|
container_->SetLayoutManager(new AthenaContainerLayoutManager); |
+ container_->AddObserver(this); |
instance = this; |
} |
WindowManagerImpl::~WindowManagerImpl() { |
+ if (container_) |
+ container_->RemoveObserver(this); |
instance = NULL; |
} |
void WindowManagerImpl::Layout() { |
+ if (!container_) |
+ return; |
gfx::Rect bounds = gfx::Rect(container_->bounds().size()); |
// Just make it small a bit so that the background is visible. |
bounds.Inset(10, 10, 10, 10); |