Index: mojo/aura/window_tree_host_mojo.cc |
diff --git a/mojo/aura/window_tree_host_mojo.cc b/mojo/aura/window_tree_host_mojo.cc |
index 2ee5f14e1c7770c6f76c207bafb5f8cbfa25628f..75fdb7dff93e4037154fda33b1d52adfb6b80f15 100644 |
--- a/mojo/aura/window_tree_host_mojo.cc |
+++ b/mojo/aura/window_tree_host_mojo.cc |
@@ -61,16 +61,19 @@ class TreeHosts : public base::SupportsUserData::Data { |
//////////////////////////////////////////////////////////////////////////////// |
// WindowTreeHostMojo, public: |
-WindowTreeHostMojo::WindowTreeHostMojo(const gfx::Rect& bounds, |
+WindowTreeHostMojo::WindowTreeHostMojo(view_manager::Node* node, |
WindowTreeHostMojoDelegate* delegate) |
- : bounds_(bounds), |
+ : node_(node), |
+ bounds_(node->bounds()), |
delegate_(delegate) { |
+ node_->AddObserver(this); |
CreateCompositor(GetAcceleratedWidget()); |
TreeHosts::Get()->Add(this); |
} |
WindowTreeHostMojo::~WindowTreeHostMojo() { |
+ node_->RemoveObserver(this); |
TreeHosts::Get()->Remove(this); |
DestroyCompositor(); |
DestroyDispatcher(); |
@@ -158,4 +161,19 @@ ui::EventProcessor* WindowTreeHostMojo::GetEventProcessor() { |
return dispatcher(); |
} |
+//////////////////////////////////////////////////////////////////////////////// |
+// WindowTreeHostMojo, view_manager::NodeObserver implementation: |
+ |
+void WindowTreeHostMojo::OnNodeBoundsChange( |
+ view_manager::Node* node, |
+ const gfx::Rect& old_bounds, |
+ const gfx::Rect& new_bounds, |
+ view_manager::NodeObserver::DispositionChangePhase phase) { |
+ bounds_ = new_bounds; |
+ if (old_bounds.origin() != new_bounds.origin()) |
+ OnHostMoved(bounds_.origin()); |
+ if (old_bounds.size() != new_bounds.size()) |
+ OnHostResized(bounds_.size()); |
+} |
+ |
} // namespace mojo |