| 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_context.h" | 5 #include "content/browser/mojo/mojo_shell_context.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
| 13 #include "base/thread_task_runner_handle.h" | 13 #include "base/thread_task_runner_handle.h" |
| 14 #include "content/browser/gpu/gpu_process_host.h" | 14 #include "content/browser/gpu/gpu_process_host.h" |
| 15 #include "content/common/gpu/gpu_process_launch_causes.h" | 15 #include "content/common/gpu/gpu_process_launch_causes.h" |
| 16 #include "content/common/mojo/mojo_shell_connection_impl.h" | 16 #include "content/common/mojo/mojo_shell_connection_impl.h" |
| 17 #include "content/common/mojo/static_application_loader.h" | 17 #include "content/common/mojo/static_application_loader.h" |
| 18 #include "content/common/process_control.mojom.h" | 18 #include "content/common/process_control.mojom.h" |
| 19 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
| 20 #include "content/public/browser/content_browser_client.h" | 20 #include "content/public/browser/content_browser_client.h" |
| 21 #include "content/public/browser/utility_process_host.h" | 21 #include "content/public/browser/utility_process_host.h" |
| 22 #include "content/public/browser/utility_process_host_client.h" | 22 #include "content/public/browser/utility_process_host_client.h" |
| 23 #include "content/public/common/content_client.h" | 23 #include "content/public/common/content_client.h" |
| 24 #include "content/public/common/service_registry.h" | 24 #include "content/public/common/service_registry.h" |
| 25 #include "mojo/common/url_type_converters.h" | |
| 26 #include "mojo/public/cpp/bindings/interface_request.h" | 25 #include "mojo/public/cpp/bindings/interface_request.h" |
| 27 #include "mojo/public/cpp/bindings/string.h" | 26 #include "mojo/public/cpp/bindings/string.h" |
| 28 #include "mojo/shell/application_loader.h" | 27 #include "mojo/shell/application_loader.h" |
| 29 #include "mojo/shell/connect_params.h" | 28 #include "mojo/shell/connect_params.h" |
| 30 #include "mojo/shell/identity.h" | 29 #include "mojo/shell/identity.h" |
| 31 #include "mojo/shell/native_runner.h" | 30 #include "mojo/shell/native_runner.h" |
| 32 #include "mojo/shell/public/cpp/shell_client.h" | 31 #include "mojo/shell/public/cpp/shell_client.h" |
| 33 #include "mojo/shell/public/interfaces/shell.mojom.h" | 32 #include "mojo/shell/public/interfaces/shell.mojom.h" |
| 34 #include "mojo/shell/runner/host/in_process_native_runner.h" | 33 #include "mojo/shell/runner/host/in_process_native_runner.h" |
| 35 | 34 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 50 UtilityProcessHost::Create(nullptr, nullptr); | 49 UtilityProcessHost::Create(nullptr, nullptr); |
| 51 process_host->SetName(process_name); | 50 process_host->SetName(process_name); |
| 52 if (!use_sandbox) | 51 if (!use_sandbox) |
| 53 process_host->DisableSandbox(); | 52 process_host->DisableSandbox(); |
| 54 process_host->StartMojoMode(); | 53 process_host->StartMojoMode(); |
| 55 | 54 |
| 56 ServiceRegistry* services = process_host->GetServiceRegistry(); | 55 ServiceRegistry* services = process_host->GetServiceRegistry(); |
| 57 services->ConnectToRemoteService(std::move(request)); | 56 services->ConnectToRemoteService(std::move(request)); |
| 58 } | 57 } |
| 59 | 58 |
| 60 void OnApplicationLoaded(const GURL& url, bool success) { | 59 void OnApplicationLoaded(const std::string& name, bool success) { |
| 61 if (!success) | 60 if (!success) |
| 62 LOG(ERROR) << "Failed to launch Mojo application for " << url.spec(); | 61 LOG(ERROR) << "Failed to launch Mojo application for " << name; |
| 63 } | 62 } |
| 64 | 63 |
| 65 // The default loader to use for all applications. This does nothing but drop | 64 // The default loader to use for all applications. This does nothing but drop |
| 66 // the Application request. | 65 // the Application request. |
| 67 class DefaultApplicationLoader : public mojo::shell::ApplicationLoader { | 66 class DefaultApplicationLoader : public mojo::shell::ApplicationLoader { |
| 68 public: | 67 public: |
| 69 DefaultApplicationLoader() {} | 68 DefaultApplicationLoader() {} |
| 70 ~DefaultApplicationLoader() override {} | 69 ~DefaultApplicationLoader() override {} |
| 71 | 70 |
| 72 private: | 71 private: |
| 73 // mojo::shell::ApplicationLoader: | 72 // mojo::shell::ApplicationLoader: |
| 74 void Load(const GURL& url, | 73 void Load(const std::string& name, |
| 75 mojo::InterfaceRequest<mojo::shell::mojom::ShellClient> request) | 74 mojo::InterfaceRequest<mojo::shell::mojom::ShellClient> request) |
| 76 override {} | 75 override {} |
| 77 | 76 |
| 78 DISALLOW_COPY_AND_ASSIGN(DefaultApplicationLoader); | 77 DISALLOW_COPY_AND_ASSIGN(DefaultApplicationLoader); |
| 79 }; | 78 }; |
| 80 | 79 |
| 81 // This launches a utility process and forwards the Load request the | 80 // This launches a utility process and forwards the Load request the |
| 82 // ProcessControl service there. The utility process is sandboxed iff | 81 // ProcessControl service there. The utility process is sandboxed iff |
| 83 // |use_sandbox| is true. | 82 // |use_sandbox| is true. |
| 84 class UtilityProcessLoader : public mojo::shell::ApplicationLoader { | 83 class UtilityProcessLoader : public mojo::shell::ApplicationLoader { |
| 85 public: | 84 public: |
| 86 UtilityProcessLoader(const base::string16& process_name, bool use_sandbox) | 85 UtilityProcessLoader(const base::string16& process_name, bool use_sandbox) |
| 87 : process_name_(process_name), use_sandbox_(use_sandbox) {} | 86 : process_name_(process_name), use_sandbox_(use_sandbox) {} |
| 88 ~UtilityProcessLoader() override {} | 87 ~UtilityProcessLoader() override {} |
| 89 | 88 |
| 90 private: | 89 private: |
| 91 // mojo::shell::ApplicationLoader: | 90 // mojo::shell::ApplicationLoader: |
| 92 void Load(const GURL& url, | 91 void Load(const std::string& name, |
| 93 mojo::InterfaceRequest<mojo::shell::mojom::ShellClient> request) | 92 mojo::InterfaceRequest<mojo::shell::mojom::ShellClient> request) |
| 94 override { | 93 override { |
| 95 ProcessControlPtr process_control; | 94 ProcessControlPtr process_control; |
| 96 auto process_request = mojo::GetProxy(&process_control); | 95 auto process_request = mojo::GetProxy(&process_control); |
| 97 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 96 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 98 base::Bind(&StartUtilityProcessOnIOThread, | 97 base::Bind(&StartUtilityProcessOnIOThread, |
| 99 base::Passed(&process_request), | 98 base::Passed(&process_request), |
| 100 process_name_, use_sandbox_)); | 99 process_name_, use_sandbox_)); |
| 101 process_control->LoadApplication(url.spec(), std::move(request), | 100 process_control->LoadApplication(name, std::move(request), |
| 102 base::Bind(&OnApplicationLoaded, url)); | 101 base::Bind(&OnApplicationLoaded, name)); |
| 103 } | 102 } |
| 104 | 103 |
| 105 const base::string16 process_name_; | 104 const base::string16 process_name_; |
| 106 const bool use_sandbox_; | 105 const bool use_sandbox_; |
| 107 | 106 |
| 108 DISALLOW_COPY_AND_ASSIGN(UtilityProcessLoader); | 107 DISALLOW_COPY_AND_ASSIGN(UtilityProcessLoader); |
| 109 }; | 108 }; |
| 110 | 109 |
| 111 // Request ProcessControl from GPU process host. Must be called on IO thread. | 110 // Request ProcessControl from GPU process host. Must be called on IO thread. |
| 112 void RequestGpuProcessControl(mojo::InterfaceRequest<ProcessControl> request) { | 111 void RequestGpuProcessControl(mojo::InterfaceRequest<ProcessControl> request) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 127 } | 126 } |
| 128 | 127 |
| 129 // Forwards the load request to the GPU process. | 128 // Forwards the load request to the GPU process. |
| 130 class GpuProcessLoader : public mojo::shell::ApplicationLoader { | 129 class GpuProcessLoader : public mojo::shell::ApplicationLoader { |
| 131 public: | 130 public: |
| 132 GpuProcessLoader() {} | 131 GpuProcessLoader() {} |
| 133 ~GpuProcessLoader() override {} | 132 ~GpuProcessLoader() override {} |
| 134 | 133 |
| 135 private: | 134 private: |
| 136 // mojo::shell::ApplicationLoader: | 135 // mojo::shell::ApplicationLoader: |
| 137 void Load(const GURL& url, | 136 void Load(const std::string& name, |
| 138 mojo::InterfaceRequest<mojo::shell::mojom::ShellClient> request) | 137 mojo::InterfaceRequest<mojo::shell::mojom::ShellClient> request) |
| 139 override { | 138 override { |
| 140 ProcessControlPtr process_control; | 139 ProcessControlPtr process_control; |
| 141 auto process_request = mojo::GetProxy(&process_control); | 140 auto process_request = mojo::GetProxy(&process_control); |
| 142 BrowserThread::PostTask( | 141 BrowserThread::PostTask( |
| 143 BrowserThread::IO, FROM_HERE, | 142 BrowserThread::IO, FROM_HERE, |
| 144 base::Bind(&RequestGpuProcessControl, base::Passed(&process_request))); | 143 base::Bind(&RequestGpuProcessControl, base::Passed(&process_request))); |
| 145 process_control->LoadApplication(url.spec(), std::move(request), | 144 process_control->LoadApplication(name, std::move(request), |
| 146 base::Bind(&OnApplicationLoaded, url)); | 145 base::Bind(&OnApplicationLoaded, name)); |
| 147 } | 146 } |
| 148 | 147 |
| 149 DISALLOW_COPY_AND_ASSIGN(GpuProcessLoader); | 148 DISALLOW_COPY_AND_ASSIGN(GpuProcessLoader); |
| 150 }; | 149 }; |
| 151 | 150 |
| 152 } // namespace | 151 } // namespace |
| 153 | 152 |
| 154 // Thread-safe proxy providing access to the shell context from any thread. | 153 // Thread-safe proxy providing access to the shell context from any thread. |
| 155 class MojoShellContext::Proxy { | 154 class MojoShellContext::Proxy { |
| 156 public: | 155 public: |
| 157 Proxy(MojoShellContext* shell_context) | 156 Proxy(MojoShellContext* shell_context) |
| 158 : shell_context_(shell_context), | 157 : shell_context_(shell_context), |
| 159 task_runner_(base::ThreadTaskRunnerHandle::Get()) {} | 158 task_runner_(base::ThreadTaskRunnerHandle::Get()) {} |
| 160 | 159 |
| 161 ~Proxy() {} | 160 ~Proxy() {} |
| 162 | 161 |
| 163 void ConnectToApplication( | 162 void ConnectToApplication( |
| 164 const GURL& url, | 163 const std::string& name, |
| 165 const GURL& requestor_url, | 164 const std::string& requestor_name, |
| 166 mojo::shell::mojom::InterfaceProviderRequest request, | 165 mojo::shell::mojom::InterfaceProviderRequest request, |
| 167 mojo::shell::mojom::InterfaceProviderPtr exposed_services, | 166 mojo::shell::mojom::InterfaceProviderPtr exposed_services, |
| 168 const mojo::shell::mojom::Connector::ConnectCallback& callback) { | 167 const mojo::shell::mojom::Connector::ConnectCallback& callback) { |
| 169 if (task_runner_ == base::ThreadTaskRunnerHandle::Get()) { | 168 if (task_runner_ == base::ThreadTaskRunnerHandle::Get()) { |
| 170 if (shell_context_) { | 169 if (shell_context_) { |
| 171 shell_context_->ConnectToApplicationOnOwnThread( | 170 shell_context_->ConnectToApplicationOnOwnThread( |
| 172 url, requestor_url, std::move(request), std::move(exposed_services), | 171 name, requestor_name, std::move(request), |
| 173 callback); | 172 std::move(exposed_services), callback); |
| 174 } | 173 } |
| 175 } else { | 174 } else { |
| 176 // |shell_context_| outlives the main MessageLoop, so it's safe for it to | 175 // |shell_context_| outlives the main MessageLoop, so it's safe for it to |
| 177 // be unretained here. | 176 // be unretained here. |
| 178 task_runner_->PostTask( | 177 task_runner_->PostTask( |
| 179 FROM_HERE, | 178 FROM_HERE, |
| 180 base::Bind(&MojoShellContext::ConnectToApplicationOnOwnThread, | 179 base::Bind(&MojoShellContext::ConnectToApplicationOnOwnThread, |
| 181 base::Unretained(shell_context_), url, requestor_url, | 180 base::Unretained(shell_context_), name, requestor_name, |
| 182 base::Passed(&request), base::Passed(&exposed_services), | 181 base::Passed(&request), base::Passed(&exposed_services), |
| 183 callback)); | 182 callback)); |
| 184 } | 183 } |
| 185 } | 184 } |
| 186 | 185 |
| 187 private: | 186 private: |
| 188 MojoShellContext* shell_context_; | 187 MojoShellContext* shell_context_; |
| 189 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 188 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 190 | 189 |
| 191 DISALLOW_COPY_AND_ASSIGN(Proxy); | 190 DISALLOW_COPY_AND_ASSIGN(Proxy); |
| 192 }; | 191 }; |
| 193 | 192 |
| 194 // static | 193 // static |
| 195 base::LazyInstance<scoped_ptr<MojoShellContext::Proxy>> | 194 base::LazyInstance<scoped_ptr<MojoShellContext::Proxy>> |
| 196 MojoShellContext::proxy_ = LAZY_INSTANCE_INITIALIZER; | 195 MojoShellContext::proxy_ = LAZY_INSTANCE_INITIALIZER; |
| 197 | 196 |
| 198 void MojoShellContext::SetApplicationsForTest( | 197 void MojoShellContext::SetApplicationsForTest( |
| 199 const StaticApplicationMap* apps) { | 198 const StaticApplicationMap* apps) { |
| 200 g_applications_for_test = apps; | 199 g_applications_for_test = apps; |
| 201 } | 200 } |
| 202 | 201 |
| 203 MojoShellContext::MojoShellContext() { | 202 MojoShellContext::MojoShellContext() { |
| 204 proxy_.Get().reset(new Proxy(this)); | 203 proxy_.Get().reset(new Proxy(this)); |
| 205 | 204 |
| 206 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner = | 205 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner = |
| 207 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE); | 206 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE); |
| 208 bool register_mojo_url_schemes = false; | |
| 209 | |
| 210 scoped_ptr<mojo::shell::NativeRunnerFactory> native_runner_factory( | 207 scoped_ptr<mojo::shell::NativeRunnerFactory> native_runner_factory( |
| 211 new mojo::shell::InProcessNativeRunnerFactory( | 208 new mojo::shell::InProcessNativeRunnerFactory( |
| 212 BrowserThread::GetBlockingPool())); | 209 BrowserThread::GetBlockingPool())); |
| 213 application_manager_.reset(new mojo::shell::ApplicationManager( | 210 application_manager_.reset(new mojo::shell::ApplicationManager( |
| 214 std::move(native_runner_factory), file_task_runner.get(), | 211 std::move(native_runner_factory), file_task_runner.get(), nullptr)); |
| 215 register_mojo_url_schemes, nullptr)); | |
| 216 | 212 |
| 217 application_manager_->set_default_loader( | 213 application_manager_->set_default_loader( |
| 218 scoped_ptr<mojo::shell::ApplicationLoader>(new DefaultApplicationLoader)); | 214 scoped_ptr<mojo::shell::ApplicationLoader>(new DefaultApplicationLoader)); |
| 219 | 215 |
| 220 StaticApplicationMap apps; | 216 StaticApplicationMap apps; |
| 221 GetContentClient()->browser()->RegisterInProcessMojoApplications(&apps); | 217 GetContentClient()->browser()->RegisterInProcessMojoApplications(&apps); |
| 222 if (g_applications_for_test) { | 218 if (g_applications_for_test) { |
| 223 // Add testing apps to the map, potentially overwriting whatever the | 219 // Add testing apps to the map, potentially overwriting whatever the |
| 224 // browser client registered. | 220 // browser client registered. |
| 225 for (const auto& entry : *g_applications_for_test) | 221 for (const auto& entry : *g_applications_for_test) |
| 226 apps[entry.first] = entry.second; | 222 apps[entry.first] = entry.second; |
| 227 } | 223 } |
| 228 for (const auto& entry : apps) { | 224 for (const auto& entry : apps) { |
| 229 application_manager_->SetLoaderForURL( | 225 application_manager_->SetLoaderForName( |
| 230 scoped_ptr<mojo::shell::ApplicationLoader>( | 226 scoped_ptr<mojo::shell::ApplicationLoader>( |
| 231 new StaticApplicationLoader(entry.second)), | 227 new StaticApplicationLoader(entry.second)), |
| 232 entry.first); | 228 entry.first); |
| 233 } | 229 } |
| 234 | 230 |
| 235 ContentBrowserClient::OutOfProcessMojoApplicationMap sandboxed_apps; | 231 ContentBrowserClient::OutOfProcessMojoApplicationMap sandboxed_apps; |
| 236 GetContentClient() | 232 GetContentClient() |
| 237 ->browser() | 233 ->browser() |
| 238 ->RegisterOutOfProcessMojoApplications(&sandboxed_apps); | 234 ->RegisterOutOfProcessMojoApplications(&sandboxed_apps); |
| 239 for (const auto& app : sandboxed_apps) { | 235 for (const auto& app : sandboxed_apps) { |
| 240 application_manager_->SetLoaderForURL( | 236 application_manager_->SetLoaderForName( |
| 241 scoped_ptr<mojo::shell::ApplicationLoader>( | 237 scoped_ptr<mojo::shell::ApplicationLoader>( |
| 242 new UtilityProcessLoader(app.second, true /* use_sandbox */)), | 238 new UtilityProcessLoader(app.second, true /* use_sandbox */)), |
| 243 app.first); | 239 app.first); |
| 244 } | 240 } |
| 245 | 241 |
| 246 ContentBrowserClient::OutOfProcessMojoApplicationMap unsandboxed_apps; | 242 ContentBrowserClient::OutOfProcessMojoApplicationMap unsandboxed_apps; |
| 247 GetContentClient() | 243 GetContentClient() |
| 248 ->browser() | 244 ->browser() |
| 249 ->RegisterUnsandboxedOutOfProcessMojoApplications(&unsandboxed_apps); | 245 ->RegisterUnsandboxedOutOfProcessMojoApplications(&unsandboxed_apps); |
| 250 for (const auto& app : unsandboxed_apps) { | 246 for (const auto& app : unsandboxed_apps) { |
| 251 application_manager_->SetLoaderForURL( | 247 application_manager_->SetLoaderForName( |
| 252 scoped_ptr<mojo::shell::ApplicationLoader>( | 248 scoped_ptr<mojo::shell::ApplicationLoader>( |
| 253 new UtilityProcessLoader(app.second, false /* use_sandbox */)), | 249 new UtilityProcessLoader(app.second, false /* use_sandbox */)), |
| 254 app.first); | 250 app.first); |
| 255 } | 251 } |
| 256 | 252 |
| 257 #if (ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) | 253 #if (ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) |
| 258 application_manager_->SetLoaderForURL( | 254 application_manager_->SetLoaderForName( |
| 259 scoped_ptr<mojo::shell::ApplicationLoader>(new GpuProcessLoader()), | 255 scoped_ptr<mojo::shell::ApplicationLoader>(new GpuProcessLoader()), |
| 260 GURL("mojo:media")); | 256 "mojo:media"); |
| 261 #endif | 257 #endif |
| 262 | 258 |
| 263 if (!IsRunningInMojoShell()) { | 259 if (!IsRunningInMojoShell()) { |
| 264 MojoShellConnectionImpl::Create( | 260 MojoShellConnectionImpl::Create( |
| 265 application_manager_->InitInstanceForEmbedder(GURL(kBrowserAppUrl))); | 261 application_manager_->InitInstanceForEmbedder(GURL(kBrowserAppUrl))); |
| 266 } | 262 } |
| 267 } | 263 } |
| 268 | 264 |
| 269 MojoShellContext::~MojoShellContext() { | 265 MojoShellContext::~MojoShellContext() { |
| 270 if (!IsRunningInMojoShell()) | 266 if (!IsRunningInMojoShell()) |
| 271 MojoShellConnectionImpl::Destroy(); | 267 MojoShellConnectionImpl::Destroy(); |
| 272 } | 268 } |
| 273 | 269 |
| 274 // static | 270 // static |
| 275 void MojoShellContext::ConnectToApplication( | 271 void MojoShellContext::ConnectToApplication( |
| 276 const GURL& url, | 272 const std::string& name, |
| 277 const GURL& requestor_url, | 273 const std::string& requestor_name, |
| 278 mojo::shell::mojom::InterfaceProviderRequest request, | 274 mojo::shell::mojom::InterfaceProviderRequest request, |
| 279 mojo::shell::mojom::InterfaceProviderPtr exposed_services, | 275 mojo::shell::mojom::InterfaceProviderPtr exposed_services, |
| 280 const mojo::shell::mojom::Connector::ConnectCallback& callback) { | 276 const mojo::shell::mojom::Connector::ConnectCallback& callback) { |
| 281 proxy_.Get()->ConnectToApplication(url, requestor_url, std::move(request), | 277 proxy_.Get()->ConnectToApplication(name, requestor_name, std::move(request), |
| 282 std::move(exposed_services), callback); | 278 std::move(exposed_services), callback); |
| 283 } | 279 } |
| 284 | 280 |
| 285 void MojoShellContext::ConnectToApplicationOnOwnThread( | 281 void MojoShellContext::ConnectToApplicationOnOwnThread( |
| 286 const GURL& url, | 282 const std::string& name, |
| 287 const GURL& requestor_url, | 283 const std::string& requestor_name, |
| 288 mojo::shell::mojom::InterfaceProviderRequest request, | 284 mojo::shell::mojom::InterfaceProviderRequest request, |
| 289 mojo::shell::mojom::InterfaceProviderPtr exposed_services, | 285 mojo::shell::mojom::InterfaceProviderPtr exposed_services, |
| 290 const mojo::shell::mojom::Connector::ConnectCallback& callback) { | 286 const mojo::shell::mojom::Connector::ConnectCallback& callback) { |
| 291 scoped_ptr<mojo::shell::ConnectParams> params(new mojo::shell::ConnectParams); | 287 scoped_ptr<mojo::shell::ConnectParams> params(new mojo::shell::ConnectParams); |
| 292 // TODO(beng): kUserRoot is obviously wrong. | 288 // TODO(beng): kUserRoot is obviously wrong. |
| 293 // TODO(beng): We need to set a permissive filter here temporarily because | 289 // TODO(beng): We need to set a permissive filter here temporarily because |
| 294 // content is known as a bogus system: URL that the application | 290 // content is known as a bogus system: name that the application |
| 295 // manager doesn't understand. | 291 // manager doesn't understand. |
| 296 mojo::shell::Identity source_id( | 292 mojo::shell::Identity source_id( |
| 297 requestor_url, std::string(), mojo::shell::mojom::Connector::kUserRoot); | 293 requestor_name, std::string(), mojo::shell::mojom::Connector::kUserRoot); |
| 298 source_id.SetFilter(mojo::shell::GetPermissiveCapabilityFilter()); | 294 source_id.set_filter(mojo::shell::GetPermissiveCapabilityFilter()); |
| 299 params->set_source(source_id); | 295 params->set_source(source_id); |
| 300 params->set_target(mojo::shell::Identity( | 296 params->set_target(mojo::shell::Identity( |
| 301 url, std::string(), mojo::shell::mojom::Connector::kUserRoot)); | 297 name, std::string(), mojo::shell::mojom::Connector::kUserRoot)); |
| 302 params->set_remote_interfaces(std::move(request)); | 298 params->set_remote_interfaces(std::move(request)); |
| 303 params->set_local_interfaces(std::move(exposed_services)); | 299 params->set_local_interfaces(std::move(exposed_services)); |
| 304 params->set_connect_callback(callback); | 300 params->set_connect_callback(callback); |
| 305 application_manager_->Connect(std::move(params)); | 301 application_manager_->Connect(std::move(params)); |
| 306 } | 302 } |
| 307 | 303 |
| 308 } // namespace content | 304 } // namespace content |
| OLD | NEW |