| 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/public/interfaces/service_provider/service_provider.mojom.h" | 8 #include "mojo/public/interfaces/service_provider/service_provider.mojom.h" |
| 9 #include "mojo/services/view_manager/ids.h" | 9 #include "mojo/services/view_manager/ids.h" |
| 10 #include "mojo/services/view_manager/view_manager_service_impl.h" | 10 #include "mojo/services/view_manager/view_manager_service_impl.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 if (!is_tree_host_ready_) | 37 if (!is_tree_host_ready_) |
| 38 return; | 38 return; |
| 39 | 39 |
| 40 root_node_manager_.EmbedRoot(url); | 40 root_node_manager_.EmbedRoot(url); |
| 41 callback.Run(true); | 41 callback.Run(true); |
| 42 } | 42 } |
| 43 | 43 |
| 44 void ViewManagerInitServiceImpl::EmbedRoot( | 44 void ViewManagerInitServiceImpl::EmbedRoot( |
| 45 const String& url, | 45 const String& url, |
| 46 const Callback<void(bool)>& callback) { | 46 const Callback<void(bool)>& callback) { |
| 47 if (connect_params_) { | 47 // TODO(beng): This means you can only have one EmbedRoot in flight at a time. |
| 48 DVLOG(1) << "Ignoring second connect"; | 48 // Keep a vector of these around instead. |
| 49 callback.Run(false); | |
| 50 return; | |
| 51 } | |
| 52 connect_params_.reset(new ConnectParams); | 49 connect_params_.reset(new ConnectParams); |
| 53 connect_params_->url = url.To<std::string>(); | 50 connect_params_->url = url.To<std::string>(); |
| 54 connect_params_->callback = callback; | 51 connect_params_->callback = callback; |
| 55 MaybeEmbedRoot(url.To<std::string>(), callback); | 52 MaybeEmbedRoot(url.To<std::string>(), callback); |
| 56 } | 53 } |
| 57 | 54 |
| 58 void ViewManagerInitServiceImpl::OnRootViewManagerWindowTreeHostCreated() { | 55 void ViewManagerInitServiceImpl::OnRootViewManagerWindowTreeHostCreated() { |
| 59 DCHECK(!is_tree_host_ready_); | 56 DCHECK(!is_tree_host_ready_); |
| 60 is_tree_host_ready_ = true; | 57 is_tree_host_ready_ = true; |
| 61 if (connect_params_) | 58 if (connect_params_) |
| 62 MaybeEmbedRoot(connect_params_->url, connect_params_->callback); | 59 MaybeEmbedRoot(connect_params_->url, connect_params_->callback); |
| 63 } | 60 } |
| 64 | 61 |
| 65 void ViewManagerInitServiceImpl::OnNativeViewportDeleted() { | 62 void ViewManagerInitServiceImpl::OnNativeViewportDeleted() { |
| 66 // TODO(beng): Should not have to rely on implementation detail of | 63 // TODO(beng): Should not have to rely on implementation detail of |
| 67 // InterfaceImpl to close the connection. Instead should simply | 64 // InterfaceImpl to close the connection. Instead should simply |
| 68 // be able to delete this object. | 65 // be able to delete this object. |
| 69 internal_state()->router()->CloseMessagePipe(); | 66 internal_state()->router()->CloseMessagePipe(); |
| 70 } | 67 } |
| 71 | 68 |
| 72 } // namespace service | 69 } // namespace service |
| 73 } // namespace view_manager | 70 } // namespace view_manager |
| 74 } // namespace mojo | 71 } // namespace mojo |
| OLD | NEW |