| Index: mojo/services/public/cpp/view_manager/lib/view_tree_node.cc
|
| diff --git a/mojo/services/public/cpp/view_manager/lib/view_tree_node.cc b/mojo/services/public/cpp/view_manager/lib/view_tree_node.cc
|
| index e501ea67038ed1b99c4657df2894cb0d6613d410..df0c4dbe74c4fec0078b5ca38bdc90ec1d94a4d1 100644
|
| --- a/mojo/services/public/cpp/view_manager/lib/view_tree_node.cc
|
| +++ b/mojo/services/public/cpp/view_manager/lib/view_tree_node.cc
|
| @@ -124,6 +124,40 @@ class ScopedSetActiveViewNotifier {
|
| DISALLOW_COPY_AND_ASSIGN(ScopedSetActiveViewNotifier);
|
| };
|
|
|
| +class ScopedSetBoundsNotifier {
|
| + public:
|
| + ScopedSetBoundsNotifier(ViewTreeNode* node,
|
| + const gfx::Rect& old_bounds,
|
| + const gfx::Rect& new_bounds)
|
| + : node_(node),
|
| + old_bounds_(old_bounds),
|
| + new_bounds_(new_bounds) {
|
| + FOR_EACH_OBSERVER(
|
| + ViewTreeNodeObserver,
|
| + *ViewTreeNodePrivate(node_).observers(),
|
| + OnNodeBoundsChange(node_,
|
| + old_bounds_,
|
| + new_bounds_,
|
| + ViewTreeNodeObserver::DISPOSITION_CHANGING));
|
| + }
|
| + ~ScopedSetBoundsNotifier() {
|
| + FOR_EACH_OBSERVER(
|
| + ViewTreeNodeObserver,
|
| + *ViewTreeNodePrivate(node_).observers(),
|
| + OnNodeBoundsChange(node_,
|
| + old_bounds_,
|
| + new_bounds_,
|
| + ViewTreeNodeObserver::DISPOSITION_CHANGED));
|
| + }
|
| +
|
| + private:
|
| + ViewTreeNode* node_;
|
| + const gfx::Rect old_bounds_;
|
| + const gfx::Rect new_bounds_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(ScopedSetBoundsNotifier);
|
| +};
|
| +
|
| class ScopedDestructionNotifier {
|
| public:
|
| explicit ScopedDestructionNotifier(ViewTreeNode* node)
|
| @@ -166,6 +200,12 @@ void ViewTreeNode::Destroy() {
|
| LocalDestroy();
|
| }
|
|
|
| +void ViewTreeNode::SetBounds(const gfx::Rect& bounds) {
|
| + if (manager_)
|
| + ViewManagerPrivate(manager_).synchronizer()->SetBounds(id_, bounds);
|
| + LocalSetBounds(bounds_, bounds);
|
| +}
|
| +
|
| void ViewTreeNode::AddObserver(ViewTreeNodeObserver* observer) {
|
| observers_.AddObserver(observer);
|
| }
|
| @@ -276,6 +316,13 @@ void ViewTreeNode::LocalSetActiveView(View* view) {
|
| ViewPrivate(active_view_).set_node(this);
|
| }
|
|
|
| +void ViewTreeNode::LocalSetBounds(const gfx::Rect& old_bounds,
|
| + const gfx::Rect& new_bounds) {
|
| + DCHECK(old_bounds == bounds_);
|
| + ScopedSetBoundsNotifier notifier(this, old_bounds, new_bounds);
|
| + bounds_ = new_bounds;
|
| +}
|
| +
|
| } // namespace view_manager
|
| } // namespace mojo
|
|
|
|
|