Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(363)

Unified Diff: services/shell/public/cpp/lib/shell_connection.cc

Issue 2090773003: Add ability to bind a different InterfaceRegistry/InterfaceProvider to an incoming Connection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/shell/public/cpp/lib/shell_client.cc ('k') | services/shell/public/cpp/shell_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/shell/public/cpp/lib/shell_connection.cc
diff --git a/services/shell/public/cpp/lib/shell_connection.cc b/services/shell/public/cpp/lib/shell_connection.cc
index 2f6b15031a93b4d3e6fad196c8c4e6fa04813eb8..53e85917cee34afc0c4505bb72a7c61d05f98218 100644
--- a/services/shell/public/cpp/lib/shell_connection.cc
+++ b/services/shell/public/cpp/lib/shell_connection.cc
@@ -76,10 +76,33 @@ void ShellConnection::AcceptConnection(
mojom::InterfaceProviderPtr remote_interfaces,
mojom::CapabilityRequestPtr allowed_capabilities,
const mojo::String& name) {
- std::unique_ptr<Connection> registry(new internal::ConnectionImpl(
- name, source.To<Identity>(), source_id, std::move(remote_interfaces),
- std::move(local_interfaces), allowed_capabilities.To<CapabilityRequest>(),
- Connection::State::CONNECTED));
+ std::unique_ptr<internal::ConnectionImpl> registry(
+ new internal::ConnectionImpl(name, source.To<Identity>(), source_id,
+ allowed_capabilities.To<CapabilityRequest>(),
+ Connection::State::CONNECTED));
+
+ InterfaceRegistry* exposed_interfaces =
+ client_->GetInterfaceRegistryForConnection();
+ if (exposed_interfaces) {
+ exposed_interfaces->Bind(std::move(local_interfaces));
+ registry->set_exposed_interfaces(exposed_interfaces);
+ } else {
+ std::unique_ptr<InterfaceRegistry> interfaces(
+ new InterfaceRegistry(registry.get()));
+ interfaces->Bind(std::move(local_interfaces));
+ registry->SetExposedInterfaces(std::move(interfaces));
+ }
+ shell::InterfaceProvider* remote_interface_provider =
+ client_->GetInterfaceProviderForConnection();
+ if (remote_interface_provider) {
+ remote_interface_provider->Bind(std::move(remote_interfaces));
+ registry->set_remote_interfaces(remote_interface_provider);
+ } else {
+ std::unique_ptr<InterfaceProvider> interfaces(new InterfaceProvider);
+ interfaces->Bind(std::move(remote_interfaces));
+ registry->SetRemoteInterfaces(std::move(interfaces));
+ }
+
if (!client_->AcceptConnection(registry.get()))
return;
« no previous file with comments | « services/shell/public/cpp/lib/shell_client.cc ('k') | services/shell/public/cpp/shell_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698