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

Unified Diff: mojo/examples/embedded_app/embedded_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/embedded_app/embedded_app.cc
diff --git a/mojo/examples/embedded_app/embedded_app.cc b/mojo/examples/embedded_app/embedded_app.cc
index 1a620b408b57f8a17804174df1fcfc20723ce62d..ce77c8ec5a6c0d36926a5932e115555dce611271 100644
--- a/mojo/examples/embedded_app/embedded_app.cc
+++ b/mojo/examples/embedded_app/embedded_app.cc
@@ -88,13 +88,6 @@ class EmbeddedApp : public Application,
roots_[root->id()] = root;
ProcessPendingNodeColor(root->id());
}
- virtual void OnRootRemoved(ViewManager* view_manager, Node* root) OVERRIDE {
- roots_.erase(root->id());
-
- std::map<Node*, View*>::const_iterator it = views_to_reap_.find(root);
- if (it != views_to_reap_.end())
- it->second->Destroy();
- }
// Overridden from ViewObserver:
virtual void OnViewInputEvent(View* view, const EventPtr& event) OVERRIDE {
@@ -111,6 +104,17 @@ class EmbeddedApp : public Application,
if (new_view == 0)
views_to_reap_[node] = old_view;
}
+ virtual void OnNodeDestroy(
+ Node* node,
+ NodeObserver::DispositionChangePhase phase) OVERRIDE {
+ if (phase != NodeObserver::DISPOSITION_CHANGED)
+ return;
+ DCHECK(roots_.find(node->id()) != roots_.end());
+ roots_.erase(node->id());
+ std::map<Node*, View*>::const_iterator it = views_to_reap_.find(node);
+ if (it != views_to_reap_.end())
+ it->second->Destroy();
+ }
void ProcessPendingNodeColor(uint32 node_id) {
RootMap::iterator root = roots_.find(node_id);
@@ -130,7 +134,7 @@ class EmbeddedApp : public Application,
IWindowManagerPtr window_manager_;
std::map<Node*, View*> views_to_reap_;
- typedef std::map<uint32, Node*> RootMap;
+ typedef std::map<view_manager::Id, Node*> RootMap;
RootMap roots_;
// We can receive navigations for nodes we don't have yet.

Powered by Google App Engine
This is Rietveld 408576698