Chromium Code Reviews| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 void ConnectToClient(const GURL& requestor_url, | 91 void ConnectToClient(const GURL& requestor_url, |
| 92 ServiceProviderPtr service_provider) { | 92 ServiceProviderPtr service_provider) { |
| 93 client()->AcceptConnection(String::From(requestor_url), | 93 client()->AcceptConnection(String::From(requestor_url), |
| 94 service_provider.Pass()); | 94 service_provider.Pass()); |
| 95 } | 95 } |
| 96 | 96 |
| 97 // ServiceProvider implementation: | 97 // ServiceProvider implementation: |
| 98 void ConnectToApplication( | 98 void ConnectToApplication( |
| 99 const String& app_url, | 99 const String& app_url, |
| 100 InterfaceRequest<ServiceProvider> in_service_provider) override { | 100 InterfaceRequest<ServiceProvider> in_service_provider) override { |
| 101 GURL app_gurl(app_url.get()); | |
|
Aaron Boodman
2014/11/19 20:29:28
If we were going to check the URL before requestin
| |
| 102 if (!app_gurl.is_valid()) { | |
| 103 LOG(ERROR) << "Error: \"" << app_url << "\" is not a valid URL."; | |
| 104 } | |
| 101 ServiceProviderPtr out_service_provider; | 105 ServiceProviderPtr out_service_provider; |
| 102 out_service_provider.Bind(in_service_provider.PassMessagePipe()); | 106 out_service_provider.Bind(in_service_provider.PassMessagePipe()); |
| 103 manager_->ConnectToApplication( | 107 manager_->ConnectToApplication( |
| 104 app_url.To<GURL>(), url_, out_service_provider.Pass()); | 108 app_gurl, url_, out_service_provider.Pass()); |
| 105 } | 109 } |
| 106 | 110 |
| 107 const GURL& url() const { return url_; } | 111 const GURL& url() const { return url_; } |
| 108 | 112 |
| 109 private: | 113 private: |
| 110 void OnConnectionError() override { manager_->OnShellImplError(this); } | 114 void OnConnectionError() override { manager_->OnShellImplError(this); } |
| 111 | 115 |
| 112 ApplicationManager* const manager_; | 116 ApplicationManager* const manager_; |
| 113 const GURL url_; | 117 const GURL url_; |
| 114 | 118 |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 316 StubServiceProvider* stub_sp = new StubServiceProvider; | 320 StubServiceProvider* stub_sp = new StubServiceProvider; |
| 317 ServiceProviderPtr spp; | 321 ServiceProviderPtr spp; |
| 318 BindToProxy(stub_sp, &spp); | 322 BindToProxy(stub_sp, &spp); |
| 319 ConnectToApplication(application_url, GURL(), spp.Pass()); | 323 ConnectToApplication(application_url, GURL(), spp.Pass()); |
| 320 MessagePipe pipe; | 324 MessagePipe pipe; |
| 321 stub_sp->GetRemoteServiceProvider()->ConnectToService(interface_name, | 325 stub_sp->GetRemoteServiceProvider()->ConnectToService(interface_name, |
| 322 pipe.handle1.Pass()); | 326 pipe.handle1.Pass()); |
| 323 return pipe.handle0.Pass(); | 327 return pipe.handle0.Pass(); |
| 324 } | 328 } |
| 325 } // namespace mojo | 329 } // namespace mojo |
| OLD | NEW |