| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" |
| 7 #include "services/ui/view_manager/view_tree_host_impl.h" |
| 8 |
| 9 namespace view_manager { |
| 10 |
| 11 ViewTreeHostImpl::ViewTreeHostImpl( |
| 12 ViewRegistry* registry, |
| 13 ViewTreeState* state, |
| 14 mojo::InterfaceRequest<mojo::ui::ViewTreeHost> view_tree_host_request) |
| 15 : registry_(registry), |
| 16 state_(state), |
| 17 binding_(this, view_tree_host_request.Pass()) {} |
| 18 |
| 19 ViewTreeHostImpl::~ViewTreeHostImpl() {} |
| 20 |
| 21 void ViewTreeHostImpl::RequestLayout() { |
| 22 registry_->RequestLayout(state_); |
| 23 } |
| 24 |
| 25 void ViewTreeHostImpl::SetRoot(uint32_t root_key, |
| 26 mojo::ui::ViewTokenPtr root_view_token) { |
| 27 registry_->SetRoot(state_, root_key, root_view_token.Pass()); |
| 28 } |
| 29 |
| 30 void ViewTreeHostImpl::ResetRoot() { |
| 31 registry_->ResetRoot(state_); |
| 32 } |
| 33 |
| 34 static void RunLayoutRootCallback( |
| 35 const ViewTreeHostImpl::LayoutRootCallback& callback, |
| 36 mojo::ui::ViewLayoutInfoPtr info) { |
| 37 callback.Run(info.Pass()); |
| 38 } |
| 39 |
| 40 void ViewTreeHostImpl::LayoutRoot( |
| 41 mojo::ui::ViewLayoutParamsPtr root_layout_params, |
| 42 const LayoutRootCallback& callback) { |
| 43 registry_->LayoutRoot(state_, root_layout_params.Pass(), |
| 44 base::Bind(&RunLayoutRootCallback, callback)); |
| 45 } |
| 46 |
| 47 } // namespace view_manager |
| OLD | NEW |