summaryrefslogtreecommitdiffstats
path: root/mojo/shell/shell.cc
diff options
context:
space:
mode:
authorben <ben@chromium.org>2016-03-08 09:48:00 -0800
committerCommit bot <commit-bot@chromium.org>2016-03-08 17:50:03 +0000
commit66696d139202c1e760c6e004c36c96394b0f00e2 (patch)
tree0fd51697e151572cd17b1653dbb39cb51c114f60 /mojo/shell/shell.cc
parente7f273b439ec3c4921aa1378ba36344b5b06aff9 (diff)
downloadchromium_src-66696d139202c1e760c6e004c36c96394b0f00e2.zip
chromium_src-66696d139202c1e760c6e004c36c96394b0f00e2.tar.gz
chromium_src-66696d139202c1e760c6e004c36c96394b0f00e2.tar.bz2
Eliminate CapabilityFilter parameter from CreateInstance, instead reading it from the associated manifest.
BUG= Review URL: https://codereview.chromium.org/1775813002 Cr-Commit-Position: refs/heads/master@{#379853}
Diffstat (limited to 'mojo/shell/shell.cc')
-rw-r--r--mojo/shell/shell.cc31
1 files changed, 24 insertions, 7 deletions
diff --git a/mojo/shell/shell.cc b/mojo/shell/shell.cc
index 277379f..087c0be 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;