Files
cef/patch/patches/chrome_browser_profiles.patch
Marshall Greenblatt a26ddfd279 Update to Chromium version 156.0.8078.0
win: dxil.dll is no longer distributed
mac: Xcode 27 (macOS 26.6+) is now required
2026-10-07 12:25:37 -04:00

146 lines
6.3 KiB
Diff

diff --git chrome/browser/profiles/off_the_record_profile_impl.cc chrome/browser/profiles/off_the_record_profile_impl.cc
index 21cb081cd448202654444cd4cafebfa91c68e763..aa825be6584e8d0b5a32bf767bbe680b4414a3e2 100644
--- chrome/browser/profiles/off_the_record_profile_impl.cc
+++ chrome/browser/profiles/off_the_record_profile_impl.cc
@@ -639,7 +639,9 @@ std::unique_ptr<Profile> Profile::CreateOffTheRecordProfile(
#endif
if (!profile)
profile = std::make_unique<OffTheRecordProfileImpl>(parent, otr_profile_id);
- profile->Init();
+ // With CEF we want to delay initialization.
+ if (!otr_profile_id.IsUniqueForCEF())
+ profile->Init();
return std::move(profile);
}
diff --git chrome/browser/profiles/profile.cc chrome/browser/profiles/profile.cc
index f5c9ae68aaf4a9f6f2288d9c4a7e0b249d67dcea..e1dfee49632af6a3d43cfc8264a0311ecd08e6ea 100644
--- chrome/browser/profiles/profile.cc
+++ chrome/browser/profiles/profile.cc
@@ -105,6 +105,7 @@ constexpr char kPrimaryOTRProfileID[] = "profile::primary_otr";
// differentiated by such prefixes. Consult with the profile owners before
// proceeding if you believe a new prefix is strictly necessary.
// See `chrome/browser/PRESUBMIT.py` which enforces this via a warning.
+constexpr char kCEFOTRProfileIDPrefix[] = "CEF::BrowserContext";
constexpr char kDevToolsOTRProfileIDPrefix[] = "Devtools::BrowserContext";
constexpr char kMediaRouterOTRProfileIDPrefix[] = "MediaRouter::Presentation";
constexpr char kTestOTRProfileIDPrefix[] = "Test::OTR";
@@ -125,6 +126,8 @@ bool Profile::OTRProfileID::AllowsBrowserWindows() const {
// DevTools::BrowserContext, MediaRouter::Presentation, and
// CaptivePortal::Signin are exceptions to this ban.
if (*this == PrimaryID() || IsDevTools() ||
+ base::StartsWith(profile_id_, kCEFOTRProfileIDPrefix,
+ base::CompareCase::SENSITIVE) ||
base::StartsWith(profile_id_, kMediaRouterOTRProfileIDPrefix,
base::CompareCase::SENSITIVE)) {
return true;
@@ -165,6 +168,16 @@ Profile::OTRProfileID Profile::OTRProfileID::CreateUnique(
base::Uuid::GenerateRandomV4().AsLowercaseString().c_str()));
}
+// static
+Profile::OTRProfileID Profile::OTRProfileID::CreateUniqueForCEF() {
+ return CreateUnique(kCEFOTRProfileIDPrefix);
+}
+
+bool Profile::OTRProfileID::IsUniqueForCEF() const {
+ return base::StartsWith(profile_id_, kCEFOTRProfileIDPrefix,
+ base::CompareCase::SENSITIVE);
+}
+
// static
Profile::OTRProfileID Profile::OTRProfileID::CreateUniqueForDevTools() {
return CreateUnique(kDevToolsOTRProfileIDPrefix);
diff --git chrome/browser/profiles/profile.h chrome/browser/profiles/profile.h
index c3f5e8f8e4bbeafef1741b7c8139737177fdb905..1063f2fca3b277f23695aea0bb85069c64188132 100644
--- chrome/browser/profiles/profile.h
+++ chrome/browser/profiles/profile.h
@@ -94,6 +94,10 @@ class Profile : public content::BrowserContext {
// details.
static OTRProfileID CreateUnique(const std::string& profile_id_prefix);
+ // Creates a unique OTR profile id to be used for CEF browser contexts.
+ static OTRProfileID CreateUniqueForCEF();
+ bool IsUniqueForCEF() const;
+
// Creates a unique OTR profile id to be used for DevTools browser contexts.
static OTRProfileID CreateUniqueForDevTools();
@@ -517,6 +521,8 @@ class Profile : public content::BrowserContext {
virtual void AckCrashForTracking() = 0;
#endif
+ void NotifyOffTheRecordProfileCreated(Profile* off_the_record);
+
LifecycleState lifecycle_state() const { return lifecycle_state_; }
void set_lifecycle_state(LifecycleState lifecycle_state) {
lifecycle_state_ = lifecycle_state;
@@ -534,7 +540,6 @@ class Profile : public content::BrowserContext {
Profile*,
bool incognito_pref_store);
- void NotifyOffTheRecordProfileCreated(Profile* off_the_record);
void NotifyProfileInitializationComplete();
// Returns whether the user has signed in this profile to an account.
diff --git chrome/browser/profiles/profile_impl.cc chrome/browser/profiles/profile_impl.cc
index 81e83a88483367ffb93434cd6223a080ee42593d..0634a543bc3e954b0ebb964e8045d7aa2074cf5d 100644
--- chrome/browser/profiles/profile_impl.cc
+++ chrome/browser/profiles/profile_impl.cc
@@ -40,6 +40,7 @@
#include "base/version.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
+#include "cef/libcef/features/features.h"
#include "chrome/browser/background/background_contents_service_factory.h"
#include "chrome/browser/background_fetch/background_fetch_delegate_factory.h"
#include "chrome/browser/background_fetch/background_fetch_delegate_impl.h"
@@ -238,6 +239,10 @@
#include "chrome/browser/background/extensions/background_mode_manager.h" // nogncheck crbug.com/40147906
#endif
+#if BUILDFLAG(ENABLE_CEF)
+#include "cef/libcef/browser/prefs/pref_names.h"
+#endif
+
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
#include "chrome/browser/extensions/chrome_content_browser_client_extensions_part.h" // nogncheck crbug.com/40147906
#include "chrome/browser/extensions/extension_special_storage_policy.h" // nogncheck crbug.com/40147906
@@ -290,6 +295,12 @@ class ScopedAllowBlockingForProfile : public base::ScopedAllowBlocking {};
namespace {
+#if BUILDFLAG(ENABLE_CEF)
+BASE_FEATURE(kStorageNotificationService,
+ "StorageNotificationService",
+ base::FEATURE_ENABLED_BY_DEFAULT);
+#endif
+
#if BUILDFLAG(ENABLE_SESSION_SERVICE)
// Delay before we explicitly create the SessionService.
static constexpr base::TimeDelta kCreateSessionServiceDelay =
@@ -1079,7 +1090,9 @@ Profile* ProfileImpl::GetOffTheRecordProfile(const OTRProfileID& otr_profile_id,
otr_profiles_[otr_profile_id] = std::move(otr_profile);
- NotifyOffTheRecordProfileCreated(raw_otr_profile);
+ // With CEF we want to delay initialization.
+ if (!otr_profile_id.IsUniqueForCEF())
+ NotifyOffTheRecordProfileCreated(raw_otr_profile);
return raw_otr_profile;
}
@@ -1425,6 +1438,12 @@ ProfileImpl::GetStorageNotificationService() {
#if BUILDFLAG(IS_ANDROID)
return nullptr;
#else
+#if BUILDFLAG(ENABLE_CEF)
+ if (!base::FeatureList::IsEnabled(kStorageNotificationService) ||
+ !GetPrefs()->GetBoolean(cef::prefs::kEnableStorageNotificationService)) {
+ return nullptr;
+ }
+#endif
return StorageNotificationServiceFactory::GetForBrowserContext(this);
#endif
}