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 30 matching lines...) Expand all Loading... |
41 } | 41 } |
42 | 42 |
43 void FrameMojoShell::BindRequest(mojo::shell::mojom::ConnectorRequest request) { | 43 void FrameMojoShell::BindRequest(mojo::shell::mojom::ConnectorRequest request) { |
44 connectors_.AddBinding(this, std::move(request)); | 44 connectors_.AddBinding(this, std::move(request)); |
45 } | 45 } |
46 | 46 |
47 // TODO(xhwang): Currently no callers are exposing |exposed_services|. So we | 47 // TODO(xhwang): Currently no callers are exposing |exposed_services|. So we |
48 // drop it and replace it with services we provide in the browser. In the | 48 // drop it and replace it with services we provide in the browser. In the |
49 // future we may need to support both. | 49 // future we may need to support both. |
50 void FrameMojoShell::Connect( | 50 void FrameMojoShell::Connect( |
51 const mojo::String& application_name, | 51 mojo::shell::mojom::IdentityPtr target, |
52 const mojo::String& user_id, | |
53 mojo::shell::mojom::InterfaceProviderRequest services, | 52 mojo::shell::mojom::InterfaceProviderRequest services, |
54 mojo::shell::mojom::InterfaceProviderPtr /* exposed_services */, | 53 mojo::shell::mojom::InterfaceProviderPtr /* exposed_services */, |
55 const mojo::shell::mojom::Connector::ConnectCallback& callback) { | 54 const mojo::shell::mojom::Connector::ConnectCallback& callback) { |
56 // TODO(beng): user_id is dropped on the floor right now. Figure out what to | 55 // TODO(beng): user_id is dropped on the floor right now. Figure out what to |
57 // do with it. | 56 // do with it. |
58 mojo::shell::mojom::InterfaceProviderPtr frame_services; | 57 mojo::shell::mojom::InterfaceProviderPtr frame_services; |
59 service_provider_bindings_.AddBinding(GetServiceRegistry(), | 58 service_provider_bindings_.AddBinding(GetServiceRegistry(), |
60 GetProxy(&frame_services)); | 59 GetProxy(&frame_services)); |
61 | 60 |
62 MojoShellContext::ConnectToApplication( | 61 MojoShellContext::ConnectToApplication( |
63 application_name, | 62 target->name, |
64 frame_host_->GetSiteInstance()->GetSiteURL().spec(), std::move(services), | 63 frame_host_->GetSiteInstance()->GetSiteURL().spec(), std::move(services), |
65 std::move(frame_services), callback); | 64 std::move(frame_services), callback); |
66 } | 65 } |
67 | 66 |
68 void FrameMojoShell::Clone(mojo::shell::mojom::ConnectorRequest request) { | 67 void FrameMojoShell::Clone(mojo::shell::mojom::ConnectorRequest request) { |
69 connectors_.AddBinding(this, std::move(request)); | 68 connectors_.AddBinding(this, std::move(request)); |
70 } | 69 } |
71 | 70 |
72 ServiceRegistryImpl* FrameMojoShell::GetServiceRegistry() { | 71 ServiceRegistryImpl* FrameMojoShell::GetServiceRegistry() { |
73 if (!service_registry_) { | 72 if (!service_registry_) { |
74 service_registry_.reset(new ServiceRegistryImpl()); | 73 service_registry_.reset(new ServiceRegistryImpl()); |
75 | 74 |
76 // TODO(rockot/xhwang): Currently all applications connected share the same | 75 // TODO(rockot/xhwang): Currently all applications connected share the same |
77 // set of services registered in the |registry|. We may want to provide | 76 // set of services registered in the |registry|. We may want to provide |
78 // different services for different apps for better isolation. | 77 // different services for different apps for better isolation. |
79 RegisterFrameMojoShellServices(service_registry_.get(), frame_host_); | 78 RegisterFrameMojoShellServices(service_registry_.get(), frame_host_); |
80 GetContentClient()->browser()->RegisterFrameMojoShellServices( | 79 GetContentClient()->browser()->RegisterFrameMojoShellServices( |
81 service_registry_.get(), frame_host_); | 80 service_registry_.get(), frame_host_); |
82 } | 81 } |
83 | 82 |
84 return service_registry_.get(); | 83 return service_registry_.get(); |
85 } | 84 } |
86 | 85 |
87 } // namespace content | 86 } // namespace content |
OLD | NEW |