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

Unified Diff: mojo/examples/nesting_app/nesting_app.cc

Issue 341553002: Remove OnRootRemoved from ViewManagerDelegate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 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
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(
« no previous file with comments | « mojo/examples/embedded_app/embedded_app.cc ('k') | mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698