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/application/public/cpp/application_impl.h" | 5 #include "mojo/application/public/cpp/application_impl.h" |
6 | 6 |
7 #include "mojo/application/public/cpp/application_delegate.h" | 7 #include "mojo/application/public/cpp/application_delegate.h" |
8 #include "mojo/application/public/cpp/lib/service_registry.h" | 8 #include "mojo/application/public/cpp/lib/service_registry.h" |
9 #include "mojo/public/cpp/bindings/interface_ptr.h" | 9 #include "mojo/public/cpp/bindings/interface_ptr.h" |
10 #include "mojo/public/cpp/environment/logging.h" | 10 #include "mojo/public/cpp/environment/logging.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 incoming_service_registries_.clear(); | 43 incoming_service_registries_.clear(); |
44 outgoing_service_registries_.clear(); | 44 outgoing_service_registries_.clear(); |
45 } | 45 } |
46 | 46 |
47 ApplicationImpl::~ApplicationImpl() { | 47 ApplicationImpl::~ApplicationImpl() { |
48 ClearConnections(); | 48 ClearConnections(); |
49 delete shell_watch_; | 49 delete shell_watch_; |
50 } | 50 } |
51 | 51 |
52 ApplicationConnection* ApplicationImpl::ConnectToApplication( | 52 ApplicationConnection* ApplicationImpl::ConnectToApplication( |
53 const String& application_url) { | 53 mojo::URLRequestPtr request) { |
54 MOJO_CHECK(shell_); | 54 MOJO_CHECK(shell_); |
55 ServiceProviderPtr local_services; | 55 ServiceProviderPtr local_services; |
56 InterfaceRequest<ServiceProvider> local_request = GetProxy(&local_services); | 56 InterfaceRequest<ServiceProvider> local_request = GetProxy(&local_services); |
57 ServiceProviderPtr remote_services; | 57 ServiceProviderPtr remote_services; |
58 shell_->ConnectToApplication(application_url, GetProxy(&remote_services), | 58 std::string application_url = request->url.To<std::string>(); |
| 59 shell_->ConnectToApplication(request.Pass(), GetProxy(&remote_services), |
59 local_services.Pass()); | 60 local_services.Pass()); |
60 internal::ServiceRegistry* registry = new internal::ServiceRegistry( | 61 internal::ServiceRegistry* registry = new internal::ServiceRegistry( |
61 this, application_url, application_url, remote_services.Pass(), | 62 this, application_url, application_url, remote_services.Pass(), |
62 local_request.Pass()); | 63 local_request.Pass()); |
63 if (!delegate_->ConfigureOutgoingConnection(registry)) { | 64 if (!delegate_->ConfigureOutgoingConnection(registry)) { |
64 delete registry; | 65 delete registry; |
65 return nullptr; | 66 return nullptr; |
66 } | 67 } |
67 outgoing_service_registries_.push_back(registry); | 68 outgoing_service_registries_.push_back(registry); |
68 return registry; | 69 return registry; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 } | 102 } |
102 incoming_service_registries_.push_back(registry); | 103 incoming_service_registries_.push_back(registry); |
103 } | 104 } |
104 | 105 |
105 void ApplicationImpl::RequestQuit() { | 106 void ApplicationImpl::RequestQuit() { |
106 delegate_->Quit(); | 107 delegate_->Quit(); |
107 Terminate(); | 108 Terminate(); |
108 } | 109 } |
109 | 110 |
110 } // namespace mojo | 111 } // namespace mojo |
OLD | NEW |