Files
helium/patches/helium/core/exclude-irrelevant-flags.patch
2025-12-17 12:07:35 +06:00

351 lines
12 KiB
C++

--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -13667,11 +13667,328 @@ const FeatureEntry kFeatureEntries[] = {
// AboutFlagsHistogramTest unit test to verify this process).
};
+// Flags that either break Helium functionality or are not relevant to Helium
+constexpr auto kExcludedFlags = base::MakeFixedFlatSet<std::string_view>({
+ // Misc UI features
+ "enable-immersive-fullscreen-toolbar",
+ "windows11-mica-titlebar",
+ "omnibox-toolbelt",
+ "webium",
+ "webui-omnibox-popup",
+ "top-chrome-touch-ui",
+
+ // Google's broken canvas noising flag,
+ // replaced by Helium's fingerprinting-canvas-noise
+ "enable-canvas-noise",
+
+ // Google's fingerprinting protection blocklist
+ // Helium blocks fingerprinting by default, and these don't even work
+ "enable-fingerprinting-protection-blocklist",
+ "enable-fingerprinting-protection-blocklist-incognito",
+
+ // Google's experimental APIs that don't work in Helium
+ // due to missing model binaries
+ "translation-api",
+ "translation-api-streaming-by-sentence",
+
+ // Misc features not relevant to Helium
+ "extensions-menu-access-control",
+ "extensions-collapse-main-menu",
+
+ // NTP
+ "omnibox-zero-suggest-prefetching",
+ "omnibox-mia-zps",
+ "ntp-calendar-module",
+ "ntp-drive-module-no-sync-requirement",
+ "ntp-module-sign-in-requirement",
+ "ntp-ogb-async-bar-parts",
+ "ntp-outlook-calendar-module",
+ "ntp-sharepoint-module",
+ "ntp-tab-groups-module",
+ "ntp-tab-groups-module-zero-state",
+ "ntp-microsoft-authentication-module",
+ "ntp-realbox-next",
+ "ntp-next-features",
+ "ntp-customize-chrome-auto-open",
+
+ // Google Account & Sync
+ "use-sync-sandbox",
+ "offer-migration-to-dice-users",
+ "web-signin-leads-to-implicitly-signed-in-state",
+ "enable-extensions-explicit-browser-signin",
+ "enable-history-sync-optin",
+ "sync-enable-bookmarks-in-transport-mode",
+ "reading-list-enable-sync-transport-mode-upon-sign-in",
+ "enable-history-sync-optin-expansion-pill",
+ "collaboration-shared-tab-group-account-data",
+ "enable-bookmarks-selected-type-on-signin-for-testing",
+ "enable-cross-device-pref-tracker",
+ "pdf-save-to-drive",
+ "mdm-errors-for-dasher-accounts-handling",
+ "profile-creation-decline-signin-cta-experiment",
+ "show-profile-picker-to-all-users-experiment",
+
+ // Gemini Nano / Other Google models
+ "prompt-api-for-gemini-nano",
+ "prompt-api-for-gemini-nano-multimodal-input",
+ "summarization-api-for-gemini-nano",
+ "writer-api-for-gemini-nano",
+ "rewriter-api-for-gemini-nano",
+ "proofreader-api-for-gemini-nano",
+ "omnibox-on-device-tail-suggestions",
+
+ // AI Mode
+ "ai-mode-omnibox-entry-point",
+ "aim-server-eligibility",
+ "hide-aim-omnibox-entrypoint-on-user-input",
+ "omnibox-allow-ai-mode-matches",
+ "omnibox-aim-shortcut-typed-state",
+ "enable-lens-search-aim-m3",
+ "ntp-compose-entrypoint",
+ "ntp-composebox",
+ "composebox-uses-chrome-compose-client",
+ "compose-selection-nudge",
+ "contextual-tasks",
+ "web-app-migrate-preinstalled-chat",
+ "webui-omnibox-aim-popup",
+
+ // Contextual AI stuff (AI Mode entrypoints?)
+ "contextual-search-box-uses-contextual-search-provider",
+ "contextual-suggestions-ablate-others-when-present",
+ "omnibox-contextual-search-on-focus-suggestions",
+ "omnibox-contextual-suggestions",
+ "contextual-cueing",
+ "contextual-suggestion-ui-improvements",
+ "contextual-tasks-context",
+
+ // Shopping stuff
+ "product-specifications",
+ "compare-confirmation-toast",
+ "shopping-list",
+ "shopping-alternate-server",
+ "price-tracking-subscription-service-locale-key",
+ "price-tracking-subscription-service-product-version",
+ "track-by-default-mobile",
+ "price-insights",
+ "discount-on-navigation",
+ "discount-autofill",
+ "merchant-trust",
+
+ // History
+ "history-embeddings",
+ "history-embeddings-answers",
+
+ // Optimization Guide
+ "optimization-guide-debug-logs",
+ "optimization-guide-model-execution",
+ "optimization-guide-on-device-model",
+ "optimization-guide-personalized-fetching",
+ "optimization-guide-push-notifications",
+ "optimization-guide-enable-dogfood-logging",
+ "privacy-policy-insights",
+
+ // Google Lens
+ "enable-lens-overlay",
+ "enable-lens-overlay-image-context-menu-actions",
+ "enable-lens-overlay-updated-visuals",
+ "enable-lens-overlay-edu-action-chip",
+ "enable-lens-overlay-entrypoint-label-alt",
+ "enable-lens-overlay-text-selection-context-menu-entrypoint",
+ "lens-overlay-omnibox-entry-point",
+ "lens-search-side-panel-default-width-change",
+ "lens-overlay-permission-bubble-alt",
+ "enable-lens-overlay-simplified-selection",
+ "enable-lens-overlay-translate-button",
+ "enable-lens-overlay-latency-optimizations",
+ "enable-lens-overlay-translate-languages",
+ "enable-lens-overlay-side-panel-open-in-new-tab",
+ "enable-lens-search-side-panel-new-feedback",
+ "enable-lens-overlay-back-to-page",
+ "enable-lens-overlay-straight-to-srp",
+ "enable-lens-overlay-force-empty-csb-query",
+ "contextual-search-open-lens-action-uses-thumbnail",
+ "lens-reinvocation-affordance",
+ "lens-search-zero-state-csb",
+ "lens-updated-feedback-entrypoint",
+ "lens-video-citations",
+ "lens-aim-suggestions",
+ "lens-aim-gradient-suggest-background",
+ "lens-overlay-optimization-filter",
+ "lens-overlay-non-blocking-privacy-notice",
+
+ // Google Assistant
+ "enable-assistant-dsp",
+ "enable-assistant-stereo-input",
+ "enable-assistant-aec",
+
+ // User education
+ "ntp-middle-slot-promo-dismissal",
+ "ntp-mobile-promo",
+ "force-ntp-mobile-promo",
+ "enable-educational-tip-default-browser-promo-card",
+ "force-startup-signin-promo",
+ "group-promo-prototype",
+ "group-promo-prototype-cpa",
+ "avatar-button-sync-promo",
+ "replace-sync-promos-with-sign-in-promos-desktop",
+ "replace-sync-promos-with-sign-in-promos",
+ "clank-default-browser-promo-role-manager",
+ "clank-default-browser-promo2",
+ "policy-promotion-banner-flag",
+ "management-promotion-banner-flag",
+ "enable-ntp-browser-promos",
+ "mobile-promo-on-desktop",
+ "in-product-help-demo-mode-choice",
+ "iph-extensions-menu-feature",
+ "iph-extensions-request-access-button-feature",
+
+ // GLIC (AI agent stuff)
+ "glic",
+ "glic-z-order-changes",
+ "glic-actor",
+ "glic-detached",
+ "glic-panel-reset-top-chrome-button",
+ "glic-panel-reset-on-start",
+ "glic-panel-set-position-on-drag",
+ "glic-panel-reset-on-session-timeout",
+ "glic-panel-reset-size-and-location-on-open",
+ "glic-pre-warming",
+ "glic-fre-pre-warming",
+ "browsing-history-actor-integration-M1",
+
+ // Live captions
+ "enable-headless-live-caption",
+
+ // Google Wallet
+ "wallet-service-use-sandbox",
+
+ // Safety Hub
+ "safety-hub",
+ "safety-hub-magic-stack",
+ "safety-hub-followup",
+ "safety-hub-android-survey",
+ "safety-hub-android-survey-v2",
+ "safety-hub-weak-reused-passwords",
+ "safety-hub-local-passwords-module",
+ "safety-hub-unified-passwords-module",
+ "safety-hub-one-off-survey",
+ "safety-hub-services-on-start-up",
+ "safety-hub-disruptive-notification-revocation",
+ "safety-hub-unused-permission-revocation-for-all-surfaces",
+
+ // Privacy Sandbox
+ "privacy-sandbox-internals",
+ "privacy-sandbox-enrollment-overrides",
+ "privacy-sandbox-ads-api-ux-enhancements",
+ "privacy-sandbox-ad-topics-content-parity",
+ "privacy-guide-ai-settings",
+
+ // Password Manager
+ "biometric-reauth-password-filling",
+ "password-manual-fallback-available",
+ "save-passwords-contextual-ui",
+ "password-form-grouped-affiliations",
+ "password-form-clientside-classifier",
+ "three-button-password-save-dialog",
+ "improved-password-change-service",
+ "fill-recovery-password",
+ "apply-clientside-model-predictions-for-password-types",
+ "enable-site-isolation-for-password-sites",
+ "pwm-show-suggestions-on-autofocus",
+ "web-authentication-passkey-upgrade",
+
+ // Reading Mode
+ "read-anything-read-aloud",
+ "read-anything-read-aloud-phrase-highlighting",
+ "read-anything-images-via-algorithm",
+ "read-anything-docs-integration",
+ "read-anything-docs-load-more-button",
+ "read-anything-read-aloud-ts-text-segmentation",
+ "read-anything-with-readability-enabled",
+
+ // Autofill
+ "reintroduce-hybrid-passkey-entry-point",
+ "fill-on-account-select",
+ "show-autofill-type-predictions",
+ "autofill-more-prominent-popup",
+ "autofill-payments-field-swapping",
+ "autofill-show-bubbles-based-on-priorities",
+ "enable-show-autofill-signatures",
+ "enable-autofill-credit-card-upload",
+ "autofill-enable-offers-in-clank-keyboard-accessory",
+ "fedcm-autofill",
+ "autofill-enable-ranking-formula-address-profiles",
+ "autofill-enable-ranking-formula-credit-cards",
+ "sync-autofill-wallet-credential-data",
+ "autofill-enable-cvc-storage-and-filling",
+ "autofill-enable-prefetching-risk-data-for-retrieval",
+ "autofill-enable-fpan-risk-based-authentication",
+ "autofill-enable-email-or-loyalty-cards-filling",
+ "autofill-enable-loyalty-cards-filling",
+ "autofill-enable-syncing-of-loyalty-cards",
+ "autofill-enable-vcn-3ds-authentication",
+ "autofill-shared-storage-server-card-data",
+ "autofill-enable-syncing-of-pix-bank-accounts",
+ "autofill-enable-card-benefits-for-american-express",
+ "autofill-enable-card-benefits-sync",
+ "autofill-sync-ewallet-accounts",
+ "autofill-unmask-card-request-timeout",
+ "autofill-enable-cvc-storage-and-filling-enhancement",
+ "autofill-enable-buy-now-pay-later",
+ "autofill-enable-buy-now-pay-later-syncing",
+ "autofill-enable-cvc-storage-and-filling-standalone-form-enhancement",
+ "autofill-enable-card-benefits-iph",
+ "autofill-enable-card-info-runtime-retrieval",
+ "autofill-enable-save-and-fill",
+ "autofill-improved-labels",
+ "autofill-third-party-mode-content-provider",
+ "autofill-enable-card-benefits-for-bmo",
+ "autofill-enable-allowlist-for-bmo-card-category-benefits",
+ "autofill-enable-amount-extraction",
+ "autofill-enable-amount-extraction-allowlist",
+ "third-party-disable-chrome-autofill-settings-screen",
+ "iph-autofill-credit-card-benefit-feature",
+ "autofill-enable-new-fop-display-desktop",
+ "autofill-enable-amount-extraction-testing",
+ "autofill-vcn-enroll-strike-expiry-time",
+ "autofill-enable-flat-rate-card-benefits-from-curinos",
+ "autofill-enable-multiple-request-in-virtual-card-downstream-enrollment",
+ "autofill-require-cvc-for-possible-card-update",
+ "disable-autofill-strike-system",
+ "autofill-enable-buy-now-pay-later-for-klarna",
+ "autofill-enable-downstream-card-awareness-iph",
+ "autofill-enable-buy-now-pay-later-for-externally-linked",
+ "autofill-enable-separate-pix-preference-item",
+ "autofill-manual-testing-data",
+ "autofill-enable-support-for-home-and-work",
+ "autofill-enable-support-for-name-and-email-profile",
+ "autofill-update-context-for-web-contents",
+ "autofill-prioritize-save-card-over-mandatory-reauth",
+ "autofill-enable-buy-now-pay-later-updated-suggestion-second-line-string",
+ "autofill-and-passwords-in-same-surface",
+ "autofill-enable-ai-based-amount-extraction",
+ "autofill-prefer-buy-now-pay-later-blocklists",
+ "mark-all-credentials-as-leaked",
+ "apply-clientside-model-predictions-for-otps",
+
+ // Add new entries above this line and categorize them accordingly.
+});
+
+const base::NoDestructor<std::vector<FeatureEntry>> kHeliumFeatureEntries([] {
+ std::vector<FeatureEntry> filtered;
+ for (const auto& entry : kFeatureEntries) {
+ if (!kExcludedFlags.contains(entry.internal_name)) {
+ filtered.push_back(entry);
+ }
+ }
+ return filtered;
+}());
+
class FlagsStateSingleton : public flags_ui::FlagsState::Delegate {
public:
FlagsStateSingleton()
: flags_state_(
- std::make_unique<flags_ui::FlagsState>(kFeatureEntries, this)) {}
+ std::make_unique<flags_ui::FlagsState>(*kHeliumFeatureEntries, this)) {}
FlagsStateSingleton(const FlagsStateSingleton&) = delete;
FlagsStateSingleton& operator=(const FlagsStateSingleton&) = delete;
~FlagsStateSingleton() override = default;
@@ -13690,7 +14007,7 @@ class FlagsStateSingleton : public flags
void RestoreDefaultState() {
flags_state_ =
- std::make_unique<flags_ui::FlagsState>(kFeatureEntries, this);
+ std::make_unique<flags_ui::FlagsState>(*kHeliumFeatureEntries, this);
}
private:
@@ -14014,7 +14331,7 @@ base::span<const FeatureEntry> GetFeatur
!entries_for_testing->empty()) {
return *entries_for_testing;
}
- return kFeatureEntries;
+ return *kHeliumFeatureEntries;
}
} // namespace testing