fix(build): extend profile methods patch for ShouldEnableXfaForms

The ShouldEnableXfaForms function uses Profile::FromBrowserContext()
which is not available in Electron. Wrap the profile-dependent code
in #if 0 to fall through to the feature flag default.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Keeley Hammond
2025-12-04 20:35:10 -08:00
parent ff9d072b4b
commit 3edec8ee30
3 changed files with 17 additions and 78 deletions

View File

@@ -141,4 +141,3 @@ allow_electron_to_depend_on_components_os_crypt_sync.patch
expose_referrerscriptinfo_hostdefinedoptionsindex.patch
chore_disable_protocol_handler_dcheck.patch
fix_check_for_file_existence_before_setting_mtime.patch
fix_linux_tray_id.patch

View File

@@ -7,7 +7,7 @@ Electron does not support Profiles, so we need to patch it out of any
code that we use.
diff --git a/chrome/browser/pdf/chrome_pdf_stream_delegate.cc b/chrome/browser/pdf/chrome_pdf_stream_delegate.cc
index 21d5ab99800c0830cc31ec4ebb24e3f05cd904d8..ae4dbc1f75a90a6f16efa4bfd1b8ca73f12ed6d6 100644
index 21d5ab99800c0830cc31ec4ebb24e3f05cd904d8..3f8f514519d6e4a0abe3690f5df35de8ffae6fd4 100644
--- a/chrome/browser/pdf/chrome_pdf_stream_delegate.cc
+++ b/chrome/browser/pdf/chrome_pdf_stream_delegate.cc
@@ -45,6 +45,7 @@ namespace {
@@ -26,6 +26,22 @@ index 21d5ab99800c0830cc31ec4ebb24e3f05cd904d8..ae4dbc1f75a90a6f16efa4bfd1b8ca73
// When the enterprise policy is not set, use finch/feature flag choice.
return base::FeatureList::IsEnabled(
@@ -63,6 +65,7 @@ bool ShouldEnableSkiaRenderer(content::WebContents* contents) {
// priority hierarchy is: enterprise policy > user choice > finch experiment.
bool ShouldEnableXfaForms(content::WebContents* contents) {
CHECK(contents);
+#if 0
const PrefService* prefs =
Profile::FromBrowserContext(contents->GetBrowserContext())->GetPrefs();
@@ -70,6 +73,7 @@ bool ShouldEnableXfaForms(content::WebContents* contents) {
if (prefs->IsManagedPreference(prefs::kPdfXfaFormsEnabled)) {
return prefs->GetBoolean(prefs::kPdfXfaFormsEnabled);
}
+#endif
// When the enterprise policy is not set, use finch/feature flag choice.
return base::FeatureList::IsEnabled(chrome_pdf::features::kPdfXfaSupport);
diff --git a/chrome/browser/pdf/pdf_extension_util.cc b/chrome/browser/pdf/pdf_extension_util.cc
index 328abdd79d287225d0e6ec6becc455e169d6e5d0..10e5e702a43dbb70e13d00b48000e0b4cc974e7a 100644
--- a/chrome/browser/pdf/pdf_extension_util.cc

View File

@@ -1,76 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Damglador <vse.stopchanskyi@gmail.com>
Date: Mon, 27 Oct 2025 23:35:43 +0100
Subject: fix: allow setting tray id
This is needed to allow setting custom tray id when initializing a tray icon.
With current behaviour all programs get chrome_status_icon_1 as their id in tray.
So tray can't tell apart Electron apps,
which introduces issues like https://bugs.kde.org/show_bug.cgi?id=470840.
This patch can be removed after being upstreamed. See discussion at
https://github.com/electron/electron/pull/48675#issuecomment-3452781711
for more info.
diff --git a/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.cc b/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.cc
index 72a61f80eb5dfafe2609ec9e3f8f34c7c84f7abe..c5c3092607b4dc0e1fa7f7fc39b8f7e82d59ffd7 100644
--- a/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.cc
+++ b/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.cc
@@ -133,8 +133,8 @@ int NextServiceId() {
return ++status_icon_count;
}
-std::string PropertyIdFromId(int service_id) {
- return "chrome_status_icon_" + base::NumberToString(service_id);
+std::string PropertyIdFromId(int service_id, const std::string_view app_name) {
+ return base::StrCat({ app_name, "_status_icon_", base::NumberToString(service_id) });
}
using DbusImage = std::tuple</*width=*/int32_t,
@@ -224,12 +224,13 @@ base::FilePath WriteIconFile(size_t icon_file_id,
} // namespace
-StatusIconLinuxDbus::StatusIconLinuxDbus()
+StatusIconLinuxDbus::StatusIconLinuxDbus(const std::string_view app_name)
: bus_(dbus_thread_linux::GetSharedSessionBus()),
should_write_icon_to_file_(ShouldWriteIconToFile()),
icon_task_runner_(base::ThreadPool::CreateSequencedTaskRunner(
{base::MayBlock(), base::TaskPriority::USER_VISIBLE,
- base::TaskShutdownBehavior::BLOCK_SHUTDOWN})) {
+ base::TaskShutdownBehavior::BLOCK_SHUTDOWN})),
+ app_name_(app_name) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
CheckStatusNotifierWatcherHasOwner();
}
@@ -405,7 +406,7 @@ void StatusIconLinuxDbus::OnHostRegisteredResponse(
properties_->SetProperty<"s">(kInterfaceStatusNotifierItem, kPropertyCategory,
kPropertyValueCategory, false);
properties_->SetProperty<"s">(kInterfaceStatusNotifierItem, kPropertyId,
- PropertyIdFromId(service_id_), false);
+ PropertyIdFromId(service_id_, app_name_), false);
properties_->SetProperty<"s">(kInterfaceStatusNotifierItem,
kPropertyOverlayIconName, "", false);
properties_->SetProperty<"s">(kInterfaceStatusNotifierItem, kPropertyStatus,
diff --git a/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.h b/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.h
index 5457f98158a094a5b8768352d2868e3005afd395..13ac4e51019ea68fdccd17aac8a4855bde50964b 100644
--- a/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.h
+++ b/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.h
@@ -37,7 +37,7 @@ class StatusIconLinuxDbus : public ui::StatusIconLinux,
public ui::SimpleMenuModel::Delegate,
public base::RefCounted<StatusIconLinuxDbus> {
public:
- StatusIconLinuxDbus();
+ StatusIconLinuxDbus(const std::string_view app_name = "chrome");
StatusIconLinuxDbus(const StatusIconLinuxDbus&) = delete;
StatusIconLinuxDbus& operator=(const StatusIconLinuxDbus&) = delete;
@@ -135,6 +135,8 @@ class StatusIconLinuxDbus : public ui::StatusIconLinux,
size_t icon_file_id_ = 0;
base::FilePath icon_file_;
+ std::string app_name_;
+
base::WeakPtrFactory<StatusIconLinuxDbus> weak_factory_{this};
};