Delete Alloy bootstrap (fixes #3685)

This commit is contained in:
Marshall Greenblatt
2024-06-25 20:12:37 -04:00
parent b95b3e6fd5
commit a461a89728
282 changed files with 360 additions and 22399 deletions

View File

@ -24,11 +24,9 @@
#include "base/values.h"
#include "cef/grit/cef_resources.h"
#include "cef/include/cef_version.h"
#include "cef/libcef/browser/extensions/chrome_api_registration.h"
#include "cef/libcef/browser/frame_host_impl.h"
#include "cef/libcef/browser/thread_util.h"
#include "cef/libcef/common/app_manager.h"
#include "cef/libcef/features/runtime.h"
#include "chrome/browser/browser_about_handler.h"
#include "chrome/browser/devtools/devtools_ui_bindings.h"
#include "chrome/browser/profiles/profile.h"
@ -52,8 +50,6 @@
#include "ui/base/resource/resource_bundle.h"
#include "v8/include/v8.h"
using extensions::api::cef::kSupportedAPIs;
namespace scheme {
const char kChromeURL[] = "chrome://";
@ -163,25 +159,6 @@ bool IsUnlistedHost(const std::string& host) {
return false;
}
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
// Returns true if a host is WebUI and should be allowed to load.
bool IsAllowedWebUIHost(const std::string& host) {
// Chrome runtime allows all WebUI hosts.
if (cef::IsChromeRuntimeEnabled()) {
return true;
}
// Explicitly whitelisted WebUI hosts.
for (auto& kAllowedWebUIHost : kAllowedWebUIHosts) {
if (base::EqualsCaseInsensitiveASCII(kAllowedWebUIHost, host.c_str())) {
return true;
}
}
return false;
}
#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
// Additional debug URLs that are not included in chrome::kChromeDebugURLs.
const char* kAllowedDebugURLs[] = {
blink::kChromeUIBrowserCrashURL,
@ -296,59 +273,6 @@ class TemplateParser {
bool OnExtensionsSupportUI(std::string* mime_type, std::string* output) {
*mime_type = "text/html";
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
if (cef::IsAlloyRuntimeEnabled()) {
static const char kDevURL[] = "https://developer.chrome.com/extensions/";
std::string html =
"<html>\n<head><title>Extensions Support</title></head>\n"
"<body bgcolor=\"white\"><h3>Supported Chrome Extensions "
"APIs</h3>\nFollow <a "
"href=\"https://github.com/chromiumembedded/cef/issues/1947\" "
"target=\"new\">issue #1947</a> for development progress.\n<ul>\n";
bool has_top_level_name = false;
for (size_t i = 0; kSupportedAPIs[i] != nullptr; ++i) {
const std::string& api_name = kSupportedAPIs[i];
if (api_name.find("Private") != std::string::npos) {
// Don't list private APIs.
continue;
}
const size_t dot_pos = api_name.find('.');
if (dot_pos == std::string::npos) {
if (has_top_level_name) {
// End the previous top-level API entry.
html += "</ul></li>\n";
} else {
has_top_level_name = true;
}
// Start a new top-level API entry.
html += "<li><a href=\"" + std::string(kDevURL) + api_name +
"\" target=\"new\">" + api_name + "</a><ul>\n";
} else {
// Function name.
const std::string& group_name = api_name.substr(0, dot_pos);
const std::string& function_name = api_name.substr(dot_pos + 1);
html += "\t<li><a href=\"" + std::string(kDevURL) + group_name +
"#method-" + function_name + "\" target=\"new\">" + api_name +
"</a></li>\n";
}
}
if (has_top_level_name) {
// End the last top-level API entry.
html += "</ul></li>\n";
}
html += "</ul>\n</body>\n</html>";
*output = html;
return true;
}
#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
// Redirect to the Chrome documentation.
*output =
"<html><head>\n"
@ -538,23 +462,6 @@ class CefWebUIControllerFactory : public content::WebUIControllerFactory {
// Returns true if WebUI is allowed to handle the specified |url|.
static bool AllowWebUIForURL(const GURL& url) {
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
if (cef::IsChromeRuntimeEnabled() &&
url.SchemeIs(content::kChromeDevToolsScheme)) {
return DevToolsUIBindings::IsValidFrontendURL(url);
}
if (!url.SchemeIs(content::kChromeUIScheme) &&
!url.SchemeIs(content::kChromeUIUntrustedScheme)) {
return false;
}
if (IsAllowedWebUIHost(url.host())) {
return true;
}
return false;
#else // !BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
if (url.SchemeIs(content::kChromeDevToolsScheme)) {
return DevToolsUIBindings::IsValidFrontendURL(url);
}
@ -565,7 +472,6 @@ class CefWebUIControllerFactory : public content::WebUIControllerFactory {
}
return true;
#endif // ! BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
}
// Returns true if WebUI is allowed to make network requests.
@ -667,18 +573,8 @@ class CefWebUIControllerFactory : public content::WebUIControllerFactory {
}
static void BrowserURLHandlerCreated(content::BrowserURLHandler* handler) {
#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
// For Chrome runtime this is registered in
// chrome: & friends. The default registration is disabled is
// ChromeContentBrowserClient::BrowserURLHandlerCreated().
if (cef::IsAlloyRuntimeEnabled()) {
// Handler to rewrite chrome://about and chrome://sync URLs.
handler->AddHandlerPair(&HandleChromeAboutAndChromeSyncRewrite,
content::BrowserURLHandler::null_handler());
}
#endif
// chrome: & friends. For Chrome runtime the default registration is
// disabled is ChromeContentBrowserClient::BrowserURLHandlerCreated().
handler->AddHandlerPair(&HandleWebUI, &HandleWebUIReverse);
}