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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "mojo/application/public/cpp/application_delegate.h" | 9 #include "mojo/application/public/cpp/application_delegate.h" |
10 #include "mojo/application/public/cpp/lib/service_registry.h" | 10 #include "mojo/application/public/cpp/lib/service_registry.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 ClearConnections(); | 56 ClearConnections(); |
57 app_lifetime_helper_.ApplicationTerminated(); | 57 app_lifetime_helper_.ApplicationTerminated(); |
58 } | 58 } |
59 | 59 |
60 ApplicationConnection* ApplicationImpl::ConnectToApplication( | 60 ApplicationConnection* ApplicationImpl::ConnectToApplication( |
61 mojo::URLRequestPtr request) { | 61 mojo::URLRequestPtr request) { |
62 return ConnectToApplication(request.Pass(), base::Bind(&base::DoNothing)); | 62 return ConnectToApplication(request.Pass(), base::Bind(&base::DoNothing)); |
63 } | 63 } |
64 | 64 |
65 ApplicationConnection* ApplicationImpl::ConnectToApplication( | 65 ApplicationConnection* ApplicationImpl::ConnectToApplication( |
66 mojo::URLRequestPtr request, const base::Closure& error_cb) { | 66 mojo::URLRequestPtr request, |
| 67 const base::Closure& error_cb) { |
67 MOJO_CHECK(shell_); | 68 MOJO_CHECK(shell_); |
68 ServiceProviderPtr local_services; | 69 ServiceProviderPtr local_services; |
69 InterfaceRequest<ServiceProvider> local_request = GetProxy(&local_services); | 70 InterfaceRequest<ServiceProvider> local_request = GetProxy(&local_services); |
70 ServiceProviderPtr remote_services; | 71 ServiceProviderPtr remote_services; |
71 std::string application_url = request->url.To<std::string>(); | 72 std::string application_url = request->url.To<std::string>(); |
72 shell_->ConnectToApplication(request.Pass(), GetProxy(&remote_services), | 73 shell_->ConnectToApplication(request.Pass(), GetProxy(&remote_services), |
73 local_services.Pass()); | 74 local_services.Pass()); |
74 remote_services.set_connection_error_handler(error_cb); | 75 remote_services.set_connection_error_handler(error_cb); |
75 internal::ServiceRegistry* registry = new internal::ServiceRegistry( | 76 internal::ServiceRegistry* registry = new internal::ServiceRegistry( |
76 this, application_url, application_url, remote_services.Pass(), | 77 this, application_url, application_url, remote_services.Pass(), |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 149 |
149 void ApplicationImpl::OnConnectionError() { | 150 void ApplicationImpl::OnConnectionError() { |
150 base::WeakPtr<ApplicationImpl> ptr(weak_factory_.GetWeakPtr()); | 151 base::WeakPtr<ApplicationImpl> ptr(weak_factory_.GetWeakPtr()); |
151 QuitNow(); | 152 QuitNow(); |
152 if (!ptr) | 153 if (!ptr) |
153 return; | 154 return; |
154 shell_ = nullptr; | 155 shell_ = nullptr; |
155 } | 156 } |
156 | 157 |
157 } // namespace mojo | 158 } // namespace mojo |
OLD | NEW |