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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "content/browser/mojo/mojo_shell_context.h" | 10 #include "content/browser/mojo/mojo_shell_context.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 } | 54 } |
55 | 55 |
56 // TODO(xhwang): Currently no callers are exposing |exposed_services|. So we | 56 // TODO(xhwang): Currently no callers are exposing |exposed_services|. So we |
57 // drop it and replace it with services we provide in the browser. In the | 57 // drop it and replace it with services we provide in the browser. In the |
58 // future we may need to support both. | 58 // future we may need to support both. |
59 void FrameMojoShell::Connect( | 59 void FrameMojoShell::Connect( |
60 const mojo::String& application_url, | 60 const mojo::String& application_url, |
61 uint32_t user_id, | 61 uint32_t user_id, |
62 mojo::shell::mojom::InterfaceProviderRequest services, | 62 mojo::shell::mojom::InterfaceProviderRequest services, |
63 mojo::shell::mojom::InterfaceProviderPtr /* exposed_services */, | 63 mojo::shell::mojom::InterfaceProviderPtr /* exposed_services */, |
64 mojo::shell::mojom::CapabilityFilterPtr filter, | |
65 const mojo::shell::mojom::Connector::ConnectCallback& callback) { | 64 const mojo::shell::mojom::Connector::ConnectCallback& callback) { |
66 // TODO(beng): user_id is dropped on the floor right now. Figure out what to | 65 // TODO(beng): user_id is dropped on the floor right now. Figure out what to |
67 // do with it. | 66 // do with it. |
68 mojo::shell::mojom::InterfaceProviderPtr frame_services; | 67 mojo::shell::mojom::InterfaceProviderPtr frame_services; |
69 service_provider_bindings_.AddBinding(GetServiceRegistry(), | 68 service_provider_bindings_.AddBinding(GetServiceRegistry(), |
70 GetProxy(&frame_services)); | 69 GetProxy(&frame_services)); |
71 | 70 |
72 mojo::shell::CapabilityFilter capability_filter = | |
73 mojo::shell::GetPermissiveCapabilityFilter(); | |
74 if (!filter.is_null()) | |
75 capability_filter = filter->filter.To<mojo::shell::CapabilityFilter>(); | |
76 MojoShellContext::ConnectToApplication( | 71 MojoShellContext::ConnectToApplication( |
77 application_url.To<GURL>(), | 72 application_url.To<GURL>(), |
78 frame_host_->GetSiteInstance()->GetSiteURL(), std::move(services), | 73 frame_host_->GetSiteInstance()->GetSiteURL(), std::move(services), |
79 std::move(frame_services), capability_filter, callback); | 74 std::move(frame_services), callback); |
80 } | 75 } |
81 | 76 |
82 void FrameMojoShell::Clone(mojo::shell::mojom::ConnectorRequest request) { | 77 void FrameMojoShell::Clone(mojo::shell::mojom::ConnectorRequest request) { |
83 connectors_.AddBinding(this, std::move(request)); | 78 connectors_.AddBinding(this, std::move(request)); |
84 } | 79 } |
85 | 80 |
86 ServiceRegistryImpl* FrameMojoShell::GetServiceRegistry() { | 81 ServiceRegistryImpl* FrameMojoShell::GetServiceRegistry() { |
87 if (!service_registry_) { | 82 if (!service_registry_) { |
88 service_registry_.reset(new ServiceRegistryImpl()); | 83 service_registry_.reset(new ServiceRegistryImpl()); |
89 | 84 |
90 // TODO(rockot/xhwang): Currently all applications connected share the same | 85 // TODO(rockot/xhwang): Currently all applications connected share the same |
91 // set of services registered in the |registry|. We may want to provide | 86 // set of services registered in the |registry|. We may want to provide |
92 // different services for different apps for better isolation. | 87 // different services for different apps for better isolation. |
93 RegisterFrameMojoShellServices(service_registry_.get(), frame_host_); | 88 RegisterFrameMojoShellServices(service_registry_.get(), frame_host_); |
94 GetContentClient()->browser()->RegisterFrameMojoShellServices( | 89 GetContentClient()->browser()->RegisterFrameMojoShellServices( |
95 service_registry_.get(), frame_host_); | 90 service_registry_.get(), frame_host_); |
96 } | 91 } |
97 | 92 |
98 return service_registry_.get(); | 93 return service_registry_.get(); |
99 } | 94 } |
100 | 95 |
101 } // namespace content | 96 } // namespace content |
OLD | NEW |