From 8526ab53583e2cc6390fb4693132b151d2481ea1 Mon Sep 17 00:00:00 2001 From: sky Date: Wed, 23 Mar 2016 15:31:15 -0700 Subject: Changes lifetime of apps with the "all_users" capability This changes makes it so "all_users" apps are owned by the shell. BUG=597385 TEST=none R=ben@chromium.org Review URL: https://codereview.chromium.org/1831623002 Cr-Commit-Position: refs/heads/master@{#382951} --- mojo/shell/shell.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mojo/shell/shell.cc b/mojo/shell/shell.cc index c480e91..63ee453 100644 --- a/mojo/shell/shell.cc +++ b/mojo/shell/shell.cc @@ -712,14 +712,21 @@ void Shell::OnGotResolvedName(mojom::ShellResolverPtr resolver, // Clients that request "all_users" class from the shell are allowed to // field connection requests from any user. They also run with a synthetic // user id generated here. The user id provided via Connect() is ignored. + // Additionally apps with the "all_users" class are not tied to the lifetime + // of the app that connected to them, instead they are owned by the shell. + Identity source_identity_for_creation; if (HasClass(capabilities, kCapabilityClass_AllUsers)) { singletons_.insert(target.name()); target.set_user_id(base::GenerateGUID()); + source_identity_for_creation = CreateShellIdentity(); + } else { + source_identity_for_creation = params->source(); } mojom::ClientProcessConnectionPtr client_process_connection = params->TakeClientProcessConnection(); - Instance* instance = CreateInstance(params->source(), target, capabilities); + Instance* instance = CreateInstance(source_identity_for_creation, + target, capabilities); // Below are various paths through which a new Instance can be bound to a // ShellClient proxy. -- cgit v1.1