| 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_manager/application_manager.h" | 5 #include "mojo/application_manager/application_manager.h" |
| 6 | 6 |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 ServiceProviderPtr service_provider) { | 199 ServiceProviderPtr service_provider) { |
| 200 if (interceptor_) { | 200 if (interceptor_) { |
| 201 shell_impl->ConnectToClient( | 201 shell_impl->ConnectToClient( |
| 202 requestor_url, | 202 requestor_url, |
| 203 interceptor_->OnConnectToClient(url, service_provider.Pass())); | 203 interceptor_->OnConnectToClient(url, service_provider.Pass())); |
| 204 } else { | 204 } else { |
| 205 shell_impl->ConnectToClient(requestor_url, service_provider.Pass()); | 205 shell_impl->ConnectToClient(requestor_url, service_provider.Pass()); |
| 206 } | 206 } |
| 207 } | 207 } |
| 208 | 208 |
| 209 void ApplicationManager::RegisterExternalApplication( |
| 210 const GURL& url, |
| 211 ScopedMessagePipeHandle shell_handle) { |
| 212 url_to_shell_impl_[url] = |
| 213 WeakBindToPipe(new ShellImpl(this, url), shell_handle.Pass()); |
| 214 } |
| 215 |
| 209 void ApplicationManager::RegisterLoadedApplication( | 216 void ApplicationManager::RegisterLoadedApplication( |
| 210 const GURL& url, | 217 const GURL& url, |
| 211 const GURL& requestor_url, | 218 const GURL& requestor_url, |
| 212 ServiceProviderPtr service_provider, | 219 ServiceProviderPtr service_provider, |
| 213 ScopedMessagePipeHandle* shell_handle) { | 220 ScopedMessagePipeHandle* shell_handle) { |
| 214 ShellImpl* shell_impl = NULL; | 221 ShellImpl* shell_impl = NULL; |
| 215 URLToShellImplMap::iterator iter = url_to_shell_impl_.find(url); | 222 URLToShellImplMap::iterator iter = url_to_shell_impl_.find(url); |
| 216 if (iter != url_to_shell_impl_.end()) { | 223 if (iter != url_to_shell_impl_.end()) { |
| 217 // This can happen because services are loaded asynchronously. So if we get | 224 // This can happen because services are loaded asynchronously. So if we get |
| 218 // two requests for the same service close to each other, we might get here | 225 // two requests for the same service close to each other, we might get here |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 StubServiceProvider* stub_sp = new StubServiceProvider; | 319 StubServiceProvider* stub_sp = new StubServiceProvider; |
| 313 ServiceProviderPtr spp; | 320 ServiceProviderPtr spp; |
| 314 BindToProxy(stub_sp, &spp); | 321 BindToProxy(stub_sp, &spp); |
| 315 ConnectToApplication(application_url, GURL(), spp.Pass()); | 322 ConnectToApplication(application_url, GURL(), spp.Pass()); |
| 316 MessagePipe pipe; | 323 MessagePipe pipe; |
| 317 stub_sp->GetRemoteServiceProvider()->ConnectToService(interface_name, | 324 stub_sp->GetRemoteServiceProvider()->ConnectToService(interface_name, |
| 318 pipe.handle1.Pass()); | 325 pipe.handle1.Pass()); |
| 319 return pipe.handle0.Pass(); | 326 return pipe.handle0.Pass(); |
| 320 } | 327 } |
| 321 } // namespace mojo | 328 } // namespace mojo |
| OLD | NEW |