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/services/public/cpp/view_manager/view_tree_node.h" | 5 #include "mojo/services/public/cpp/view_manager/view_tree_node.h" |
6 | 6 |
7 #include "mojo/services/public/cpp/view_manager/lib/view_manager_private.h" | 7 #include "mojo/services/public/cpp/view_manager/lib/view_manager_private.h" |
8 #include "mojo/services/public/cpp/view_manager/lib/view_manager_synchronizer.h" | 8 #include "mojo/services/public/cpp/view_manager/lib/view_manager_synchronizer.h" |
9 #include "mojo/services/public/cpp/view_manager/lib/view_private.h" | 9 #include "mojo/services/public/cpp/view_manager/lib/view_private.h" |
10 #include "mojo/services/public/cpp/view_manager/lib/view_tree_node_private.h" | 10 #include "mojo/services/public/cpp/view_manager/lib/view_tree_node_private.h" |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 bool ViewTreeNode::Contains(ViewTreeNode* child) const { | 240 bool ViewTreeNode::Contains(ViewTreeNode* child) const { |
241 if (manager_) | 241 if (manager_) |
242 CHECK_EQ(ViewTreeNodePrivate(child).view_manager(), manager_); | 242 CHECK_EQ(ViewTreeNodePrivate(child).view_manager(), manager_); |
243 for (ViewTreeNode* p = child->parent(); p; p = p->parent()) { | 243 for (ViewTreeNode* p = child->parent(); p; p = p->parent()) { |
244 if (p == this) | 244 if (p == this) |
245 return true; | 245 return true; |
246 } | 246 } |
247 return false; | 247 return false; |
248 } | 248 } |
249 | 249 |
250 ViewTreeNode* ViewTreeNode::GetChildById(TransportNodeId id) { | 250 ViewTreeNode* ViewTreeNode::GetChildById(Id id) { |
251 if (id == id_) | 251 if (id == id_) |
252 return this; | 252 return this; |
253 // TODO(beng): this could be improved depending on how we decide to own nodes. | 253 // TODO(beng): this could be improved depending on how we decide to own nodes. |
254 Children::const_iterator it = children_.begin(); | 254 Children::const_iterator it = children_.begin(); |
255 for (; it != children_.end(); ++it) { | 255 for (; it != children_.end(); ++it) { |
256 ViewTreeNode* node = (*it)->GetChildById(id); | 256 ViewTreeNode* node = (*it)->GetChildById(id); |
257 if (node) | 257 if (node) |
258 return node; | 258 return node; |
259 } | 259 } |
260 return NULL; | 260 return NULL; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 void ViewTreeNode::LocalSetBounds(const gfx::Rect& old_bounds, | 332 void ViewTreeNode::LocalSetBounds(const gfx::Rect& old_bounds, |
333 const gfx::Rect& new_bounds) { | 333 const gfx::Rect& new_bounds) { |
334 DCHECK(old_bounds == bounds_); | 334 DCHECK(old_bounds == bounds_); |
335 ScopedSetBoundsNotifier notifier(this, old_bounds, new_bounds); | 335 ScopedSetBoundsNotifier notifier(this, old_bounds, new_bounds); |
336 bounds_ = new_bounds; | 336 bounds_ = new_bounds; |
337 } | 337 } |
338 | 338 |
339 } // namespace view_manager | 339 } // namespace view_manager |
340 } // namespace mojo | 340 } // namespace mojo |
341 | 341 |
OLD | NEW |