Commit 4be2698e authored by Robert Sesek's avatar Robert Sesek Committed by Commit Bot

Create more Mac Helper application bundles.

In order to enable the hardened runtime, which restricts things such as
writable-executable memory and loading code signed by a different Team
ID, special code signing entitlements must be granted to the Helper.
To keep the capabilities scoped to the process types that require them,
this CL adds two new variants of the Helper app: one for renderers
and one for plugins.

Currently all three Helpers will be code signed in the same way without
any entitlements, but this will change in the future.

Tbr: dschuff@chromium.org
Bug: 850193
Change-Id: I596f5290650e0bfb034d19a1490afe20e1cb1e58
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1627456
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Reviewed-by: default avatarMark Mentovai <mark@chromium.org>
Reviewed-by: default avatarCaleb Rouleau <crouleau@chromium.org>
Cr-Commit-Position: refs/heads/master@{#669719}
parent 86d4ebc8
...@@ -40,6 +40,7 @@ if (is_android) { ...@@ -40,6 +40,7 @@ if (is_android) {
import("//build/mac/tweak_info_plist.gni") import("//build/mac/tweak_info_plist.gni")
import("//build/util/branding.gni") import("//build/util/branding.gni")
import("//build/util/version.gni") import("//build/util/version.gni")
import("//content/public/app/mac_helpers.gni")
import("//media/cdm/library_cdm/cdm_paths.gni") import("//media/cdm/library_cdm/cdm_paths.gni")
import("//third_party/icu/config.gni") import("//third_party/icu/config.gni")
} }
...@@ -879,53 +880,68 @@ if (is_win) { ...@@ -879,53 +880,68 @@ if (is_win) {
visibility = [ "//chrome/installer/mac:copies" ] visibility = [ "//chrome/installer/mac:copies" ]
} }
mac_app_bundle("chrome_helper_app") { template("chrome_helper_app") {
output_name = chrome_helper_name mac_app_bundle(target_name) {
assert(defined(invoker.helper_name_suffix))
assert(defined(invoker.helper_bundle_id_suffix))
info_plist_target = ":chrome_helper_plist" output_name = chrome_helper_name + invoker.helper_name_suffix
extra_substitutions = [
"CHROMIUM_BUNDLE_ID=$chrome_mac_bundle_id",
"CHROMIUM_SHORT_NAME=$chrome_product_short_name",
]
sources = [
"app/chrome_exe_main_mac.cc",
]
extra_configs = [ "//build/config/compiler:wexit_time_destructors" ] info_plist_target = ":chrome_helper_plist"
extra_substitutions = [
"CHROMIUM_BUNDLE_ID=$chrome_mac_bundle_id",
"CHROMIUM_SHORT_NAME=$chrome_product_short_name",
"CHROMIUM_HELPER_SUFFIX=${invoker.helper_name_suffix}",
"CHROMIUM_HELPER_BUNDLE_ID_SUFFIX=${invoker.helper_bundle_id_suffix}",
]
defines = [ "HELPER_EXECUTABLE" ] sources = [
"app/chrome_exe_main_mac.cc",
]
deps = [ extra_configs = [ "//build/config/compiler:wexit_time_destructors" ]
"//chrome/common:buildflags",
"//chrome/common:version_header",
"//sandbox/mac:seatbelt",
]
ldflags = [] defines = [ "HELPER_EXECUTABLE" ]
if (is_component_build) { deps = [
ldflags += [ "//chrome/common:version_header",
# The helper is in Chromium.app/Contents/Frameworks/Chromium Framework.framework/Versions/X/Helpers/Chromium Helper.app/Contents/MacOS "//sandbox/mac:seatbelt",
# so set rpath up to the base.
"-rpath",
"@loader_path/../../../../../../../../../..",
] ]
ldflags = []
if (is_component_build) {
ldflags += [
# The helper is in Chromium.app/Contents/Frameworks/Chromium Framework.framework/Versions/X/Helpers/Chromium Helper.app/Contents/MacOS
# so set rpath up to the base.
"-rpath",
"@loader_path/../../../../../../../../../..",
]
}
if (enable_stripping) {
# At link time, preserve the global symbols specified in the .exports
# file. All other global symbols will be marked as private. The default
# //build/config/mac:strip_all config will then remove the remaining
# local and debug symbols.
ldflags += [ "-Wl,-exported_symbols_list," +
rebase_path("app/app.exports", root_build_dir) ]
}
} }
}
if (enable_stripping) { foreach(helper_params, content_mac_helpers) {
# At link time, preserve the global symbols specified in the .exports _helper_target = helper_params[0]
# file. All other global symbols will be marked as private. The default _helper_bundle_id = helper_params[1]
# //build/config/mac:strip_all config will then remove the remaining _helper_suffix = helper_params[2]
# local and debug symbols. chrome_helper_app("chrome_helper_app_${_helper_target}") {
ldflags += [ "-Wl,-exported_symbols_list," + helper_name_suffix = _helper_suffix
rebase_path("app/app.exports", root_build_dir) ] helper_bundle_id_suffix = _helper_bundle_id
} }
} }
bundle_data("chrome_framework_helpers") { bundle_data("chrome_framework_helpers") {
sources = [ sources = [
"$root_out_dir/$chrome_helper_name.app",
"$root_out_dir/app_mode_loader", "$root_out_dir/app_mode_loader",
"$root_out_dir/chrome_crashpad_handler", "$root_out_dir/chrome_crashpad_handler",
] ]
...@@ -935,11 +951,16 @@ if (is_win) { ...@@ -935,11 +951,16 @@ if (is_win) {
] ]
public_deps = [ public_deps = [
":chrome_helper_app",
"//chrome/app_shim:app_mode_loader", "//chrome/app_shim:app_mode_loader",
"//components/crash/content/app:chrome_crashpad_handler", "//components/crash/content/app:chrome_crashpad_handler",
] ]
foreach(helper_params, content_mac_helpers) {
sources +=
[ "$root_out_dir/${chrome_helper_name}${helper_params[2]}.app" ]
public_deps += [ ":chrome_helper_app_${helper_params[0]}" ]
}
if (is_asan) { if (is_asan) {
# crashpad_handler requires the ASan runtime at its @executable_path. # crashpad_handler requires the ASan runtime at its @executable_path.
sources += [ "$root_out_dir/libclang_rt.asan_osx_dynamic.dylib" ] sources += [ "$root_out_dir/libclang_rt.asan_osx_dynamic.dylib" ]
...@@ -1359,13 +1380,16 @@ if (is_win) { ...@@ -1359,13 +1380,16 @@ if (is_win) {
_chrome_symbols_sources = [ _chrome_symbols_sources = [
_framework_binary_path, _framework_binary_path,
"$root_out_dir/AlertNotificationService.xpc/Contents/MacOS/AlertNotificationService", "$root_out_dir/AlertNotificationService.xpc/Contents/MacOS/AlertNotificationService",
"$root_out_dir/$chrome_helper_name.app/Contents/MacOS/$chrome_helper_name",
"$root_out_dir/$chrome_product_full_name.app/Contents/MacOS/$chrome_product_full_name", "$root_out_dir/$chrome_product_full_name.app/Contents/MacOS/$chrome_product_full_name",
"$root_out_dir/chrome_crashpad_handler", "$root_out_dir/chrome_crashpad_handler",
"$root_out_dir/libswiftshader_libEGL.dylib", "$root_out_dir/libswiftshader_libEGL.dylib",
"$root_out_dir/libswiftshader_libGLESv2.dylib", "$root_out_dir/libswiftshader_libGLESv2.dylib",
] ]
foreach(helper_params, content_mac_helpers) {
_chrome_symbols_sources += [ "$root_out_dir/${chrome_helper_name}${helper_params[2]}.app/Contents/MacOS/${chrome_helper_name}${helper_params[2]}" ]
}
# It is possible to run dump_syms on unstripped products without dSYMs, # It is possible to run dump_syms on unstripped products without dSYMs,
# but doing so isn't logical and won't happen in practice. # but doing so isn't logical and won't happen in practice.
action_foreach("chrome_dump_syms") { action_foreach("chrome_dump_syms") {
...@@ -1390,13 +1414,16 @@ if (is_win) { ...@@ -1390,13 +1414,16 @@ if (is_win) {
deps = [ deps = [
":chrome_app", ":chrome_app",
":chrome_framework", ":chrome_framework",
":chrome_helper_app",
"//chrome/browser/ui/cocoa/notifications:alert_notification_xpc_service", "//chrome/browser/ui/cocoa/notifications:alert_notification_xpc_service",
"//components/crash/content/app:chrome_crashpad_handler", "//components/crash/content/app:chrome_crashpad_handler",
"//third_party/breakpad:dump_syms", "//third_party/breakpad:dump_syms",
"//third_party/swiftshader/src/OpenGL/libEGL:swiftshader_libEGL", "//third_party/swiftshader/src/OpenGL/libEGL:swiftshader_libEGL",
"//third_party/swiftshader/src/OpenGL/libGLESv2:swiftshader_libGLESv2", "//third_party/swiftshader/src/OpenGL/libGLESv2:swiftshader_libGLESv2",
] ]
foreach(helper_params, content_mac_helpers) {
deps += [ ":chrome_helper_app_${helper_params[0]}" ]
}
} }
action("chrome_dsym_archive") { action("chrome_dsym_archive") {
...@@ -1409,13 +1436,27 @@ if (is_win) { ...@@ -1409,13 +1436,27 @@ if (is_win) {
_dsyms = [ _dsyms = [
"$root_out_dir/AlertNotificationService.dSYM", "$root_out_dir/AlertNotificationService.dSYM",
"$root_out_dir/$chrome_framework_name.dSYM", "$root_out_dir/$chrome_framework_name.dSYM",
"$root_out_dir/$chrome_helper_name.dSYM",
"$root_out_dir/$chrome_product_full_name.dSYM", "$root_out_dir/$chrome_product_full_name.dSYM",
"$root_out_dir/chrome_crashpad_handler.dSYM", "$root_out_dir/chrome_crashpad_handler.dSYM",
"$root_out_dir/libswiftshader_libEGL.dylib.dSYM", "$root_out_dir/libswiftshader_libEGL.dylib.dSYM",
"$root_out_dir/libswiftshader_libGLESv2.dylib.dSYM", "$root_out_dir/libswiftshader_libGLESv2.dylib.dSYM",
] ]
deps = [
":chrome_app",
":chrome_framework",
"//chrome/browser/ui/cocoa/notifications:alert_notification_xpc_service",
"//components/crash/content/app:chrome_crashpad_handler",
"//third_party/swiftshader/src/OpenGL/libEGL:swiftshader_libEGL",
"//third_party/swiftshader/src/OpenGL/libGLESv2:swiftshader_libGLESv2",
]
foreach(helper_params, content_mac_helpers) {
_dsyms +=
[ "$root_out_dir/${chrome_helper_name}${helper_params[2]}.dSYM" ]
deps += [ ":chrome_helper_app_${helper_params[0]}" ]
}
sources = _chrome_symbols_sources sources = _chrome_symbols_sources
_output = "$root_out_dir/$chrome_product_full_name.dSYM.tar.bz2" _output = "$root_out_dir/$chrome_product_full_name.dSYM.tar.bz2"
...@@ -1426,16 +1467,6 @@ if (is_win) { ...@@ -1426,16 +1467,6 @@ if (is_win) {
args = [ rebase_path(_output, root_out_dir) ] + args = [ rebase_path(_output, root_out_dir) ] +
rebase_path(_dsyms, root_out_dir) rebase_path(_dsyms, root_out_dir)
deps = [
":chrome_app",
":chrome_framework",
":chrome_helper_app",
"//chrome/browser/ui/cocoa/notifications:alert_notification_xpc_service",
"//components/crash/content/app:chrome_crashpad_handler",
"//third_party/swiftshader/src/OpenGL/libEGL:swiftshader_libEGL",
"//third_party/swiftshader/src/OpenGL/libGLESv2:swiftshader_libGLESv2",
]
} }
} else { } else {
group("chrome_dump_syms") { group("chrome_dump_syms") {
......
...@@ -9,11 +9,11 @@ ...@@ -9,11 +9,11 @@
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string> <string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
<string>${CHROMIUM_BUNDLE_ID}.helper</string> <string>${CHROMIUM_BUNDLE_ID}.helper${CHROMIUM_HELPER_BUNDLE_ID_SUFFIX}</string>
<key>CFBundleInfoDictionaryVersion</key> <key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string> <string>6.0</string>
<key>CFBundleName</key> <key>CFBundleName</key>
<string>${CHROMIUM_SHORT_NAME} Helper</string> <string>${CHROMIUM_SHORT_NAME} Helper${CHROMIUM_HELPER_SUFFIX}</string>
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
......
...@@ -75,6 +75,20 @@ def get_parts(config): ...@@ -75,6 +75,20 @@ def get_parts(config):
'{}.helper'.format(uncustomized_bundle_id), '{}.helper'.format(uncustomized_bundle_id),
options=CodeSignOptions.RESTRICT, options=CodeSignOptions.RESTRICT,
verify_options=VerifyOptions.DEEP), verify_options=VerifyOptions.DEEP),
'helper-renderer-app':
CodeSignedProduct(
'{0.framework_dir}/Helpers/{0.product} Helper (Renderer).app'
.format(config),
'{}.helper.renderer'.format(uncustomized_bundle_id),
options=CodeSignOptions.RESTRICT,
verify_options=VerifyOptions.DEEP),
'helper-plugin-app':
CodeSignedProduct(
'{0.framework_dir}/Helpers/{0.product} Helper (Plugin).app'
.format(config),
'{}.helper.plugin'.format(uncustomized_bundle_id),
options=CodeSignOptions.RESTRICT,
verify_options=VerifyOptions.DEEP),
'app-mode-app': 'app-mode-app':
CodeSignedProduct( CodeSignedProduct(
'{.framework_dir}/Helpers/app_mode_loader'.format(config), '{.framework_dir}/Helpers/app_mode_loader'.format(config),
......
...@@ -65,6 +65,12 @@ class TestGetParts(unittest.TestCase): ...@@ -65,6 +65,12 @@ class TestGetParts(unittest.TestCase):
self.assertEqual( self.assertEqual(
set(model.CodeSignOptions.RESTRICT), set(model.CodeSignOptions.RESTRICT),
set(parts['helper-app'].options)) set(parts['helper-app'].options))
self.assertEqual(
set(model.CodeSignOptions.RESTRICT),
set(parts['helper-renderer-app'].options))
self.assertEqual(
set(model.CodeSignOptions.RESTRICT),
set(parts['helper-plugin-app'].options))
self.assertEqual( self.assertEqual(
set(model.CodeSignOptions.RESTRICT + set(model.CodeSignOptions.RESTRICT +
model.CodeSignOptions.LIBRARY_VALIDATION), model.CodeSignOptions.LIBRARY_VALIDATION),
......
...@@ -492,6 +492,8 @@ bool NaClProcessHost::LaunchSelLdr() { ...@@ -492,6 +492,8 @@ bool NaClProcessHost::LaunchSelLdr() {
#if defined(OS_LINUX) #if defined(OS_LINUX)
int flags = ChildProcessHost::CHILD_ALLOW_SELF; int flags = ChildProcessHost::CHILD_ALLOW_SELF;
#elif defined(OS_MACOSX)
int flags = ChildProcessHost::CHILD_PLUGIN;
#else #else
int flags = ChildProcessHost::CHILD_NORMAL; int flags = ChildProcessHost::CHILD_NORMAL;
#endif #endif
......
...@@ -364,6 +364,8 @@ bool PpapiPluginProcessHost::Init(const PepperPluginInfo& info) { ...@@ -364,6 +364,8 @@ bool PpapiPluginProcessHost::Init(const PepperPluginInfo& info) {
#if defined(OS_LINUX) #if defined(OS_LINUX)
int flags = plugin_launcher.empty() ? ChildProcessHost::CHILD_ALLOW_SELF : int flags = plugin_launcher.empty() ? ChildProcessHost::CHILD_ALLOW_SELF :
ChildProcessHost::CHILD_NORMAL; ChildProcessHost::CHILD_NORMAL;
#elif defined(OS_MACOSX)
int flags = ChildProcessHost::CHILD_PLUGIN;
#else #else
int flags = ChildProcessHost::CHILD_NORMAL; int flags = ChildProcessHost::CHILD_NORMAL;
#endif #endif
......
...@@ -1637,6 +1637,8 @@ bool RenderProcessHostImpl::Init() { ...@@ -1637,6 +1637,8 @@ bool RenderProcessHostImpl::Init() {
#if defined(OS_LINUX) #if defined(OS_LINUX)
int flags = renderer_prefix.empty() ? ChildProcessHost::CHILD_ALLOW_SELF int flags = renderer_prefix.empty() ? ChildProcessHost::CHILD_ALLOW_SELF
: ChildProcessHost::CHILD_NORMAL; : ChildProcessHost::CHILD_NORMAL;
#elif defined(OS_MACOSX)
int flags = ChildProcessHost::CHILD_RENDERER;
#else #else
int flags = ChildProcessHost::CHILD_NORMAL; int flags = ChildProcessHost::CHILD_NORMAL;
#endif #endif
......
...@@ -13,6 +13,7 @@ import("//tools/ipc_fuzzer/ipc_fuzzer.gni") ...@@ -13,6 +13,7 @@ import("//tools/ipc_fuzzer/ipc_fuzzer.gni")
import("features.gni") import("features.gni")
if (is_mac) { if (is_mac) {
import("//build/config/mac/mac_sdk.gni") import("//build/config/mac/mac_sdk.gni")
import("//content/public/app/mac_helpers.gni")
} }
# For feature flags internal to content. See content/public/common:features # For feature flags internal to content. See content/public/common:features
...@@ -360,7 +361,10 @@ source_set("common") { ...@@ -360,7 +361,10 @@ source_set("common") {
} }
if (is_mac) { if (is_mac) {
deps += [ "//sandbox/mac:seatbelt" ] deps += [
":mac_helpers",
"//sandbox/mac:seatbelt",
]
} }
if (is_android) { if (is_android) {
...@@ -547,3 +551,35 @@ mojom("mojo_bindings") { ...@@ -547,3 +551,35 @@ mojom("mojo_bindings") {
export_define = "CONTENT_IMPLEMENTATION=1" export_define = "CONTENT_IMPLEMENTATION=1"
export_header = "content/common/content_export.h" export_header = "content/common/content_export.h"
} }
if (is_mac) {
source_set("mac_helpers") {
_lines = [
"// This file is generated by " +
get_label_info(target_name, "label_no_toolchain"),
"",
"#ifndef GEN_CONTENT_COMMON_MAC_HELPERS_H_",
"#define GEN_CONTENT_COMMON_MAC_HELPERS_H_",
"",
"namespace content {",
"",
]
foreach(helper_params, content_mac_helpers) {
_lines += [ "const char kMacHelperSuffix_${helper_params[0]}[] = \"${helper_params[2]}\";" ]
}
_lines += [
"",
"} // namespace content",
"",
"#endif // GEN_CONTENT_COMMON_MAC_HELPERS_H_",
]
_file = "$target_gen_dir/mac_helpers.h"
write_file(_file, _lines)
sources = [
_file,
]
}
}
...@@ -34,6 +34,9 @@ ...@@ -34,6 +34,9 @@
#if defined(OS_LINUX) #if defined(OS_LINUX)
#include "base/linux_util.h" #include "base/linux_util.h"
#elif defined(OS_MACOSX)
#include "base/mac/foundation_util.h"
#include "content/common/mac_helpers.h"
#endif // OS_LINUX #endif // OS_LINUX
namespace { namespace {
...@@ -69,6 +72,32 @@ base::FilePath ChildProcessHost::GetChildPath(int flags) { ...@@ -69,6 +72,32 @@ base::FilePath ChildProcessHost::GetChildPath(int flags) {
// executable. // executable.
if (child_path.empty()) if (child_path.empty())
base::PathService::Get(CHILD_PROCESS_EXE, &child_path); base::PathService::Get(CHILD_PROCESS_EXE, &child_path);
#if defined(OS_MACOSX)
std::string child_base_name = child_path.BaseName().value();
if (flags != CHILD_NORMAL && base::mac::AmIBundled()) {
// This is a specialized helper, with the |child_path| at
// ../Framework.framework/Versions/X/Helpers/Chromium Helper.app/Contents/
// MacOS/Chromium Helper. Go back up to the "Helpers" directory to select
// a different variant.
child_path = child_path.DirName().DirName().DirName().DirName();
if (flags == CHILD_RENDERER) {
child_base_name += kMacHelperSuffix_renderer;
} else if (flags == CHILD_PLUGIN) {
child_base_name += kMacHelperSuffix_plugin;
} else {
NOTREACHED();
}
child_path = child_path.Append(child_base_name + ".app")
.Append("Contents")
.Append("MacOS")
.Append(child_base_name);
}
#endif
return child_path; return child_path;
} }
......
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This list defines variants of the helper app bundles that macOS //content
# embedders need to produce. The different variants are code signed with
# different entitlements, which afford different capabilities depending on the
# requirements of the process.
#
# This list should be kept in sync with the enum options defined in
# //content/public/common/child_process_host.h.
#
# Each element of the list list is a tuple representing a helper variant. The
# elements of the tuple are:
# target name - A short name to be used when defining the target for that
# helper variant.
# bundle ID suffix - A string fragment to append to the CFBundleIdentifier of
# the helper.
# app name suffix - A string fragment to append to the outer bundle name as
# well as the inner executable. This should be reflected in
# the target's output_name.
content_mac_helpers = [
# The basic helper with no special entitlements.
[
"default",
"",
"",
],
# A helper with the capability to JIT (execute writable memory), needed by V8,
# and used to run renderer processes.
[
"renderer",
".renderer",
" (Renderer)",
],
# A helper that does not perform library validation, allowing code not signed
# by either Apple or the signing identity to be loaded, and that can execute
# unsigned memory. This is used by binary plugins like Flash.
[
"plugin",
".plugin",
" (Plugin)",
],
]
...@@ -60,7 +60,27 @@ class CONTENT_EXPORT ChildProcessHost : public IPC::Sender { ...@@ -60,7 +60,27 @@ class CONTENT_EXPORT ChildProcessHost : public IPC::Sender {
// gdb). In this case, you'd use GetChildPath to get the real executable // gdb). In this case, you'd use GetChildPath to get the real executable
// file name, and then prepend the GDB command to the command line. // file name, and then prepend the GDB command to the command line.
CHILD_ALLOW_SELF = 1 << 0, CHILD_ALLOW_SELF = 1 << 0,
#endif // defined(OS_LINUX) #elif defined(OS_MACOSX)
// Note, on macOS these are not bitwise flags and each value is mutually
// exclusive with the others. Each one of these options should correspond
// to a value in //content/public/app/mac_helpers.gni.
// Starts a child process with the macOS entitlement that allows JIT (i.e.
// memory that is writable and executable). In order to make use of this,
// memory cannot simply be allocated as read-write-execute; instead, the
// MAP_JIT flag must be passed to mmap() when allocating the memory region
// into which the writable-and-executable data are stored.
CHILD_RENDERER,
// Starts a child process with the macOS entitlement that ignores the
// library validation code signing enforcement. Library validation mandates
// that all executable pages be backed by a code signature that either 1)
// is signed by Apple, or 2) signed by the same Team ID as the main
// executable. Binary plug-ins that are not always signed by the same Team
// ID as the main binary, so this flag should be used when needing to load
// third-party plug-ins.
CHILD_PLUGIN,
#endif
}; };
// Returns the pathname to be used for a child process. If a subprocess // Returns the pathname to be used for a child process. If a subprocess
......
...@@ -18,6 +18,7 @@ if (is_android) { ...@@ -18,6 +18,7 @@ if (is_android) {
} else if (is_mac) { } else if (is_mac) {
import("//build/config/mac/rules.gni") import("//build/config/mac/rules.gni")
import("//build/mac/tweak_info_plist.gni") import("//build/mac/tweak_info_plist.gni")
import("//content/public/app/mac_helpers.gni")
import("//third_party/icu/config.gni") import("//third_party/icu/config.gni")
import("//ui/gl/features.gni") import("//ui/gl/features.gni")
import("//v8/gni/v8.gni") import("//v8/gni/v8.gni")
...@@ -712,16 +713,20 @@ if (is_mac) { ...@@ -712,16 +713,20 @@ if (is_mac) {
bundle_data("content_shell_framework_helpers") { bundle_data("content_shell_framework_helpers") {
testonly = true testonly = true
sources = [ sources = [
"$root_out_dir/$content_shell_helper_name.app",
"$root_out_dir/chrome_crashpad_handler", "$root_out_dir/chrome_crashpad_handler",
] ]
outputs = [ outputs = [
"{{bundle_contents_dir}}/Helpers/{{source_file_part}}", "{{bundle_contents_dir}}/Helpers/{{source_file_part}}",
] ]
public_deps = [ public_deps = [
":content_shell_helper_app",
"//components/crash/content/app:chrome_crashpad_handler", "//components/crash/content/app:chrome_crashpad_handler",
] ]
foreach(helper_params, content_mac_helpers) {
sources += [
"$root_out_dir/${content_shell_helper_name}${helper_params[2]}.app",
]
public_deps += [ ":content_shell_helper_app_${helper_params[0]}" ]
}
} }
tweak_info_plist("content_shell_framework_plist") { tweak_info_plist("content_shell_framework_plist") {
...@@ -805,28 +810,49 @@ if (is_mac) { ...@@ -805,28 +810,49 @@ if (is_mac) {
] ]
} }
mac_app_bundle("content_shell_helper_app") { template("content_shell_helper_app") {
testonly = true mac_app_bundle(target_name) {
output_name = content_shell_helper_name assert(defined(invoker.helper_name_suffix))
sources = [ assert(defined(invoker.helper_bundle_id_suffix))
"app/shell_main_mac.cc",
] testonly = true
defines = [
"HELPER_EXECUTABLE", output_name = content_shell_helper_name + invoker.helper_name_suffix
"SHELL_PRODUCT_NAME=\"$content_shell_product_name\"",
] sources = [
deps = [ "app/shell_main_mac.cc",
"//sandbox/mac:seatbelt", ]
] defines = [
ldflags = [ "HELPER_EXECUTABLE",
# The helper is in Content Shell.app/Contents/Frameworks/ "SHELL_PRODUCT_NAME=\"$content_shell_product_name\"",
# Content Shell Framework.framework/Versions/C/Helpers/ ]
# Content Shell Helper.app/Contents/MacOS/ extra_substitutions = [
# so set rpath up to the base. "CONTENT_SHELL_HELPER_SUFFIX=${invoker.helper_name_suffix}",
"-rpath", "CONTENT_SHELL_HELPER_BUNDLE_ID_SUFFIX=${invoker.helper_bundle_id_suffix}",
"@executable_path/../../../../../../../../../..", ]
] deps = [
info_plist_target = ":content_shell_helper_plist" "//sandbox/mac:seatbelt",
]
ldflags = [
# The helper is in Content Shell.app/Contents/Frameworks/
# Content Shell Framework.framework/Versions/C/Helpers/
# Content Shell Helper.app/Contents/MacOS/
# so set rpath up to the base.
"-rpath",
"@executable_path/../../../../../../../../../..",
]
info_plist_target = ":content_shell_helper_plist"
}
}
foreach(helper_params, content_mac_helpers) {
_helper_target = helper_params[0]
_helper_bundle_id = helper_params[1]
_helper_suffix = helper_params[2]
content_shell_helper_app("content_shell_helper_app_${_helper_target}") {
helper_name_suffix = _helper_suffix
helper_bundle_id_suffix = _helper_bundle_id
}
} }
bundle_data("content_shell_framework_bundle_data") { bundle_data("content_shell_framework_bundle_data") {
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string> <string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
<string>org.chromium.ContentShell.helper</string> <string>org.chromium.ContentShell.helper${CONTENT_SHELL_HELPER_BUNDLE_ID_SUFFIX}</string>
<key>CFBundleInfoDictionaryVersion</key> <key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string> <string>6.0</string>
<key>CFBundleName</key> <key>CFBundleName</key>
......
...@@ -50,7 +50,7 @@ group("telemetry_chrome_test") { ...@@ -50,7 +50,7 @@ group("telemetry_chrome_test") {
if (is_mac) { if (is_mac) {
data_deps += [ data_deps += [
"//chrome:chrome_framework", "//chrome:chrome_framework",
"//chrome:chrome_helper_app", "//chrome:chrome_helper_app_default",
"//third_party/breakpad:dump_syms", "//third_party/breakpad:dump_syms",
"//third_party/crashpad/crashpad/tools:crashpad_database_util", "//third_party/crashpad/crashpad/tools:crashpad_database_util",
] ]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment