OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "services/ui/view_manager/view_registry.h" | 5 #include "services/ui/view_manager/view_registry.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 } | 170 } |
171 } | 171 } |
172 | 172 |
173 void ViewRegistry::RequestLayout(ViewState* view_state) { | 173 void ViewRegistry::RequestLayout(ViewState* view_state) { |
174 DCHECK(IsViewStateRegisteredDebug(view_state)); | 174 DCHECK(IsViewStateRegisteredDebug(view_state)); |
175 DVLOG(1) << "RequestLayout: view=" << view_state; | 175 DVLOG(1) << "RequestLayout: view=" << view_state; |
176 | 176 |
177 InvalidateLayout(view_state); | 177 InvalidateLayout(view_state); |
178 } | 178 } |
179 | 179 |
180 void ViewRegistry::AddChild(ViewState* parent_state, | 180 void ViewRegistry::AddChild( |
181 uint32_t child_key, | 181 ViewState* parent_state, |
182 mojo::ui::ViewOwnerPtr child_view_owner) { | 182 uint32_t child_key, |
| 183 mojo::InterfaceHandle<mojo::ui::ViewOwner> child_view_owner) { |
183 DCHECK(IsViewStateRegisteredDebug(parent_state)); | 184 DCHECK(IsViewStateRegisteredDebug(parent_state)); |
184 DCHECK(child_view_owner); | 185 DCHECK(child_view_owner); |
185 DVLOG(1) << "AddChild: parent=" << parent_state | 186 DVLOG(1) << "AddChild: parent=" << parent_state |
186 << ", child_key=" << child_key; | 187 << ", child_key=" << child_key; |
187 | 188 |
188 // Ensure there are no other children with the same key. | 189 // Ensure there are no other children with the same key. |
189 if (parent_state->children().find(child_key) != | 190 if (parent_state->children().find(child_key) != |
190 parent_state->children().end()) { | 191 parent_state->children().end()) { |
191 LOG(ERROR) << "View attempted to add a child with a duplicate key: " | 192 LOG(ERROR) << "View attempted to add a child with a duplicate key: " |
192 << "parent=" << parent_state << ", child_key=" << child_key; | 193 << "parent=" << parent_state << ", child_key=" << child_key; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 service_name, client_handle.Pass()); | 278 service_name, client_handle.Pass()); |
278 } | 279 } |
279 | 280 |
280 void ViewRegistry::RequestLayout(ViewTreeState* tree_state) { | 281 void ViewRegistry::RequestLayout(ViewTreeState* tree_state) { |
281 DCHECK(IsViewTreeStateRegisteredDebug(tree_state)); | 282 DCHECK(IsViewTreeStateRegisteredDebug(tree_state)); |
282 DVLOG(1) << "RequestLayout: tree=" << tree_state; | 283 DVLOG(1) << "RequestLayout: tree=" << tree_state; |
283 | 284 |
284 InvalidateLayoutForRoot(tree_state); | 285 InvalidateLayoutForRoot(tree_state); |
285 } | 286 } |
286 | 287 |
287 void ViewRegistry::SetRoot(ViewTreeState* tree_state, | 288 void ViewRegistry::SetRoot( |
288 uint32_t root_key, | 289 ViewTreeState* tree_state, |
289 mojo::ui::ViewOwnerPtr root_view_owner) { | 290 uint32_t root_key, |
| 291 mojo::InterfaceHandle<mojo::ui::ViewOwner> root_view_owner) { |
290 DCHECK(IsViewTreeStateRegisteredDebug(tree_state)); | 292 DCHECK(IsViewTreeStateRegisteredDebug(tree_state)); |
291 DCHECK(root_view_owner); | 293 DCHECK(root_view_owner); |
292 DVLOG(1) << "SetRoot: tree=" << tree_state << ", root_key=" << root_key; | 294 DVLOG(1) << "SetRoot: tree=" << tree_state << ", root_key=" << root_key; |
293 | 295 |
294 // Ensure there isn't already a root. | 296 // Ensure there isn't already a root. |
295 if (tree_state->root()) { | 297 if (tree_state->root()) { |
296 LOG(ERROR) | 298 LOG(ERROR) |
297 << "View tree attempted to set the root while one is already set: tree=" | 299 << "View tree attempted to set the root while one is already set: tree=" |
298 << tree_state << ", root_key=" << root_key; | 300 << tree_state << ", root_key=" << root_key; |
299 UnregisterViewTree(tree_state); | 301 UnregisterViewTree(tree_state); |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 DCHECK(IsViewTreeStateRegisteredDebug(tree_state)); | 699 DCHECK(IsViewTreeStateRegisteredDebug(tree_state)); |
698 | 700 |
699 // TODO: Detect ANRs | 701 // TODO: Detect ANRs |
700 DVLOG(1) << "SendRootUnavailable: tree_state=" << tree_state | 702 DVLOG(1) << "SendRootUnavailable: tree_state=" << tree_state |
701 << ", root_key=" << root_key; | 703 << ", root_key=" << root_key; |
702 tree_state->view_tree()->OnRootUnavailable(root_key, | 704 tree_state->view_tree()->OnRootUnavailable(root_key, |
703 base::Bind(&base::DoNothing)); | 705 base::Bind(&base::DoNothing)); |
704 } | 706 } |
705 | 707 |
706 } // namespace view_manager | 708 } // namespace view_manager |
OLD | NEW |