| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/browser/mojo/mojo_shell_client_host.h" | 5 #include "content/browser/mojo/mojo_shell_client_host.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 // chokepoint for all process types) and how to wire it through. | 111 // chokepoint for all process types) and how to wire it through. |
| 112 // http://crbug.com/555393 | 112 // http://crbug.com/555393 |
| 113 std::string url = base::StringPrintf( | 113 std::string url = base::StringPrintf( |
| 114 "exe:chrome_renderer%d_%d", child_process_id, instance_id); | 114 "exe:chrome_renderer%d_%d", child_process_id, instance_id); |
| 115 | 115 |
| 116 mojo::shell::mojom::PIDReceiverPtr pid_receiver; | 116 mojo::shell::mojom::PIDReceiverPtr pid_receiver; |
| 117 mojo::InterfaceRequest<mojo::shell::mojom::PIDReceiver> request = | 117 mojo::InterfaceRequest<mojo::shell::mojom::PIDReceiver> request = |
| 118 GetProxy(&pid_receiver); | 118 GetProxy(&pid_receiver); |
| 119 new PIDSender(render_process_host, std::move(pid_receiver)); | 119 new PIDSender(render_process_host, std::move(pid_receiver)); |
| 120 | 120 |
| 121 application_manager->CreateInstanceForHandle( | 121 mojo::shell::mojom::ShellClientFactoryPtr factory; |
| 122 mojo::ScopedHandle(mojo::Handle(request_pipe.release().value())), | 122 factory.Bind(mojo::InterfacePtrInfo<mojo::shell::mojom::ShellClientFactory>( |
| 123 url, | 123 std::move(request_pipe), 0u)); |
| 124 CreateCapabilityFilterForRenderer(), | 124 |
| 125 application_manager->CreateInstanceForFactory( |
| 126 std::move(factory), url, CreateCapabilityFilterForRenderer(), |
| 125 std::move(request)); | 127 std::move(request)); |
| 126 | 128 |
| 127 // Store the URL on the RPH so client code can access it later via | 129 // Store the URL on the RPH so client code can access it later via |
| 128 // GetMojoApplicationInstanceURL(). | 130 // GetMojoApplicationInstanceURL(). |
| 129 SetMojoApplicationInstanceURL(render_process_host, url); | 131 SetMojoApplicationInstanceURL(render_process_host, url); |
| 130 | 132 |
| 131 return pipe_token; | 133 return pipe_token; |
| 132 } | 134 } |
| 133 | 135 |
| 134 std::string GetMojoApplicationInstanceURL( | 136 std::string GetMojoApplicationInstanceURL( |
| 135 RenderProcessHost* render_process_host) { | 137 RenderProcessHost* render_process_host) { |
| 136 InstanceURL* instance_url = static_cast<InstanceURL*>( | 138 InstanceURL* instance_url = static_cast<InstanceURL*>( |
| 137 render_process_host->GetUserData(kMojoShellInstanceURL)); | 139 render_process_host->GetUserData(kMojoShellInstanceURL)); |
| 138 return instance_url ? instance_url->get() : std::string(); | 140 return instance_url ? instance_url->get() : std::string(); |
| 139 } | 141 } |
| 140 | 142 |
| 141 } // namespace content | 143 } // namespace content |
| OLD | NEW |