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

Unified Diff: mojo/aura/window_tree_host_mojo.cc

Issue 341953002: Clean up WTH creation (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
« no previous file with comments | « mojo/aura/window_tree_host_mojo.h ('k') | mojo/examples/aura_demo/aura_demo.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « mojo/aura/window_tree_host_mojo.h ('k') | mojo/examples/aura_demo/aura_demo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698