| 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_impl.h" | 5 #include "services/ui/view_manager/view_tree_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 |
| 11 namespace view_manager { | 11 namespace view_manager { |
| 12 | 12 |
| 13 ViewTreeImpl::ViewTreeImpl(ViewRegistry* registry, ViewTreeState* state) | 13 ViewTreeImpl::ViewTreeImpl(ViewRegistry* registry, ViewTreeState* state) |
| 14 : registry_(registry), state_(state) {} | 14 : registry_(registry), state_(state) {} |
| 15 | 15 |
| 16 ViewTreeImpl::~ViewTreeImpl() {} | 16 ViewTreeImpl::~ViewTreeImpl() {} |
| 17 | 17 |
| 18 void ViewTreeImpl::GetToken(const GetTokenCallback& callback) { | 18 void ViewTreeImpl::GetToken(const GetTokenCallback& callback) { |
| 19 callback.Run(state_->view_tree_token()->Clone()); | 19 callback.Run(state_->view_tree_token()->Clone()); |
| 20 } | 20 } |
| 21 | 21 |
| 22 void ViewTreeImpl::GetServiceProvider( | 22 void ViewTreeImpl::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 ViewTreeImpl::SetRenderer( |
| 28 mojo::InterfaceHandle<mojo::gfx::composition::Renderer> renderer) { |
| 29 registry_->SetRenderer( |
| 30 state_, mojo::gfx::composition::RendererPtr::Create(std::move(renderer))); |
| 31 } |
| 32 |
| 27 void ViewTreeImpl::RequestLayout() { | 33 void ViewTreeImpl::RequestLayout() { |
| 28 registry_->RequestLayout(state_); | 34 registry_->RequestLayout(state_); |
| 29 } | 35 } |
| 30 | 36 |
| 31 void ViewTreeImpl::SetRoot( | 37 void ViewTreeImpl::SetRoot( |
| 32 uint32_t root_key, | 38 uint32_t root_key, |
| 33 mojo::InterfaceHandle<mojo::ui::ViewOwner> root_view_owner) { | 39 mojo::InterfaceHandle<mojo::ui::ViewOwner> root_view_owner) { |
| 34 registry_->SetRoot(state_, root_key, root_view_owner.Pass()); | 40 registry_->SetRoot(state_, root_key, root_view_owner.Pass()); |
| 35 } | 41 } |
| 36 | 42 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 52 } | 58 } |
| 53 | 59 |
| 54 void ViewTreeImpl::ConnectToService( | 60 void ViewTreeImpl::ConnectToService( |
| 55 const mojo::String& service_name, | 61 const mojo::String& service_name, |
| 56 mojo::ScopedMessagePipeHandle client_handle) { | 62 mojo::ScopedMessagePipeHandle client_handle) { |
| 57 registry_->ConnectToViewTreeService(state_, service_name, | 63 registry_->ConnectToViewTreeService(state_, service_name, |
| 58 client_handle.Pass()); | 64 client_handle.Pass()); |
| 59 } | 65 } |
| 60 | 66 |
| 61 } // namespace view_manager | 67 } // namespace view_manager |
| OLD | NEW |