| 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_.get()) { | 47 if (connect_params_) { |
| 48 DVLOG(1) << "Ignoring second connect"; | 48 DVLOG(1) << "Ignoring second connect"; |
| 49 callback.Run(false); | 49 callback.Run(false); |
| 50 return; | 50 return; |
| 51 } | 51 } |
| 52 connect_params_.reset(new ConnectParams); | 52 connect_params_.reset(new ConnectParams); |
| 53 connect_params_->url = url.To<std::string>(); | 53 connect_params_->url = url.To<std::string>(); |
| 54 connect_params_->callback = callback; | 54 connect_params_->callback = callback; |
| 55 MaybeEmbedRoot(url.To<std::string>(), callback); | 55 MaybeEmbedRoot(url.To<std::string>(), callback); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void ViewManagerInitServiceImpl::OnRootViewManagerWindowTreeHostCreated() { | 58 void ViewManagerInitServiceImpl::OnRootViewManagerWindowTreeHostCreated() { |
| 59 DCHECK(!is_tree_host_ready_); | 59 DCHECK(!is_tree_host_ready_); |
| 60 is_tree_host_ready_ = true; | 60 is_tree_host_ready_ = true; |
| 61 if (connect_params_.get()) | 61 if (connect_params_) |
| 62 MaybeEmbedRoot(connect_params_->url, connect_params_->callback); | 62 MaybeEmbedRoot(connect_params_->url, connect_params_->callback); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void ViewManagerInitServiceImpl::OnNativeViewportDeleted() { | 65 void ViewManagerInitServiceImpl::OnNativeViewportDeleted() { |
| 66 // TODO(beng): Should not have to rely on implementation detail of | 66 // TODO(beng): Should not have to rely on implementation detail of |
| 67 // InterfaceImpl to close the connection. Instead should simply | 67 // InterfaceImpl to close the connection. Instead should simply |
| 68 // be able to delete this object. | 68 // be able to delete this object. |
| 69 internal_state()->router()->CloseMessagePipe(); | 69 internal_state()->router()->CloseMessagePipe(); |
| 70 } | 70 } |
| 71 | 71 |
| 72 } // namespace service | 72 } // namespace service |
| 73 } // namespace view_manager | 73 } // namespace view_manager |
| 74 } // namespace mojo | 74 } // namespace mojo |
| OLD | NEW |