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

Unified Diff: content/browser/mojo/mojo_shell_context.cc

Issue 1828733004: Load application manifests from resources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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: 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);
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698