| Index: mojo/examples/nesting_app/nesting_app.cc
|
| diff --git a/mojo/examples/nesting_app/nesting_app.cc b/mojo/examples/nesting_app/nesting_app.cc
|
| index dee9497b10cecc818ecf889a23f9a4f6c8f09afc..fe01b60c0ef6372f225f4fbd6762a8cdb9974ace 100644
|
| --- a/mojo/examples/nesting_app/nesting_app.cc
|
| +++ b/mojo/examples/nesting_app/nesting_app.cc
|
| @@ -34,7 +34,8 @@ const char kEmbeddedAppURL[] = "mojo:mojo_embedded_app";
|
| // An app that embeds another app.
|
| class NestingApp : public Application,
|
| public ViewManagerDelegate,
|
| - public ViewObserver {
|
| + public ViewObserver,
|
| + public NodeObserver {
|
| public:
|
| NestingApp() : nested_(NULL) {}
|
| virtual ~NestingApp() {}
|
| @@ -67,6 +68,8 @@ class NestingApp : public Application,
|
|
|
| // Overridden from ViewManagerDelegate:
|
| virtual void OnRootAdded(ViewManager* view_manager, Node* root) OVERRIDE {
|
| + root->AddObserver(this);
|
| +
|
| View* view = View::Create(view_manager);
|
| root->SetActiveView(view);
|
| view->SetColor(SK_ColorCYAN);
|
| @@ -83,17 +86,22 @@ class NestingApp : public Application,
|
| NavigateChild();
|
| }
|
|
|
| - virtual void OnRootRemoved(ViewManager* view_manager, Node* root) OVERRIDE {
|
| - // TODO(beng): reap views & child nodes.
|
| - nested_ = NULL;
|
| - }
|
| -
|
| // Overridden from ViewObserver:
|
| virtual void OnViewInputEvent(View* view, const EventPtr& event) OVERRIDE {
|
| if (event->action == ui::ET_MOUSE_RELEASED)
|
| window_manager_->CloseWindow(view->node()->id());
|
| }
|
|
|
| + // Overridden from NodeObserver:
|
| + virtual void OnNodeDestroy(
|
| + Node* node,
|
| + NodeObserver::DispositionChangePhase phase) OVERRIDE {
|
| + if (phase != NodeObserver::DISPOSITION_CHANGED)
|
| + return;
|
| + // TODO(beng): reap views & child nodes.
|
| + nested_ = NULL;
|
| + }
|
| +
|
| void NavigateChild() {
|
| if (!color_.empty() && nested_) {
|
| navigation::NavigationDetailsPtr details(
|
|
|