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