| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "mojo/services/view_manager/view_manager_init_service_impl.h" | 5 #include "mojo/services/view_manager/view_manager_init_service_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "mojo/services/view_manager/ids.h" | 8 #include "mojo/services/view_manager/ids.h" |
| 9 #include "mojo/services/view_manager/view_manager_init_service_context.h" | 9 #include "mojo/services/view_manager/view_manager_init_service_context.h" |
| 10 #include "mojo/services/view_manager/view_manager_service_impl.h" | 10 #include "mojo/services/view_manager/view_manager_service_impl.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 void ViewManagerInitServiceImpl::OnRootViewManagerWindowTreeHostCreated() { | 35 void ViewManagerInitServiceImpl::OnRootViewManagerWindowTreeHostCreated() { |
| 36 MaybeEmbed(); | 36 MaybeEmbed(); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void ViewManagerInitServiceImpl::MaybeEmbed() { | 39 void ViewManagerInitServiceImpl::MaybeEmbed() { |
| 40 if (!context_->is_tree_host_ready()) | 40 if (!context_->is_tree_host_ready()) |
| 41 return; | 41 return; |
| 42 | 42 |
| 43 ScopedVector<ConnectParams>::const_iterator it = connect_params_.begin(); | 43 ScopedVector<ConnectParams>::const_iterator it = connect_params_.begin(); |
| 44 for (; it != connect_params_.end(); ++it) { | 44 for (; it != connect_params_.end(); ++it) { |
| 45 context_->root_node_manager()->EmbedRoot((*it)->url); | 45 context_->root_node_manager()->EmbedRoot((*it)->url, |
| 46 (*it)->service_provider.Pass()); |
| 46 (*it)->callback.Run(true); | 47 (*it)->callback.Run(true); |
| 47 } | 48 } |
| 48 connect_params_.clear(); | 49 connect_params_.clear(); |
| 49 } | 50 } |
| 50 | 51 |
| 51 void ViewManagerInitServiceImpl::Embed( | 52 void ViewManagerInitServiceImpl::Embed( |
| 52 const String& url, | 53 const String& url, |
| 54 ServiceProviderPtr service_provider, |
| 53 const Callback<void(bool)>& callback) { | 55 const Callback<void(bool)>& callback) { |
| 54 ConnectParams* params = new ConnectParams; | 56 ConnectParams* params = new ConnectParams; |
| 55 params->url = url.To<std::string>(); | 57 params->url = url.To<std::string>(); |
| 56 params->callback = callback; | 58 params->callback = callback; |
| 59 params->service_provider.Bind(service_provider.PassMessagePipe()); |
| 57 connect_params_.push_back(params); | 60 connect_params_.push_back(params); |
| 58 MaybeEmbed(); | 61 MaybeEmbed(); |
| 59 } | 62 } |
| 60 | 63 |
| 61 } // namespace service | 64 } // namespace service |
| 62 } // namespace mojo | 65 } // namespace mojo |
| OLD | NEW |