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

Unified Diff: mojo/shell/shell.cc

Issue 1791663002: Allow Catalogs to be constructed per-user (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@49catalog
Patch Set: . Created 4 years, 9 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 | « mojo/shell/shell.h ('k') | mojo/shell/standalone/context.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/shell.cc
diff --git a/mojo/shell/shell.cc b/mojo/shell/shell.cc
index 8056a60651a531117d14f516aeadad70061bb2b5..48370a30c77575f4a8d9cbc318b296862dbbb832 100644
--- a/mojo/shell/shell.cc
+++ b/mojo/shell/shell.cc
@@ -51,6 +51,10 @@ Identity CreateShellIdentity() {
return Identity(kShellName, mojom::kRootUserID);
}
+Identity CreateCatalogIdentity() {
+ return Identity(kCatalogName, mojom::kRootUserID);
+}
+
CapabilitySpec GetPermissiveCapabilities() {
CapabilitySpec capabilities;
CapabilityRequest spec;
@@ -488,16 +492,14 @@ bool Shell::AcceptConnection(Connection* connection) {
// Shell, private:
void Shell::InitCatalog(mojom::ShellClientPtr catalog) {
- Identity identity(kCatalogName, mojom::kRootUserID);
- CreateInstance(identity, CapabilitySpec(), std::move(catalog));
- shell_connection_->connector()->ConnectToInterface(
- kCatalogName, &shell_resolver_);
+ CreateInstance(CreateCatalogIdentity(), CapabilitySpec(), std::move(catalog));
+ // TODO(beng): this doesn't work anymore.
// Seed the catalog with manifest info for the shell & catalog.
- shell_resolver_->ResolveMojoName(
- kCatalogName, base::Bind(&EmptyResolverCallback));
- shell_resolver_->ResolveMojoName(
- kShellName, base::Bind(&EmptyResolverCallback));
+ mojo::shell::mojom::ShellResolverPtr resolver;
+ shell_connection_->connector()->ConnectToInterface(kCatalogName, &resolver);
+ resolver->ResolveMojoName(kCatalogName, base::Bind(&EmptyResolverCallback));
+ resolver->ResolveMojoName(kShellName, base::Bind(&EmptyResolverCallback));
}
void Shell::TerminateShellConnections() {
@@ -533,11 +535,20 @@ void Shell::Connect(scoped_ptr<ConnectParams> params,
if (!client.is_bound() && ConnectToExistingInstance(&params))
return;
+ // The catalog needs to see the source identity as that of the originating
+ // app so it loads the correct store. Since the catalog is itself run as root
+ // when this re-enters Connect() it'll be handled by
+ // ConnectToExistingInstance().
+ mojom::ShellResolverPtr resolver;
+ ConnectToInterface(this, Identity(kShellName, params->target().user_id()),
+ CreateCatalogIdentity(), &resolver);
+
std::string name = params->target().name();
- shell_resolver_->ResolveMojoName(
+ mojom::ShellResolver* resolver_raw = resolver.get();
+ resolver_raw->ResolveMojoName(
name,
- base::Bind(&Shell::OnGotResolvedName,
- weak_ptr_factory_.GetWeakPtr(), base::Passed(&params),
+ base::Bind(&Shell::OnGotResolvedName, weak_ptr_factory_.GetWeakPtr(),
+ base::Passed(std::move(resolver)), base::Passed(&params),
base::Passed(&client)));
}
@@ -632,7 +643,8 @@ void Shell::OnShellClientFactoryLost(const Identity& which) {
shell_client_factories_.erase(it);
}
-void Shell::OnGotResolvedName(scoped_ptr<ConnectParams> params,
+void Shell::OnGotResolvedName(mojom::ShellResolverPtr resolver,
+ scoped_ptr<ConnectParams> params,
mojom::ShellClientPtr client,
const String& resolved_name,
const String& resolved_instance,
« no previous file with comments | « mojo/shell/shell.h ('k') | mojo/shell/standalone/context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698