| Index: content/browser/mojo/mojo_shell_context.cc
|
| diff --git a/content/browser/mojo/mojo_shell_context.cc b/content/browser/mojo/mojo_shell_context.cc
|
| index 6308b682c2a129d6998f686643575304a3936711..9ba895de0dac4b542df5c09992ed878aeafa7f1b 100644
|
| --- a/content/browser/mojo/mojo_shell_context.cc
|
| +++ b/content/browser/mojo/mojo_shell_context.cc
|
| @@ -43,8 +43,6 @@ namespace content {
|
|
|
| namespace {
|
|
|
| -const char kBrowserAppName[] = "exe:chrome";
|
| -
|
| // An extra set of apps to register on initialization, if set by a test.
|
| const MojoShellContext::StaticApplicationMap* g_applications_for_test;
|
|
|
| @@ -157,6 +155,24 @@ class GpuProcessLoader : public mojo::shell::Loader {
|
|
|
| } // namespace
|
|
|
| +// A Catalog::Delegate which resolves application names to builtin manifest
|
| +// resources for the catalog service to consume.
|
| +class MojoShellContext::ManifestResolver : public catalog::Catalog::Delegate {
|
| + public:
|
| + ManifestResolver() {}
|
| + ~ManifestResolver() override {}
|
| +
|
| + private:
|
| + // catalog::Catalog::Delegate:
|
| + bool GetApplicationManifest(const base::StringPiece& name,
|
| + std::string* manifest_contents) override {
|
| + return GetContentClient()->browser()->GetMojoApplicationManifest(
|
| + name, manifest_contents);
|
| + }
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(ManifestResolver);
|
| +};
|
| +
|
| // Thread-safe proxy providing access to the shell context from any thread.
|
| class MojoShellContext::Proxy {
|
| public:
|
| @@ -217,7 +233,9 @@ MojoShellContext::MojoShellContext(
|
| scoped_ptr<mojo::shell::NativeRunnerFactory> native_runner_factory(
|
| new mojo::shell::InProcessNativeRunnerFactory(
|
| BrowserThread::GetBlockingPool()));
|
| - catalog_.reset(new catalog::Factory(file_task_runner.get(), nullptr));
|
| + builtin_resolver_.reset(new ManifestResolver);
|
| + catalog_.reset(new catalog::Factory(file_task_runner.get(), nullptr,
|
| + builtin_resolver_.get()));
|
| shell_.reset(new mojo::shell::Shell(std::move(native_runner_factory),
|
| catalog_->TakeShellClient()));
|
|
|
| @@ -274,8 +292,12 @@ MojoShellContext::MojoShellContext(
|
|
|
| if (!IsRunningInMojoShell()) {
|
| const bool is_external = false;
|
| - MojoShellConnection::Create(
|
| - shell_->InitInstanceForEmbedder(kBrowserAppName), is_external);
|
| + std::string app_name =
|
| + GetContentClient()->browser()->GetPackagedMojoApplicationName();
|
| + if (!app_name.empty()) {
|
| + MojoShellConnection::Create(
|
| + shell_->InitInstanceForEmbedder(app_name), is_external);
|
| + }
|
| }
|
| }
|
|
|
|
|