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

Unified Diff: mojo/shell/shell.cc

Issue 1775813002: Eliminate CapabilityFilter parameter from CreateInstance, instead reading it from the associated ma… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@41qual
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
Index: mojo/shell/shell.cc
diff --git a/mojo/shell/shell.cc b/mojo/shell/shell.cc
index 277379fc6da672aa740514dcc51bd187c68b2e4a..087c0be1a02207e2577cc99b5d7126528b40752e 100644
--- a/mojo/shell/shell.cc
+++ b/mojo/shell/shell.cc
@@ -213,9 +213,31 @@ class Shell::Instance : public mojom::Connector,
// mojom::Shell implementation:
void CreateInstance(mojom::ShellClientFactoryPtr factory,
mojom::IdentityPtr target,
- mojom::CapabilityFilterPtr filter,
mojom::PIDReceiverRequest pid_receiver,
const CreateInstanceCallback& callback) override {
+ // We need to bounce through the package manager to load the
+ // CapabilityFilter.
+ std::string name = target->name;
+ shell_->shell_resolver_->ResolveMojoName(name, base::Bind(
+ &mojo::shell::Shell::Instance::OnResolvedNameForCreateInstance,
+ weak_factory_.GetWeakPtr(), base::Passed(std::move(factory)),
+ base::Passed(std::move(target)), base::Passed(std::move(pid_receiver)),
+ callback));
+ }
+ void AddInstanceListener(mojom::InstanceListenerPtr listener) override {
+ // TODO(beng): this should only track the instances matching this user, and
+ // root.
+ shell_->AddInstanceListener(std::move(listener));
+ }
+
+ void OnResolvedNameForCreateInstance(mojom::ShellClientFactoryPtr factory,
+ mojom::IdentityPtr target,
+ mojom::PIDReceiverRequest pid_receiver,
+ const CreateInstanceCallback& callback,
+ const String& resolved_name,
+ const String& resolved_instance,
+ mojom::CapabilityFilterPtr filter,
+ const String& file_url) {
if (!base::IsValidGUID(target->user_id))
callback.Run(mojom::ConnectResult::INVALID_ARGUMENT);
@@ -228,7 +250,7 @@ class Shell::Instance : public mojom::Connector,
mojom::ShellClientRequest request;
Instance* instance = shell_->CreateInstance(
- target_id, filter->filter.To<CapabilityFilter>(), &request);
+ target_id, filter->filter.To<CapabilityFilter>(), &request);
instance->pid_receiver_binding_.Bind(std::move(pid_receiver));
instance->factory_ = std::move(factory);
instance->factory_->CreateShellClient(std::move(request), target->name);
@@ -238,11 +260,6 @@ class Shell::Instance : public mojom::Connector,
// created instance is identified by |name| and may be subsequently reached
// by client code using this identity.
}
- void AddInstanceListener(mojom::InstanceListenerPtr listener) override {
- // TODO(beng): this should only track the instances matching this user, and
- // root.
- shell_->AddInstanceListener(std::move(listener));
- }
uint32_t GenerateUniqueID() const {
static uint32_t id = mojom::kInvalidInstanceID;

Powered by Google App Engine
This is Rietveld 408576698