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> | 7 #include <utility> |
8 | 8 |
| 9 #include "base/bind.h" |
| 10 |
9 #include "services/ui/view_manager/view_impl.h" | 11 #include "services/ui/view_manager/view_impl.h" |
10 #include "services/ui/view_manager/view_tree_impl.h" | 12 #include "services/ui/view_manager/view_tree_impl.h" |
11 | 13 |
12 namespace view_manager { | 14 namespace view_manager { |
13 | 15 |
14 ViewManagerImpl::ViewManagerImpl(ViewRegistry* registry) | 16 ViewManagerImpl::ViewManagerImpl(ViewRegistry* registry) |
15 : registry_(registry) {} | 17 : registry_(registry) {} |
16 | 18 |
17 ViewManagerImpl::~ViewManagerImpl() {} | 19 ViewManagerImpl::~ViewManagerImpl() {} |
18 | 20 |
(...skipping 10 matching lines...) Expand all Loading... |
29 void ViewManagerImpl::CreateViewTree( | 31 void ViewManagerImpl::CreateViewTree( |
30 mojo::InterfaceRequest<mojo::ui::ViewTree> view_tree_request, | 32 mojo::InterfaceRequest<mojo::ui::ViewTree> view_tree_request, |
31 mojo::InterfaceHandle<mojo::ui::ViewTreeListener> view_tree_listener, | 33 mojo::InterfaceHandle<mojo::ui::ViewTreeListener> view_tree_listener, |
32 const mojo::String& label) { | 34 const mojo::String& label) { |
33 registry_->CreateViewTree( | 35 registry_->CreateViewTree( |
34 view_tree_request.Pass(), | 36 view_tree_request.Pass(), |
35 mojo::ui::ViewTreeListenerPtr::Create(std::move(view_tree_listener)), | 37 mojo::ui::ViewTreeListenerPtr::Create(std::move(view_tree_listener)), |
36 label); | 38 label); |
37 } | 39 } |
38 | 40 |
| 41 // this should only really be called by trusted code (ie launcher) -- how to |
| 42 // ensure that? |
| 43 void ViewManagerImpl::RegisterViewAssociate( |
| 44 mojo::InterfaceHandle<mojo::ui::ViewAssociate> view_associate, |
| 45 const mojo::String& url) { |
| 46 registry_->RegisterViewAssociate( |
| 47 registry_, mojo::ui::ViewAssociatePtr::Create(std::move(view_associate)), |
| 48 url, // should we really be passing this in like this? |
| 49 base::Bind(&ViewManagerImpl::OnAssociateConnectionError, |
| 50 base::Unretained(this))); |
| 51 } |
| 52 |
| 53 // copied from ViewManagerImpl, is this a bad idea? |
| 54 void ViewManagerImpl::OnAssociateConnectionError(const std::string& url) { |
| 55 LOG(ERROR) << "Exiting due to view associate connection error: url=" << url; |
| 56 // Shutdown(); |
| 57 } |
| 58 |
39 } // namespace view_manager | 59 } // namespace view_manager |
OLD | NEW |