0

Make Content Shell's bundle layout mirror Chromium.

This moves the Content Shell Helper from:

  Content Shell.app/Contents/Frameworks/Content Shell Helper.app

To:

  Content Shell.app/Contents/Frameworks/Content Shell Framework.framework/Helpers/Content Shell Helper.app

This will make it easier to support multiple variants of the Helper app
that will be granted different code signing entitlements. While
Content Shell does not get signed, the process launching code lives in
//content, and so Content Shell needs to have a similar layout to Chrome
for launching the helper variants.

Bug: 958976
Change-Id: I5d9cebe38160c9306f0346b94d5d8346577bf5ff
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1612131
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#660127}
This commit is contained in:
Robert Sesek
2019-05-15 21:45:14 +00:00
committed by Commit Bot
parent 2cc2ff1e0d
commit 69bfbc8167
4 changed files with 40 additions and 28 deletions

@ -69,7 +69,8 @@ void ContentBrowserTest::SetUp() {
subprocess_path = subprocess_path.DirName().DirName();
DCHECK_EQ(subprocess_path.BaseName().value(), "Contents");
subprocess_path = subprocess_path.Append(
"Frameworks/Content Shell Helper.app/Contents/MacOS/Content Shell Helper");
"Frameworks/Content Shell Framework.framework/Helpers/Content Shell "
"Helper.app/Contents/MacOS/Content Shell Helper");
command_line->AppendSwitchPath(switches::kBrowserSubprocessPath,
subprocess_path);
#endif

@ -661,19 +661,6 @@ if (is_android) {
}
if (is_mac) {
bundle_data("content_shell_framework_helpers") {
testonly = true
sources = [
"$root_out_dir/chrome_crashpad_handler",
]
outputs = [
"{{bundle_contents_dir}}/Helpers/{{source_file_part}}",
]
public_deps = [
"//components/crash/content/app:chrome_crashpad_handler",
]
}
mac_xib_bundle_data("content_shell_framework_xibs") {
sources = [
"app/English.lproj/HttpAuth.xib",
@ -737,6 +724,21 @@ if (is_mac) {
content_shell_framework_name = "$content_shell_product_name Framework"
content_shell_helper_name = "$content_shell_product_name Helper"
bundle_data("content_shell_framework_helpers") {
testonly = true
sources = [
"$root_out_dir/$content_shell_helper_name.app",
"$root_out_dir/chrome_crashpad_handler",
]
outputs = [
"{{bundle_contents_dir}}/Helpers/{{source_file_part}}",
]
public_deps = [
":content_shell_helper_app",
"//components/crash/content/app:chrome_crashpad_handler",
]
}
tweak_info_plist("content_shell_framework_plist") {
testonly = true
info_plist = "app/framework-Info.plist"
@ -844,14 +846,12 @@ if (is_mac) {
testonly = true
sources = [
"$root_out_dir/$content_shell_framework_name.framework",
"$root_out_dir/$content_shell_helper_name.app",
]
outputs = [
"{{bundle_contents_dir}}/Frameworks/{{source_file_part}}",
]
public_deps = [
":content_shell_framework",
":content_shell_helper_app",
]
}

@ -19,10 +19,20 @@ base::FilePath GetContentsPath() {
// Up to Contents.
if (base::mac::IsBackgroundOnlyProcess()) {
// The running executable is the helper. Go up five steps:
// Contents/Frameworks/Helper.app/Contents/MacOS/Helper
// ^ to here ^ from here
path = path.DirName().DirName().DirName().DirName().DirName();
// The running executable is the helper, located at:
// Content Shell.app/Contents/Frameworks/
// Content Shell Framework.framework/Versions/C/Helpers/Content Shell
// Helper.app/ Contents/MacOS/Content Shell Helper. Go up nine steps to get
// to the main bundle's Contents directory.
path = path.DirName()
.DirName()
.DirName()
.DirName()
.DirName()
.DirName()
.DirName()
.DirName()
.DirName();
} else {
// One step up to MacOS, another to Contents.
path = path.DirName().DirName();
@ -52,11 +62,12 @@ void OverrideOuterBundlePath() {
}
void OverrideChildProcessPath() {
base::FilePath helper_path =
GetFrameworksPath().Append("Content Shell Helper.app")
.Append("Contents")
.Append("MacOS")
.Append("Content Shell Helper");
base::FilePath helper_path = base::mac::FrameworkBundlePath()
.Append("Helpers")
.Append("Content Shell Helper.app")
.Append("Contents")
.Append("MacOS")
.Append("Content Shell Helper");
base::PathService::Override(content::CHILD_PROCESS_EXE, helper_path);
}

@ -52,9 +52,9 @@ int main(int argc, char* argv[]) {
}
}
const char rel_path[] =
"../../../" SHELL_PRODUCT_NAME " Framework.framework/" SHELL_PRODUCT_NAME
" Framework";
// The Helper app is in the versioned framework directory, so just go up to
// the version folder to locate the dylib.
const char rel_path[] = "../../../../" SHELL_PRODUCT_NAME " Framework";
#else
const char rel_path[] =
"../Frameworks/" SHELL_PRODUCT_NAME