Add GN arg to disable Alloy bootstrap (see #3681, see #3685)

Set enable_alloy_bootstrap=false to build with Alloy bootstrap code
removed. Extension API is documented as deprecated in comments but
not compiled out with this arg.
This commit is contained in:
Marshall Greenblatt
2024-04-29 21:09:17 -04:00
parent d666ec5770
commit b5d84c254d
96 changed files with 1243 additions and 516 deletions

View File

@@ -8,18 +8,24 @@
#include <dlfcn.h>
#endif
#include "libcef/features/runtime.h"
#include "base/base_paths.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/notreached.h"
#include "base/path_service.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_paths_internal.h"
#include "chrome/common/chrome_switches.h"
#if BUILDFLAG(IS_LINUX)
#include "base/environment.h"
#include "base/nix/xdg_util.h"
#endif
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
#include "base/files/file_util.h"
#include "base/notreached.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths_internal.h"
#include "ui/base/layout.h"
#if BUILDFLAG(IS_MAC)
@@ -27,14 +33,10 @@
#include "libcef/common/util_mac.h"
#endif
#if BUILDFLAG(IS_LINUX)
#include "base/environment.h"
#include "base/nix/xdg_util.h"
#endif
#if BUILDFLAG(IS_WIN)
#include "base/win/registry.h"
#endif
#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
namespace resource_util {
@@ -116,6 +118,12 @@ base::FilePath GetUserDataPath(CefSettings* settings,
return result;
}
} // namespace
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
namespace {
// Consider downloads 'dangerous' if they go to the home directory on Linux and
// to the desktop on any platform.
// From chrome/browser/download/download_prefs.cc.
@@ -206,6 +214,16 @@ void OverrideDefaultDownloadDir() {
}
}
// Same as ui::ResourceBundle::IsScaleFactorSupported.
bool IsScaleFactorSupported(ui::ResourceScaleFactor scale_factor) {
const auto& supported_scale_factors = ui::GetSupportedResourceScaleFactors();
return std::find(supported_scale_factors.begin(),
supported_scale_factors.end(),
scale_factor) != supported_scale_factors.end();
}
#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
void OverrideUserDataDir(CefSettings* settings,
const base::CommandLine* command_line) {
const base::FilePath& user_data_path =
@@ -223,14 +241,6 @@ void OverrideUserDataDir(CefSettings* settings,
true); // Create if necessary.
}
// Same as ui::ResourceBundle::IsScaleFactorSupported.
bool IsScaleFactorSupported(ui::ResourceScaleFactor scale_factor) {
const auto& supported_scale_factors = ui::GetSupportedResourceScaleFactors();
return std::find(supported_scale_factors.begin(),
supported_scale_factors.end(),
scale_factor) != supported_scale_factors.end();
}
#if BUILDFLAG(IS_LINUX)
void OverrideAssetPath() {
Dl_info dl_info;