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 "view_manager/public/cpp/view.h" | 5 #include "view_manager/public/cpp/view.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "mojo/public/cpp/application/service_provider_impl.h" | 10 #include "mojo/public/cpp/application/service_provider_impl.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 params_.new_parent = new_parent; | 70 params_.new_parent = new_parent; |
71 NotifyViewTreeChange(params_, false); | 71 NotifyViewTreeChange(params_, false); |
72 } | 72 } |
73 ~ScopedTreeNotifier() { | 73 ~ScopedTreeNotifier() { |
74 NotifyViewTreeChange(params_, true); | 74 NotifyViewTreeChange(params_, true); |
75 } | 75 } |
76 | 76 |
77 private: | 77 private: |
78 ViewObserver::TreeChangeParams params_; | 78 ViewObserver::TreeChangeParams params_; |
79 | 79 |
80 DISALLOW_COPY_AND_ASSIGN(ScopedTreeNotifier); | 80 MOJO_DISALLOW_COPY_AND_ASSIGN(ScopedTreeNotifier); |
81 }; | 81 }; |
82 | 82 |
83 void RemoveChildImpl(View* child, View::Children* children) { | 83 void RemoveChildImpl(View* child, View::Children* children) { |
84 View::Children::iterator it = | 84 View::Children::iterator it = |
85 std::find(children->begin(), children->end(), child); | 85 std::find(children->begin(), children->end(), child); |
86 if (it != children->end()) { | 86 if (it != children->end()) { |
87 children->erase(it); | 87 children->erase(it); |
88 ViewPrivate(child).ClearParent(); | 88 ViewPrivate(child).ClearParent(); |
89 } | 89 } |
90 } | 90 } |
(...skipping 14 matching lines...) Expand all Loading... |
105 FOR_EACH_OBSERVER(ViewObserver, | 105 FOR_EACH_OBSERVER(ViewObserver, |
106 *ViewPrivate(view_).observers(), | 106 *ViewPrivate(view_).observers(), |
107 OnViewReordered(view_, relative_view_, direction_)); | 107 OnViewReordered(view_, relative_view_, direction_)); |
108 } | 108 } |
109 | 109 |
110 private: | 110 private: |
111 View* view_; | 111 View* view_; |
112 View* relative_view_; | 112 View* relative_view_; |
113 OrderDirection direction_; | 113 OrderDirection direction_; |
114 | 114 |
115 DISALLOW_COPY_AND_ASSIGN(ScopedOrderChangedNotifier); | 115 MOJO_DISALLOW_COPY_AND_ASSIGN(ScopedOrderChangedNotifier); |
116 }; | 116 }; |
117 | 117 |
118 // Returns true if the order actually changed. | 118 // Returns true if the order actually changed. |
119 bool ReorderImpl(View::Children* children, | 119 bool ReorderImpl(View::Children* children, |
120 View* view, | 120 View* view, |
121 View* relative, | 121 View* relative, |
122 OrderDirection direction) { | 122 OrderDirection direction) { |
123 DCHECK(relative); | 123 DCHECK(relative); |
124 DCHECK_NE(view, relative); | 124 DCHECK_NE(view, relative); |
125 DCHECK_EQ(view->parent(), relative->parent()); | 125 DCHECK_EQ(view->parent(), relative->parent()); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 FOR_EACH_OBSERVER(ViewObserver, | 161 FOR_EACH_OBSERVER(ViewObserver, |
162 *ViewPrivate(view_).observers(), | 162 *ViewPrivate(view_).observers(), |
163 OnViewBoundsChanged(view_, old_bounds_, new_bounds_)); | 163 OnViewBoundsChanged(view_, old_bounds_, new_bounds_)); |
164 } | 164 } |
165 | 165 |
166 private: | 166 private: |
167 View* view_; | 167 View* view_; |
168 const Rect old_bounds_; | 168 const Rect old_bounds_; |
169 const Rect new_bounds_; | 169 const Rect new_bounds_; |
170 | 170 |
171 DISALLOW_COPY_AND_ASSIGN(ScopedSetBoundsNotifier); | 171 MOJO_DISALLOW_COPY_AND_ASSIGN(ScopedSetBoundsNotifier); |
172 }; | 172 }; |
173 | 173 |
174 // Some operations are only permitted in the connection that created the view. | 174 // Some operations are only permitted in the connection that created the view. |
175 bool OwnsView(ViewManager* manager, View* view) { | 175 bool OwnsView(ViewManager* manager, View* view) { |
176 return !manager || | 176 return !manager || |
177 static_cast<ViewManagerClientImpl*>(manager)->OwnsView(view->id()); | 177 static_cast<ViewManagerClientImpl*>(manager)->OwnsView(view->id()); |
178 } | 178 } |
179 | 179 |
180 } // namespace | 180 } // namespace |
181 | 181 |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 void View::NotifyViewVisibilityChangedUp(View* target) { | 573 void View::NotifyViewVisibilityChangedUp(View* target) { |
574 // Start with the parent as we already notified |this| | 574 // Start with the parent as we already notified |this| |
575 // in NotifyViewVisibilityChangedDown. | 575 // in NotifyViewVisibilityChangedDown. |
576 for (View* view = parent(); view; view = view->parent()) { | 576 for (View* view = parent(); view; view = view->parent()) { |
577 bool ret = view->NotifyViewVisibilityChangedAtReceiver(target); | 577 bool ret = view->NotifyViewVisibilityChangedAtReceiver(target); |
578 DCHECK(ret); | 578 DCHECK(ret); |
579 } | 579 } |
580 } | 580 } |
581 | 581 |
582 } // namespace mojo | 582 } // namespace mojo |
OLD | NEW |