| 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_tree_host_impl.h" | 5 #include "services/ui/view_manager/view_tree_host_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "services/ui/view_manager/view_registry.h" | 8 #include "services/ui/view_manager/view_registry.h" |
| 9 #include "services/ui/view_manager/view_tree_state.h" | 9 #include "services/ui/view_manager/view_tree_state.h" |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 void ViewTreeHostImpl::GetServiceProvider( | 22 void ViewTreeHostImpl::GetServiceProvider( |
| 23 mojo::InterfaceRequest<mojo::ServiceProvider> service_provider) { | 23 mojo::InterfaceRequest<mojo::ServiceProvider> service_provider) { |
| 24 service_provider_bindings_.AddBinding(this, service_provider.Pass()); | 24 service_provider_bindings_.AddBinding(this, service_provider.Pass()); |
| 25 } | 25 } |
| 26 | 26 |
| 27 void ViewTreeHostImpl::RequestLayout() { | 27 void ViewTreeHostImpl::RequestLayout() { |
| 28 registry_->RequestLayout(state_); | 28 registry_->RequestLayout(state_); |
| 29 } | 29 } |
| 30 | 30 |
| 31 void ViewTreeHostImpl::SetRoot(uint32_t root_key, | 31 void ViewTreeHostImpl::SetRoot( |
| 32 mojo::ui::ViewOwnerPtr root_view_owner) { | 32 uint32_t root_key, |
| 33 mojo::InterfaceHandle<mojo::ui::ViewOwner> root_view_owner) { |
| 33 registry_->SetRoot(state_, root_key, root_view_owner.Pass()); | 34 registry_->SetRoot(state_, root_key, root_view_owner.Pass()); |
| 34 } | 35 } |
| 35 | 36 |
| 36 void ViewTreeHostImpl::ResetRoot(mojo::InterfaceRequest<mojo::ui::ViewOwner> | 37 void ViewTreeHostImpl::ResetRoot(mojo::InterfaceRequest<mojo::ui::ViewOwner> |
| 37 transferred_view_owner_request) { | 38 transferred_view_owner_request) { |
| 38 registry_->ResetRoot(state_, transferred_view_owner_request.Pass()); | 39 registry_->ResetRoot(state_, transferred_view_owner_request.Pass()); |
| 39 } | 40 } |
| 40 | 41 |
| 41 static void RunLayoutRootCallback( | 42 static void RunLayoutRootCallback( |
| 42 const ViewTreeHostImpl::LayoutRootCallback& callback, | 43 const ViewTreeHostImpl::LayoutRootCallback& callback, |
| 43 mojo::ui::ViewLayoutInfoPtr info) { | 44 mojo::ui::ViewLayoutInfoPtr info) { |
| 44 callback.Run(info.Pass()); | 45 callback.Run(info.Pass()); |
| 45 } | 46 } |
| 46 | 47 |
| 47 void ViewTreeHostImpl::LayoutRoot( | 48 void ViewTreeHostImpl::LayoutRoot( |
| 48 mojo::ui::ViewLayoutParamsPtr root_layout_params, | 49 mojo::ui::ViewLayoutParamsPtr root_layout_params, |
| 49 const LayoutRootCallback& callback) { | 50 const LayoutRootCallback& callback) { |
| 50 registry_->LayoutRoot(state_, root_layout_params.Pass(), | 51 registry_->LayoutRoot(state_, root_layout_params.Pass(), |
| 51 base::Bind(&RunLayoutRootCallback, callback)); | 52 base::Bind(&RunLayoutRootCallback, callback)); |
| 52 } | 53 } |
| 53 | 54 |
| 54 void ViewTreeHostImpl::ConnectToService( | 55 void ViewTreeHostImpl::ConnectToService( |
| 55 const mojo::String& service_name, | 56 const mojo::String& service_name, |
| 56 mojo::ScopedMessagePipeHandle client_handle) { | 57 mojo::ScopedMessagePipeHandle client_handle) { |
| 57 registry_->ConnectToViewTreeService(state_, service_name, | 58 registry_->ConnectToViewTreeService(state_, service_name, |
| 58 client_handle.Pass()); | 59 client_handle.Pass()); |
| 59 } | 60 } |
| 60 | 61 |
| 61 } // namespace view_manager | 62 } // namespace view_manager |
| OLD | NEW |