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

Unified Diff: services/service_manager/public/cpp/lib/service_context.cc

Issue 2446313003: Revise InterfaceRegistry API to support filtering interfaces @ Bind() time. (Closed)
Patch Set: . Created 4 years, 2 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
Index: services/service_manager/public/cpp/lib/service_context.cc
diff --git a/services/service_manager/public/cpp/lib/service_context.cc b/services/service_manager/public/cpp/lib/service_context.cc
index 3b4c4220e457ae87101dd79b591cbca789bd3c60..c015df5c3cdabffff52dceb9975355587244a22f 100644
--- a/services/service_manager/public/cpp/lib/service_context.cc
+++ b/services/service_manager/public/cpp/lib/service_context.cc
@@ -51,7 +51,7 @@ void ServiceContext::SetConnectionLostClosure(const base::Closure& closure) {
void ServiceContext::OnStart(const ServiceInfo& info,
const OnStartCallback& callback) {
- identity_ = info.identity;
+ local_info_ = info;
if (!initialize_handler_.is_null())
initialize_handler_.Run();
@@ -62,13 +62,21 @@ void ServiceContext::OnStart(const ServiceInfo& info,
void ServiceContext::OnConnect(
const ServiceInfo& source_info,
- mojom::InterfaceProviderRequest interfaces,
- const InterfaceSet& allowed_interfaces,
- const CapabilitySet& allowed_capabilities) {
- // TODO(beng): do something with |allowed_capabilities|.
- auto registry = base::MakeUnique<InterfaceRegistry>(
- identity_, source_info.identity, allowed_interfaces);
- registry->Bind(std::move(interfaces));
+ mojom::InterfaceProviderRequest interfaces) {
+ auto target_it = local_info_.interface_provider_specs.find(
+ mojom::kServiceManager_ConnectorSpec);
+ InterfaceProviderSpec target_spec;
+ if (target_it != local_info_.interface_provider_specs.end())
+ target_spec = target_it->second;
+ auto source_it = source_info.interface_provider_specs.find(
+ mojom::kServiceManager_ConnectorSpec);
+ InterfaceProviderSpec source_spec;
+ if (source_it != source_info.interface_provider_specs.end())
+ source_spec = source_it->second;
+
+ auto registry = base::MakeUnique<InterfaceRegistry>(local_info_.identity,
+ target_spec);
+ registry->Bind(std::move(interfaces), source_info.identity, source_spec);
if (!service_->OnConnect(source_info, registry.get()))
return;
« no previous file with comments | « services/service_manager/public/cpp/lib/interface_registry.cc ('k') | services/service_manager/public/cpp/service_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698