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/frame_host/frame_mojo_shell.h" | 5 #include "content/browser/frame_host/frame_mojo_shell.h" |
6 | 6 |
7 #include "content/browser/mojo/mojo_shell_context.h" | 7 #include "content/browser/mojo/mojo_shell_context.h" |
8 #include "content/common/mojo/service_registry_impl.h" | 8 #include "content/common/mojo/service_registry_impl.h" |
9 #include "content/public/browser/content_browser_client.h" | 9 #include "content/public/browser/content_browser_client.h" |
10 #include "content/public/browser/render_frame_host.h" | 10 #include "content/public/browser/render_frame_host.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 bindings_.AddBinding(this, shell_request.Pass()); | 25 bindings_.AddBinding(this, shell_request.Pass()); |
26 } | 26 } |
27 | 27 |
28 // TODO(xhwang): Currently no callers are exposing |exposed_services|. So we | 28 // TODO(xhwang): Currently no callers are exposing |exposed_services|. So we |
29 // drop it and replace it with services we provide in the browser. In the | 29 // drop it and replace it with services we provide in the browser. In the |
30 // future we may need to support both. | 30 // future we may need to support both. |
31 void FrameMojoShell::ConnectToApplication( | 31 void FrameMojoShell::ConnectToApplication( |
32 mojo::URLRequestPtr application_url, | 32 mojo::URLRequestPtr application_url, |
33 mojo::InterfaceRequest<mojo::ServiceProvider> services, | 33 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
34 mojo::ServiceProviderPtr /* exposed_services */, | 34 mojo::ServiceProviderPtr /* exposed_services */, |
35 mojo::CapabilityFilterPtr filter) { | 35 mojo::CapabilityFilterPtr filter, |
| 36 const ConnectToApplicationCallback& callback) { |
36 mojo::ServiceProviderPtr frame_services; | 37 mojo::ServiceProviderPtr frame_services; |
37 service_provider_bindings_.AddBinding(GetServiceRegistry(), | 38 service_provider_bindings_.AddBinding(GetServiceRegistry(), |
38 GetProxy(&frame_services)); | 39 GetProxy(&frame_services)); |
39 | 40 |
40 mojo::shell::CapabilityFilter capability_filter = | 41 mojo::shell::CapabilityFilter capability_filter = |
41 mojo::shell::GetPermissiveCapabilityFilter(); | 42 mojo::shell::GetPermissiveCapabilityFilter(); |
42 if (!filter.is_null()) | 43 if (!filter.is_null()) |
43 capability_filter = filter->filter.To<mojo::shell::CapabilityFilter>(); | 44 capability_filter = filter->filter.To<mojo::shell::CapabilityFilter>(); |
44 MojoShellContext::ConnectToApplication( | 45 MojoShellContext::ConnectToApplication( |
45 GURL(application_url->url), frame_host_->GetSiteInstance()->GetSiteURL(), | 46 GURL(application_url->url), frame_host_->GetSiteInstance()->GetSiteURL(), |
46 services.Pass(), frame_services.Pass(), capability_filter); | 47 services.Pass(), frame_services.Pass(), capability_filter, callback); |
47 } | 48 } |
48 | 49 |
49 void FrameMojoShell::QuitApplication() { | 50 void FrameMojoShell::QuitApplication() { |
50 } | 51 } |
51 | 52 |
52 ServiceRegistryImpl* FrameMojoShell::GetServiceRegistry() { | 53 ServiceRegistryImpl* FrameMojoShell::GetServiceRegistry() { |
53 if (!service_registry_) { | 54 if (!service_registry_) { |
54 service_registry_.reset(new ServiceRegistryImpl()); | 55 service_registry_.reset(new ServiceRegistryImpl()); |
55 | 56 |
56 GetContentClient()->browser()->RegisterFrameMojoShellServices( | 57 GetContentClient()->browser()->RegisterFrameMojoShellServices( |
57 service_registry_.get(), frame_host_); | 58 service_registry_.get(), frame_host_); |
58 } | 59 } |
59 | 60 |
60 return service_registry_.get(); | 61 return service_registry_.get(); |
61 } | 62 } |
62 | 63 |
63 } // namespace content | 64 } // namespace content |
OLD | NEW |