OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "mojo/aura/window_tree_host_mojo.h" | 5 #include "mojo/aura/window_tree_host_mojo.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "mojo/aura/window_tree_host_mojo_delegate.h" | 9 #include "mojo/aura/window_tree_host_mojo_delegate.h" |
10 #include "ui/aura/env.h" | 10 #include "ui/aura/env.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 Managers managers_; | 54 Managers managers_; |
55 | 55 |
56 DISALLOW_COPY_AND_ASSIGN(TreeHosts); | 56 DISALLOW_COPY_AND_ASSIGN(TreeHosts); |
57 }; | 57 }; |
58 | 58 |
59 } // namespace | 59 } // namespace |
60 | 60 |
61 //////////////////////////////////////////////////////////////////////////////// | 61 //////////////////////////////////////////////////////////////////////////////// |
62 // WindowTreeHostMojo, public: | 62 // WindowTreeHostMojo, public: |
63 | 63 |
64 WindowTreeHostMojo::WindowTreeHostMojo(Node* node, | 64 WindowTreeHostMojo::WindowTreeHostMojo(View* view, |
65 WindowTreeHostMojoDelegate* delegate) | 65 WindowTreeHostMojoDelegate* delegate) |
66 : node_(node), | 66 : view_(view), |
67 bounds_(node->bounds()), | 67 bounds_(view->bounds()), |
68 delegate_(delegate) { | 68 delegate_(delegate) { |
69 node_->AddObserver(this); | 69 view_->AddObserver(this); |
70 CreateCompositor(GetAcceleratedWidget()); | 70 CreateCompositor(GetAcceleratedWidget()); |
71 | 71 |
72 TreeHosts::Get()->Add(this); | 72 TreeHosts::Get()->Add(this); |
73 } | 73 } |
74 | 74 |
75 WindowTreeHostMojo::~WindowTreeHostMojo() { | 75 WindowTreeHostMojo::~WindowTreeHostMojo() { |
76 node_->RemoveObserver(this); | 76 view_->RemoveObserver(this); |
77 TreeHosts::Get()->Remove(this); | 77 TreeHosts::Get()->Remove(this); |
78 DestroyCompositor(); | 78 DestroyCompositor(); |
79 DestroyDispatcher(); | 79 DestroyDispatcher(); |
80 } | 80 } |
81 | 81 |
82 // static | 82 // static |
83 WindowTreeHostMojo* WindowTreeHostMojo::ForCompositor( | 83 WindowTreeHostMojo* WindowTreeHostMojo::ForCompositor( |
84 ui::Compositor* compositor) { | 84 ui::Compositor* compositor) { |
85 const Managers& managers = TreeHosts::Get()->managers(); | 85 const Managers& managers = TreeHosts::Get()->managers(); |
86 for (size_t i = 0; i < managers.size(); ++i) { | 86 for (size_t i = 0; i < managers.size(); ++i) { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 } | 150 } |
151 | 151 |
152 //////////////////////////////////////////////////////////////////////////////// | 152 //////////////////////////////////////////////////////////////////////////////// |
153 // WindowTreeHostMojo, ui::EventSource implementation: | 153 // WindowTreeHostMojo, ui::EventSource implementation: |
154 | 154 |
155 ui::EventProcessor* WindowTreeHostMojo::GetEventProcessor() { | 155 ui::EventProcessor* WindowTreeHostMojo::GetEventProcessor() { |
156 return dispatcher(); | 156 return dispatcher(); |
157 } | 157 } |
158 | 158 |
159 //////////////////////////////////////////////////////////////////////////////// | 159 //////////////////////////////////////////////////////////////////////////////// |
160 // WindowTreeHostMojo, NodeObserver implementation: | 160 // WindowTreeHostMojo, ViewObserver implementation: |
161 | 161 |
162 void WindowTreeHostMojo::OnNodeBoundsChanged( | 162 void WindowTreeHostMojo::OnViewBoundsChanged( |
163 Node* node, | 163 View* view, |
164 const gfx::Rect& old_bounds, | 164 const gfx::Rect& old_bounds, |
165 const gfx::Rect& new_bounds) { | 165 const gfx::Rect& new_bounds) { |
166 bounds_ = new_bounds; | 166 bounds_ = new_bounds; |
167 if (old_bounds.origin() != new_bounds.origin()) | 167 if (old_bounds.origin() != new_bounds.origin()) |
168 OnHostMoved(bounds_.origin()); | 168 OnHostMoved(bounds_.origin()); |
169 if (old_bounds.size() != new_bounds.size()) | 169 if (old_bounds.size() != new_bounds.size()) |
170 OnHostResized(bounds_.size()); | 170 OnHostResized(bounds_.size()); |
171 } | 171 } |
172 | 172 |
173 } // namespace mojo | 173 } // namespace mojo |
OLD | NEW |