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 "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
11 #include "content/common/process_control.mojom.h" | 11 #include "content/common/process_control.mojom.h" |
12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
13 #include "content/public/browser/content_browser_client.h" | 13 #include "content/public/browser/content_browser_client.h" |
14 #include "content/public/browser/utility_process_host.h" | 14 #include "content/public/browser/utility_process_host.h" |
15 #include "content/public/browser/utility_process_host_client.h" | 15 #include "content/public/browser/utility_process_host_client.h" |
16 #include "content/public/common/content_client.h" | 16 #include "content/public/common/content_client.h" |
17 #include "content/public/common/service_registry.h" | 17 #include "content/public/common/service_registry.h" |
18 #include "mojo/application/public/cpp/application_delegate.h" | 18 #include "mojo/application/public/cpp/application_delegate.h" |
19 #include "mojo/common/url_type_converters.h" | 19 #include "mojo/common/url_type_converters.h" |
20 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" | |
21 #include "mojo/shell/application_loader.h" | 20 #include "mojo/shell/application_loader.h" |
| 21 #include "mojo/shell/connect_to_application_params.h" |
| 22 #include "mojo/shell/identity.h" |
22 #include "mojo/shell/static_application_loader.h" | 23 #include "mojo/shell/static_application_loader.h" |
23 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h" | 24 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h" |
24 #include "third_party/mojo/src/mojo/public/cpp/bindings/string.h" | 25 #include "third_party/mojo/src/mojo/public/cpp/bindings/string.h" |
25 | 26 |
26 #if defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) | 27 #if defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) |
27 #include "media/mojo/services/mojo_media_application.h" | 28 #include "media/mojo/services/mojo_media_application.h" |
28 #endif | 29 #endif |
29 | 30 |
30 namespace content { | 31 namespace content { |
31 | 32 |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 exposed_services.Pass(), filter, callback); | 220 exposed_services.Pass(), filter, callback); |
220 } | 221 } |
221 | 222 |
222 void MojoShellContext::ConnectToApplicationOnOwnThread( | 223 void MojoShellContext::ConnectToApplicationOnOwnThread( |
223 const GURL& url, | 224 const GURL& url, |
224 const GURL& requestor_url, | 225 const GURL& requestor_url, |
225 mojo::InterfaceRequest<mojo::ServiceProvider> request, | 226 mojo::InterfaceRequest<mojo::ServiceProvider> request, |
226 mojo::ServiceProviderPtr exposed_services, | 227 mojo::ServiceProviderPtr exposed_services, |
227 const mojo::shell::CapabilityFilter& filter, | 228 const mojo::shell::CapabilityFilter& filter, |
228 const mojo::Shell::ConnectToApplicationCallback& callback) { | 229 const mojo::Shell::ConnectToApplicationCallback& callback) { |
229 mojo::URLRequestPtr url_request = mojo::URLRequest::New(); | 230 scoped_ptr<mojo::shell::ConnectToApplicationParams> params( |
230 url_request->url = mojo::String::From(url); | 231 new mojo::shell::ConnectToApplicationParams); |
231 application_manager_->ConnectToApplication( | 232 params->set_originator_identity(mojo::shell::Identity(requestor_url)); |
232 nullptr, url_request.Pass(), std::string(), requestor_url, request.Pass(), | 233 params->set_originator_filter(mojo::shell::GetPermissiveCapabilityFilter()); |
233 exposed_services.Pass(), filter, base::Bind(&base::DoNothing), callback); | 234 params->SetURLInfo(url); |
| 235 params->set_services(request.Pass()); |
| 236 params->set_exposed_services(exposed_services.Pass()); |
| 237 params->set_filter(filter); |
| 238 params->set_on_application_end(base::Bind(&base::DoNothing)); |
| 239 params->set_connect_callback(callback); |
| 240 application_manager_->ConnectToApplication(params.Pass()); |
234 } | 241 } |
235 | 242 |
236 GURL MojoShellContext::ResolveMappings(const GURL& url) { | 243 GURL MojoShellContext::ResolveMappings(const GURL& url) { |
237 return url; | 244 return url; |
238 } | 245 } |
239 | 246 |
240 GURL MojoShellContext::ResolveMojoURL(const GURL& url) { | 247 GURL MojoShellContext::ResolveMojoURL(const GURL& url) { |
241 return url; | 248 return url; |
242 } | 249 } |
243 | 250 |
244 bool MojoShellContext::CreateFetcher( | 251 bool MojoShellContext::CreateFetcher( |
245 const GURL& url, | 252 const GURL& url, |
246 const mojo::shell::Fetcher::FetchCallback& loader_callback) { | 253 const mojo::shell::Fetcher::FetchCallback& loader_callback) { |
247 return false; | 254 return false; |
248 } | 255 } |
249 | 256 |
250 } // namespace content | 257 } // namespace content |
OLD | NEW |