| 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_host_impl.h" |
| 8 |
| 9 namespace view_manager { |
| 10 |
| 11 ViewHostImpl::ViewHostImpl( |
| 12 ViewRegistry* registry, |
| 13 ViewState* state, |
| 14 mojo::InterfaceRequest<mojo::ui::ViewHost> view_host_request) |
| 15 : registry_(registry), |
| 16 state_(state), |
| 17 binding_(this, view_host_request.Pass()) {} |
| 18 |
| 19 ViewHostImpl::~ViewHostImpl() {} |
| 20 |
| 21 void ViewHostImpl::GetServiceProvider( |
| 22 mojo::InterfaceRequest<mojo::ServiceProvider> service_provider) { |
| 23 state_->GetServiceProvider(service_provider.Pass()); |
| 24 } |
| 25 |
| 26 void ViewHostImpl::RequestLayout() { |
| 27 registry_->RequestLayout(state_); |
| 28 } |
| 29 |
| 30 void ViewHostImpl::AddChild(uint32_t child_key, |
| 31 mojo::ui::ViewTokenPtr child_view_token) { |
| 32 registry_->AddChild(state_, child_key, child_view_token.Pass()); |
| 33 } |
| 34 |
| 35 void ViewHostImpl::RemoveChild(uint32_t child_key) { |
| 36 registry_->RemoveChild(state_, child_key); |
| 37 } |
| 38 |
| 39 static void RunLayoutChildCallback( |
| 40 const ViewHostImpl::LayoutChildCallback& callback, |
| 41 mojo::ui::ViewLayoutInfoPtr info) { |
| 42 callback.Run(info.Pass()); |
| 43 } |
| 44 |
| 45 void ViewHostImpl::LayoutChild( |
| 46 uint32_t child_key, |
| 47 mojo::ui::ViewLayoutParamsPtr child_layout_params, |
| 48 const LayoutChildCallback& callback) { |
| 49 registry_->LayoutChild(state_, child_key, child_layout_params.Pass(), |
| 50 base::Bind(&RunLayoutChildCallback, callback)); |
| 51 } |
| 52 |
| 53 } // namespace view_manager |
| OLD | NEW |