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

@ -1,182 +1,3 @@
diff --git chrome/browser/enterprise/connectors/analysis/content_analysis_delegate.cc chrome/browser/enterprise/connectors/analysis/content_analysis_delegate.cc
index 504a8473a7511..6c6aa2d9c4541 100644
--- chrome/browser/enterprise/connectors/analysis/content_analysis_delegate.cc
+++ chrome/browser/enterprise/connectors/analysis/content_analysis_delegate.cc
@@ -23,6 +23,7 @@
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "build/build_config.h"
+#include "cef/libcef/features/runtime.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/enterprise/connectors/analysis/analysis_settings.h"
#include "chrome/browser/enterprise/connectors/analysis/content_analysis_dialog.h"
@@ -367,6 +368,11 @@ bool ContentAnalysisDelegate::IsEnabled(Profile* profile,
GURL url,
Data* data,
AnalysisConnector connector) {
+#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
+ if (cef::IsAlloyRuntimeEnabled())
+ return false;
+#endif
+
auto* service = ConnectorsServiceFactory::GetForBrowserContext(profile);
// If the corresponding Connector policy isn't set, don't perform scans.
if (!service || !service->IsConnectorEnabled(connector))
diff --git chrome/browser/first_party_sets/first_party_sets_policy_service.cc chrome/browser/first_party_sets/first_party_sets_policy_service.cc
index a3c34a9922d2e..38c982442bc80 100644
--- chrome/browser/first_party_sets/first_party_sets_policy_service.cc
+++ chrome/browser/first_party_sets/first_party_sets_policy_service.cc
@@ -282,6 +282,12 @@ void FirstPartySetsPolicyService::OnProfileConfigReady(
// Representation of the current profile to be persisted on disk.
const std::string browser_context_id = profile->GetBaseName().AsUTF8Unsafe();
+ if (browser_context_id.empty()) {
+ // CEF/Alloy incognito profiles have empty cache path.
+ OnReadyToNotifyDelegates(std::move(config),
+ net::FirstPartySetsCacheFilter());
+ return;
+ }
base::RepeatingCallback<content::BrowserContext*()> browser_context_getter =
base::BindRepeating(
diff --git chrome/browser/net/profile_network_context_service.cc chrome/browser/net/profile_network_context_service.cc
index 6a0d1c78df0df..b38785be13813 100644
--- chrome/browser/net/profile_network_context_service.cc
+++ chrome/browser/net/profile_network_context_service.cc
@@ -25,6 +25,7 @@
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
+#include "cef/libcef/features/runtime.h"
#include "chrome/browser/browser_features.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/content_settings/cookie_settings_factory.h"
@@ -241,9 +242,16 @@ void UpdateCookieSettings(Profile* profile, ContentSettingsType type) {
// occurs in this class is unsynchronized, so it would be racy to rely on
// this update finishing before calling the context's callback.) This
// unfortunately triggers a double-update here.
- if (FederatedIdentityPermissionContext* fedcm_context =
- FederatedIdentityPermissionContextFactory::GetForProfile(profile);
- fedcm_context) {
+ FederatedIdentityPermissionContext* fedcm_context = nullptr;
+#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
+ if (!cef::IsAlloyRuntimeEnabled()) {
+ #endif
+ fedcm_context =
+ FederatedIdentityPermissionContextFactory::GetForProfile(profile);
+#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
+ }
+#endif
+ if (fedcm_context) {
settings = fedcm_context->GetSharingPermissionGrantsAsContentSettings();
}
} else {
@@ -819,9 +827,16 @@ ProfileNetworkContextService::CreateCookieManagerParams(
continue;
}
if (type == ContentSettingsType::FEDERATED_IDENTITY_SHARING) {
- if (FederatedIdentityPermissionContext* fedcm_context =
- FederatedIdentityPermissionContextFactory::GetForProfile(profile);
- fedcm_context) {
+ FederatedIdentityPermissionContext* fedcm_context = nullptr;
+#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
+ if (!cef::IsAlloyRuntimeEnabled()) {
+#endif
+ fedcm_context =
+ FederatedIdentityPermissionContextFactory::GetForProfile(profile);
+#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
+ }
+#endif
+ if (fedcm_context) {
out->content_settings[type] =
fedcm_context->GetSharingPermissionGrantsAsContentSettings();
} else {
@@ -1054,9 +1069,32 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal(
network_context_params->cookie_manager_params =
CreateCookieManagerParams(profile_, *cookie_settings_);
+ if (!in_memory) {
+ network_context_params->file_paths =
+ ::network::mojom::NetworkContextFilePaths::New();
+ }
+
+#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
// Configure on-disk storage for non-OTR profiles. OTR profiles just use
// default behavior (in memory storage, default sizes).
- if (!in_memory) {
+ if (!in_memory && cef::IsAlloyRuntimeEnabled()) {
+ PrefService* prefs = profile_->GetPrefs();
+ // Configure the HTTP cache path and size.
+ const base::FilePath& base_cache_path =
+ prefs->GetFilePath(prefs::kDiskCacheDir);
+ DCHECK(!base_cache_path.empty());
+ network_context_params->file_paths->http_cache_directory =
+ base_cache_path.Append(chrome::kCacheDirname);
+ network_context_params->http_cache_max_size =
+ prefs->GetInteger(prefs::kDiskCacheSize);
+ }
+#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
+
+ if (!in_memory
+#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
+ && !cef::IsAlloyRuntimeEnabled()
+#endif
+ ) {
PrefService* local_state = g_browser_process->local_state();
// Configure the HTTP cache path and size.
base::FilePath base_cache_path;
@@ -1065,15 +1103,14 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal(
local_state->GetFilePath(prefs::kDiskCacheDir);
if (!disk_cache_dir.empty())
base_cache_path = disk_cache_dir.Append(base_cache_path.BaseName());
+ network_context_params->file_paths->http_cache_directory =
+ base_cache_path.Append(chrome::kCacheDirname);
const int disk_cache_size = local_state->GetInteger(prefs::kDiskCacheSize);
network_context_params->http_cache_max_size = disk_cache_size;
network_context_params->shared_dictionary_cache_max_size = disk_cache_size;
+ }
- network_context_params->file_paths =
- ::network::mojom::NetworkContextFilePaths::New();
-
- network_context_params->file_paths->http_cache_directory =
- base_cache_path.Append(chrome::kCacheDirname);
+ if (!in_memory) {
network_context_params->file_paths->data_directory =
path.Append(chrome::kNetworkDataDirname);
network_context_params->file_paths->unsandboxed_data_path = path;
@@ -1264,6 +1301,9 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal(
network_context_params->first_party_sets_access_delegate_params =
network::mojom::FirstPartySetsAccessDelegateParams::New();
network_context_params->first_party_sets_access_delegate_params->enabled =
+#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
+ cef::IsAlloyRuntimeEnabled() ? false :
+#endif
PrivacySandboxSettingsFactory::GetForProfile(profile_)
->AreRelatedWebsiteSetsEnabled();
diff --git chrome/browser/signin/identity_manager_factory.cc chrome/browser/signin/identity_manager_factory.cc
index 58750a47240e5..2894f323c26bb 100644
--- chrome/browser/signin/identity_manager_factory.cc
+++ chrome/browser/signin/identity_manager_factory.cc
@@ -11,6 +11,7 @@
#include "base/observer_list.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
+#include "cef/libcef/features/runtime.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/image_fetcher/image_decoder_impl.h"
#include "chrome/browser/profiles/profile.h"
@@ -97,6 +98,9 @@ IdentityManagerFactory::~IdentityManagerFactory() {
// static
signin::IdentityManager* IdentityManagerFactory::GetForProfile(
Profile* profile) {
+#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
+ DCHECK(!cef::IsAlloyRuntimeEnabled());
+#endif
return static_cast<signin::IdentityManager*>(
GetInstance()->GetServiceForBrowserContext(profile, true));
}
diff --git net/cookies/cookie_monster.cc net/cookies/cookie_monster.cc
index 8e1134654e2b1..d0f578b5f9976 100644
--- net/cookies/cookie_monster.cc