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

Unified Diff: athena/wm/window_manager_impl.cc

Issue 287253003: Add initial home card impl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | « athena/screen/screen_manager_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..8edadc49167a4779484d5ef5e8c71a12ea3c1d85 100644
--- a/athena/wm/window_manager_impl.cc
+++ b/athena/wm/window_manager_impl.cc
@@ -12,7 +12,7 @@
namespace athena {
namespace {
-class WindowManagerImpl : public WindowManager {
+class WindowManagerImpl : public WindowManager, public aura::WindowObserver {
public:
WindowManagerImpl();
virtual ~WindowManagerImpl();
@@ -20,7 +20,13 @@ class WindowManagerImpl : public WindowManager {
void Layout();
private:
- aura::Window* container_;
+ // aura::WindowObserver
+ virtual void OnWindowDestroying(aura::Window* window) OVERRIDE {
+ if (window == container_)
+ container_.reset();
+ }
+
+ scoped_ptr<aura::Window> container_;
DISALLOW_COPY_AND_ASSIGN(WindowManagerImpl);
};
@@ -56,16 +62,23 @@ class AthenaContainerLayoutManager : public aura::LayoutManager {
};
WindowManagerImpl::WindowManagerImpl()
- : container_(ScreenManager::Get()->GetContainerWindow()) {
+ : container_(
+ ScreenManager::Get()->CreateDefaultContainer("MainContainer")) {
container_->SetLayoutManager(new AthenaContainerLayoutManager);
+ container_->AddObserver(this);
instance = this;
}
WindowManagerImpl::~WindowManagerImpl() {
+ if (container_)
+ container_->RemoveObserver(this);
+ container_.reset();
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);
« no previous file with comments | « athena/screen/screen_manager_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698