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