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

Unified Diff: services/shell/shell.cc

Issue 1910043002: Provide capability classes from Mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 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/shell/shell.cc
diff --git a/services/shell/shell.cc b/services/shell/shell.cc
index dd91518e8387d903b42cea091c3df59ed144eda9..36973578842002fca12eaa808db1aed04a6bafba 100644
--- a/services/shell/shell.cc
+++ b/services/shell/shell.cc
@@ -34,10 +34,11 @@ namespace {
const char kCatalogName[] = "mojo:catalog";
const char kShellName[] = "mojo:shell";
-const char kCapabilityClass_UserID[] = "user_id";
-const char kCapabilityClass_ClientProcess[] = "client_process";
-const char kCapabilityClass_InstanceName[] = "instance_name";
-const char kCapabilityClass_AllUsers[] = "all_users";
+const char kCapabilityClass_UserID[] = "shell:user_id";
+const char kCapabilityClass_ClientProcess[] = "shell:client_process";
+const char kCapabilityClass_InstanceName[] = "shell:instance_name";
+const char kCapabilityClass_AllUsers[] = "shell:all_users";
+const char kCapabilityClass_ExplicitClass[] = "shell:explicit_class";
void EmptyResolverCallback(mojom::ResolveResultPtr result) {}
@@ -150,18 +151,27 @@ class Shell::Instance : public mojom::Connector,
params->connect_callback().Run(mojom::ConnectResult::SUCCEEDED,
identity_.user_id(), id_);
uint32_t source_id = mojom::kInvalidInstanceID;
- CapabilityRequest spec;
- spec.interfaces.insert("*");
+ CapabilityRequest request;
+ request.interfaces.insert("*");
Instance* source = shell_->GetExistingInstance(params->source());
if (source) {
- spec = GenerateCapabilityRequestForConnection(
+ request = GenerateCapabilityRequestForConnection(
source->capability_spec_, identity_, capability_spec_);
source_id = source->id();
}
+
+ // The target has specified that sources must request one of its provided
+ // classes instead of specifying a wild-card for interfaces or interfaces
+ // directly.
+ if (HasClass(capability_spec_, kCapabilityClass_ExplicitClass) &&
+ (request.classes.empty() || request.interfaces.count("*") != 0)) {
+ request.interfaces = Interfaces();
+ }
+
shell_client_->AcceptConnection(
mojom::Identity::From(params->source()), source_id,
params->TakeRemoteInterfaces(), params->TakeLocalInterfaces(),
- mojom::CapabilityRequest::From(spec), params->target().name());
+ mojom::CapabilityRequest::From(request), params->target().name());
}
void StartWithClient(mojom::ShellClientPtr client) {
« no previous file with comments | « services/shell/public/cpp/lib/interface_registry.cc ('k') | services/shell/tests/connect/connect_test_app_a_manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698