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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 mojo::shell::mojom::ShellClientFactoryPtr factory; | 113 mojo::shell::mojom::ShellClientFactoryPtr factory; |
114 factory.Bind(mojo::InterfacePtrInfo<mojo::shell::mojom::ShellClientFactory>( | 114 factory.Bind(mojo::InterfacePtrInfo<mojo::shell::mojom::ShellClientFactory>( |
115 std::move(request_pipe), 0u)); | 115 std::move(request_pipe), 0u)); |
116 | 116 |
117 mojo::Identity target("exe:chrome_renderer", | 117 mojo::Identity target("exe:chrome_renderer", |
118 mojo::shell::mojom::kInheritUserID, | 118 mojo::shell::mojom::kInheritUserID, |
119 base::StringPrintf("%d_%d", child_process_id, | 119 base::StringPrintf("%d_%d", child_process_id, |
120 instance_id)); | 120 instance_id)); |
121 shell->CreateInstance(std::move(factory), | 121 shell->CreateInstance(std::move(factory), |
122 mojo::shell::mojom::Identity::From(target), | 122 mojo::shell::mojom::Identity::From(target), |
123 CreateCapabilityFilterForRenderer(), | |
124 std::move(request), base::Bind(&OnConnectionComplete)); | 123 std::move(request), base::Bind(&OnConnectionComplete)); |
125 | 124 |
126 // Store the Identity on the RPH so client code can access it later via | 125 // Store the Identity on the RPH so client code can access it later via |
127 // GetMojoIdentity(). | 126 // GetMojoIdentity(). |
128 SetMojoIdentity(render_process_host, target); | 127 SetMojoIdentity(render_process_host, target); |
129 | 128 |
130 return pipe_token; | 129 return pipe_token; |
131 } | 130 } |
132 | 131 |
133 mojo::Identity GetMojoIdentity(RenderProcessHost* render_process_host) { | 132 mojo::Identity GetMojoIdentity(RenderProcessHost* render_process_host) { |
134 InstanceIdentity* instance_identity = static_cast<InstanceIdentity*>( | 133 InstanceIdentity* instance_identity = static_cast<InstanceIdentity*>( |
135 render_process_host->GetUserData(kMojoShellInstanceIdentity)); | 134 render_process_host->GetUserData(kMojoShellInstanceIdentity)); |
136 return instance_identity ? instance_identity->get() : mojo::Identity(); | 135 return instance_identity ? instance_identity->get() : mojo::Identity(); |
137 } | 136 } |
138 | 137 |
139 } // namespace content | 138 } // namespace content |
OLD | NEW |