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

Unified Diff: mojo/views/native_widget_view_manager.cc

Issue 383123006: Preliminary interactive layout of window manager's demo_launcher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make NativeWidgetManager clean up its view observer Created 6 years, 5 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 | « mojo/views/native_widget_view_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/views/native_widget_view_manager.cc
diff --git a/mojo/views/native_widget_view_manager.cc b/mojo/views/native_widget_view_manager.cc
index 36a65786e101b21da096aa89b764d0144be3855a..3c4cfa31fe3ecc90b09a68e90391b00ce11b1bb1 100644
--- a/mojo/views/native_widget_view_manager.cc
+++ b/mojo/views/native_widget_view_manager.cc
@@ -113,9 +113,11 @@ NativeWidgetViewManager::NativeWidgetViewManager(
}
NativeWidgetViewManager::~NativeWidgetViewManager() {
- if (node_->active_view())
- node_->active_view()->RemoveObserver(this);
- node_->RemoveObserver(this);
+ if (node_) {
+ if (node_->active_view())
+ node_->active_view()->RemoveObserver(this);
+ node_->RemoveObserver(this);
+ }
}
sky 2014/07/15 20:46:48 I think you're missing the case of the node_ havin
void NativeWidgetViewManager::InitNativeWidget(
@@ -133,9 +135,18 @@ void NativeWidgetViewManager::CompositorContentsChanged(
}
void NativeWidgetViewManager::OnNodeDestroyed(view_manager::Node* node) {
+ DCHECK_EQ(node, node_);
+ node->RemoveObserver(this);
+ node_ = NULL;
window_tree_host_.reset();
}
+void NativeWidgetViewManager::OnNodeBoundsChanged(view_manager::Node* node,
+ const gfx::Rect& old_bounds,
+ const gfx::Rect& new_bounds) {
+ GetWidget()->SetBounds(gfx::Rect(node->bounds().size()));
+}
+
void NativeWidgetViewManager::OnNodeActiveViewChanged(
view_manager::Node* node,
view_manager::View* old_view,
@@ -153,4 +164,8 @@ void NativeWidgetViewManager::OnViewInputEvent(view_manager::View* view,
window_tree_host_->SendEventToProcessor(ui_event.get());
}
+void NativeWidgetViewManager::OnViewDestroyed(view_manager::View* view) {
+ view->RemoveObserver(this);
+}
+
} // namespace mojo
« no previous file with comments | « mojo/views/native_widget_view_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698