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_manager_impl.h" | 5 #include "services/ui/view_manager/view_manager_impl.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "services/ui/view_manager/view_host_impl.h" | 9 #include "services/ui/view_manager/view_host_impl.h" |
8 #include "services/ui/view_manager/view_tree_host_impl.h" | 10 #include "services/ui/view_manager/view_tree_host_impl.h" |
9 | 11 |
10 namespace view_manager { | 12 namespace view_manager { |
11 | 13 |
12 ViewManagerImpl::ViewManagerImpl(ViewRegistry* registry) | 14 ViewManagerImpl::ViewManagerImpl(ViewRegistry* registry) |
13 : registry_(registry) {} | 15 : registry_(registry) {} |
14 | 16 |
15 ViewManagerImpl::~ViewManagerImpl() {} | 17 ViewManagerImpl::~ViewManagerImpl() {} |
16 | 18 |
17 void ViewManagerImpl::RegisterView( | 19 void ViewManagerImpl::RegisterView( |
18 mojo::ui::ViewPtr view, | 20 mojo::InterfaceHandle<mojo::ui::View> view, |
19 mojo::InterfaceRequest<mojo::ui::ViewHost> view_host_request, | 21 mojo::InterfaceRequest<mojo::ui::ViewHost> view_host_request, |
20 const mojo::String& label, | 22 const mojo::String& label, |
21 const RegisterViewCallback& callback) { | 23 const RegisterViewCallback& callback) { |
22 mojo::ui::ViewTokenPtr view_token = | 24 mojo::ui::ViewTokenPtr view_token = |
23 registry_->RegisterView(view.Pass(), view_host_request.Pass(), label); | 25 registry_->RegisterView(mojo::ui::ViewPtr::Create(std::move(view)), |
| 26 view_host_request.Pass(), label); |
24 callback.Run(view_token.Pass()); | 27 callback.Run(view_token.Pass()); |
25 } | 28 } |
26 | 29 |
27 void ViewManagerImpl::RegisterViewTree( | 30 void ViewManagerImpl::RegisterViewTree( |
28 mojo::ui::ViewTreePtr view_tree, | 31 mojo::InterfaceHandle<mojo::ui::ViewTree> view_tree, |
29 mojo::InterfaceRequest<mojo::ui::ViewTreeHost> view_tree_host_request, | 32 mojo::InterfaceRequest<mojo::ui::ViewTreeHost> view_tree_host_request, |
30 const mojo::String& label, | 33 const mojo::String& label, |
31 const RegisterViewTreeCallback& callback) { | 34 const RegisterViewTreeCallback& callback) { |
32 mojo::ui::ViewTreeTokenPtr view_tree_token = registry_->RegisterViewTree( | 35 mojo::ui::ViewTreeTokenPtr view_tree_token = registry_->RegisterViewTree( |
33 view_tree.Pass(), view_tree_host_request.Pass(), label); | 36 mojo::ui::ViewTreePtr::Create(std::move(view_tree)), |
| 37 view_tree_host_request.Pass(), label); |
34 callback.Run(view_tree_token.Pass()); | 38 callback.Run(view_tree_token.Pass()); |
35 } | 39 } |
36 | 40 |
37 } // namespace view_manager | 41 } // namespace view_manager |
OLD | NEW |