diff --git a/patches/helium/core/add-native-bangs.patch b/patches/helium/core/add-native-bangs.patch index 59d64eb7..bd740960 100644 --- a/patches/helium/core/add-native-bangs.patch +++ b/patches/helium/core/add-native-bangs.patch @@ -724,7 +724,7 @@ COMPONENT_EXPORT(HELIUM) GURL GetDummyURL(); --- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc +++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc -@@ -2132,6 +2132,9 @@ void AddPrivacyStrings(content::WebUIDat +@@ -2134,6 +2134,9 @@ void AddPrivacyStrings(content::WebUIDat IDS_SETTINGS_HELIUM_SERVICES_EXT_PROXY_TOGGLE}, {"heliumExtProxyToggleDescription", IDS_SETTINGS_HELIUM_SERVICES_EXT_PROXY_TOGGLE_DESCRIPTION}, @@ -736,7 +736,7 @@ IDS_SETTINGS_HELIUM_SERVICES_OVERRIDE_DESCRIPTION}, --- a/chrome/app/settings_strings.grdp +++ b/chrome/app/settings_strings.grdp -@@ -1987,6 +1987,12 @@ +@@ -1990,6 +1990,12 @@ When enabled, Helium will proxy extension downloads and updates to protect your privacy. When disabled, downloading and updating extensions will not work. @@ -751,7 +751,7 @@ --- a/chrome/browser/resources/settings/privacy_page/services_page.html +++ b/chrome/browser/resources/settings/privacy_page/services_page.html -@@ -89,6 +89,11 @@ +@@ -92,6 +92,11 @@ label="$i18n{heliumExtProxyToggle}" sub-label="$i18n{heliumExtProxyToggleDescription}"> diff --git a/patches/helium/core/add-updater-preference.patch b/patches/helium/core/add-updater-preference.patch index 67aa5868..97d9e8c2 100644 --- a/patches/helium/core/add-updater-preference.patch +++ b/patches/helium/core/add-updater-preference.patch @@ -1,5 +1,3 @@ -TODO: guard services_page.html with is_mac - --- a/components/helium_services/pref_names.h +++ b/components/helium_services/pref_names.h @@ -33,6 +33,9 @@ inline constexpr char kHeliumExtProxyEna @@ -78,23 +76,21 @@ TODO: guard services_page.html with is_mac registrar.Add(prefs::kHeliumServicesEnabled, observer); --- a/chrome/browser/resources/settings/privacy_page/services_page.html +++ b/chrome/browser/resources/settings/privacy_page/services_page.html -@@ -101,6 +101,13 @@ +@@ -104,6 +104,11 @@ sub-label="$i18n{heliumSpellcheckToggleDescription}"> -+ -+ -+ -+ ++ ++ --- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc +++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc -@@ -2138,6 +2138,10 @@ void AddPrivacyStrings(content::WebUIDat +@@ -2140,6 +2140,10 @@ void AddPrivacyStrings(content::WebUIDat {"heliumSpellcheckToggle", IDS_SETTINGS_HELIUM_SERVICES_SPELLCHECK_TOGGLE}, {"heliumSpellcheckToggleDescription", IDS_SETTINGS_HELIUM_SERVICES_SPELLCHECK_TOGGLE_DESCRIPTION}, @@ -128,16 +124,23 @@ TODO: guard services_page.html with is_mac registry->RegisterBooleanPref( --- a/chrome/app/settings_strings.grdp +++ b/chrome/app/settings_strings.grdp -@@ -2002,6 +2002,12 @@ +@@ -2005,6 +2005,19 @@ Helium will fetch dictionary files used for spell checking when requested. When disabled, spell checking will not work. + -+ Allow automatic browser updates -+ -+ -+ Helium will automatically download and install browser updates as they become available. We recommend keeping this setting enabled to ensure you get the latest security patches and features. ++ Allow automatic browser and component updates + ++ ++ ++ Helium will automatically download and install browser and component updates as they become available. We recommend keeping this setting enabled to ensure you get the latest features and security updates. ++ ++ ++ ++ ++ Helium will automatically download and install browser and component updates as they become available. We recommend keeping this setting enabled to ensure you get the latest features and security updates. Automatic core browser updates are not available on this platform yet, but component updates are. Please use external software to keep Helium up to date. ++ ++ Use your own instance of Helium services diff --git a/patches/helium/core/component-updates.patch b/patches/helium/core/component-updates.patch new file mode 100644 index 00000000..1f159be0 --- /dev/null +++ b/patches/helium/core/component-updates.patch @@ -0,0 +1,220 @@ +--- a/components/component_updater/component_updater_url_constants.cc ++++ b/components/component_updater/component_updater_url_constants.cc +@@ -15,9 +15,9 @@ namespace component_updater { + // The value of |kDefaultUrlSource| can be overridden with + // --component-updater=url-source=someurl. + const char kUpdaterJSONDefaultUrl[] = +- "https://update.googleapis.com/service/update2/json"; ++ "trk:345:https://update.googleapis.com/service/update2/json"; + + const char kUpdaterJSONFallbackUrl[] = +- "http://update.googleapis.com/service/update2/json"; ++ "trk:346:http://update.googleapis.com/service/update2/json"; + + } // namespace component_updater +--- a/components/helium_services/helium_services_helpers.cc ++++ b/components/helium_services/helium_services_helpers.cc +@@ -9,6 +9,7 @@ + #include "base/functional/bind.h" + #include "base/strings/stringprintf.h" + #include "components/helium_services/pref_names.h" ++#include "components/helium_services/schema.h" + #include "components/prefs/pref_service.h" + #include "net/base/url_util.h" + #include "url/gurl.h" +@@ -88,6 +89,12 @@ bool ShouldAccessUpdateService(const Pre + prefs.GetBoolean(prefs::kHeliumUpdateFetchingEnabled); + } + ++bool ShouldAccessComponentUpdateService(const PrefService& prefs) { ++ return ShouldAccessServices(prefs) && ++ HasAcceptedSchema(prefs, 1) && ++ prefs.GetBoolean(prefs::kHeliumUpdateFetchingEnabled); ++} ++ + bool ShouldAccessUBlockAssets(const PrefService& prefs) { + return ShouldAccessServices(prefs) && + prefs.GetBoolean(prefs::kHeliumUBlockAssetsEnabled); +@@ -132,6 +139,14 @@ GURL GetBrowserUpdateURL(const PrefServi + #endif + } + ++GURL GetComponentUpdateURL(const PrefService* prefs) { ++ if (!prefs || !ShouldAccessComponentUpdateService(*prefs)) { ++ return GetDummyURL(); ++ } ++ ++ return GetServicesBaseURL(*prefs).Resolve("/com"); ++} ++ + GURL GetUBlockAssetsURL(const PrefService& prefs) { + if (!ShouldAccessUBlockAssets(prefs)) { + return GetDummyURL(); +--- a/components/helium_services/helium_services_helpers.h ++++ b/components/helium_services/helium_services_helpers.h +@@ -23,6 +23,7 @@ bool ShouldAccessServices(const PrefServ + COMPONENT_EXPORT(HELIUM) bool ShouldFetchBangs(const PrefService& prefs); + COMPONENT_EXPORT(HELIUM) bool ShouldAccessExtensionService(const PrefService& prefs); + COMPONENT_EXPORT(HELIUM) bool ShouldAccessUpdateService(const PrefService& prefs); ++COMPONENT_EXPORT(HELIUM) bool ShouldAccessComponentUpdateService(const PrefService& prefs); + COMPONENT_EXPORT(HELIUM) bool ShouldAccessUBlockAssets(const PrefService& prefs); + COMPONENT_EXPORT(HELIUM) GURL GetServicesBaseURL(const PrefService& prefs); + COMPONENT_EXPORT(HELIUM) GURL GetDummyURL(); +@@ -30,6 +31,7 @@ COMPONENT_EXPORT(HELIUM) GURL GetExtensi + COMPONENT_EXPORT(HELIUM) GURL GetWebstoreSnippetURL(const PrefService& prefs, std::string_view id); + COMPONENT_EXPORT(HELIUM) GURL GetSpellcheckURL(const PrefService& prefs); + COMPONENT_EXPORT(HELIUM) GURL GetBrowserUpdateURL(const PrefService& prefs); ++COMPONENT_EXPORT(HELIUM) GURL GetComponentUpdateURL(const PrefService* prefs); + COMPONENT_EXPORT(HELIUM) GURL GetUBlockAssetsURL(const PrefService& prefs); + COMPONENT_EXPORT(HELIUM) std::optional GetValidUserOverridenURL(std::string_view user_url_); + COMPONENT_EXPORT(HELIUM) void ConfigurePrefChangeRegistrarFor(std::string_view pref_name, +--- a/chrome/browser/component_updater/chrome_component_updater_configurator.cc ++++ b/chrome/browser/component_updater/chrome_component_updater_configurator.cc +@@ -26,11 +26,14 @@ + #include "chrome/browser/component_updater/component_updater_utils.h" + #include "chrome/browser/component_updater/updater_state.h" + #include "chrome/browser/net/system_network_context_manager.h" ++#include "chrome/browser/profiles/profile.h" ++#include "chrome/browser/profiles/profile_manager.h" + #include "chrome/browser/update_client/chrome_update_query_params_delegate.h" + #include "chrome/common/channel_info.h" + #include "chrome/common/chrome_paths.h" + #include "components/component_updater/component_updater_command_line_config_policy.h" + #include "components/component_updater/configurator_impl.h" ++#include "components/helium_services/helium_services_helpers.h" + #include "components/prefs/pref_service.h" + #include "components/services/patch/content/patch_service.h" + #include "components/services/unzip/content/unzip_service.h" +@@ -55,6 +58,26 @@ + namespace component_updater { + namespace { + ++PrefService* GetProfilePrefs() { ++ // Browser process and profile manager are usually ++ // not null, but they may be during tests. ++ if (!g_browser_process) { ++ return nullptr; ++ } ++ ++ ProfileManager* pm = g_browser_process->profile_manager(); ++ if (!pm) { ++ return nullptr; ++ } ++ ++ Profile* profile = pm->GetLastUsedProfileIfLoaded(); ++ if (!profile) { ++ return nullptr; ++ } ++ ++ return profile->GetPrefs(); ++} ++ + class ChromeConfigurator : public update_client::Configurator { + public: + ChromeConfigurator(const base::CommandLine* cmdline, +@@ -154,12 +177,12 @@ base::TimeDelta ChromeConfigurator::Upda + + std::vector ChromeConfigurator::UpdateUrl() const { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); +- return configurator_impl_.UpdateUrl(); ++ return {helium::GetComponentUpdateURL(GetProfilePrefs())}; + } + + std::vector ChromeConfigurator::PingUrl() const { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); +- return configurator_impl_.PingUrl(); ++ return {helium::GetComponentUpdateURL(GetProfilePrefs())}; + } + + std::string ChromeConfigurator::GetProdId() const { +--- a/components/component_updater/component_installer.cc ++++ b/components/component_updater/component_installer.cc +@@ -12,6 +12,7 @@ + #include + #include + ++#include "base/containers/fixed_flat_set.h" + #include "base/files/file_enumerator.h" + #include "base/files/file_path.h" + #include "base/files/file_util.h" +@@ -111,7 +112,21 @@ void ComponentInstaller::Register(Compon + + std::vector public_key_hash; + installer_policy_->GetHash(&public_key_hash); ++ ++ static constexpr auto kAllowedComponents = ++ base::MakeFixedFlatSet( ++ base::sorted_unique, ++ { ++ "hfnkpimlhhgieaddgfemjhofmfblmnib", // CRLSet ++ } ++ ); ++ + const auto crx_id = update_client::GetCrxIdFromPublicKeyHash(public_key_hash); ++ ++ if (!kAllowedComponents.contains(crx_id)) { ++ return; ++ } ++ + Register(base::BindOnce(&ComponentUpdateService::RegisterComponent, + base::Unretained(cus)), + std::move(callback), cus->GetRegisteredVersion(crx_id), +--- a/chrome/app/generated_resources.grd ++++ b/chrome/app/generated_resources.grd +@@ -6957,6 +6957,9 @@ Keep your key file in a safe place. You + + Update error + ++ ++ Component updates are disabled. See Helium services in settings. ++ + + Unknown + +--- a/chrome/browser/ui/webui/components/components_handler.cc ++++ b/chrome/browser/ui/webui/components/components_handler.cc +@@ -12,8 +12,12 @@ + #include "base/notreached.h" + #include "base/values.h" + #include "build/build_config.h" ++#include "chrome/browser/profiles/profile.h" + #include "chrome/grit/generated_resources.h" ++#include "components/helium_services/helium_services_helpers.h" ++#include "components/prefs/pref_service.h" + #include "components/update_client/crx_update_item.h" ++#include "content/public/browser/web_contents.h" + #include "ui/base/l10n/l10n_util.h" + + ComponentsHandler::ComponentsHandler( +@@ -82,6 +86,20 @@ void ComponentsHandler::OnEvent(const up + + std::u16string ComponentsHandler::ServiceStatusToString( + update_client::ComponentState state) { ++ ++ if (state == update_client::ComponentState::kUpdateError) { ++ Profile* profile = Profile::FromBrowserContext( ++ web_ui()->GetWebContents()->GetBrowserContext()); ++ ++ if (profile) { ++ PrefService* prefs = profile->GetPrefs(); ++ if (prefs && !helium::ShouldAccessComponentUpdateService(*prefs)) { ++ return l10n_util::GetStringUTF16( ++ IDS_COMPONENTS_SVC_STATUS_ERROR_HELIUM_SERVICES); ++ } ++ } ++ } ++ + switch (state) { + case update_client::ComponentState::kNew: + return l10n_util::GetStringUTF16(IDS_COMPONENTS_SVC_STATUS_NEW); +--- a/chrome/browser/ui/webui/components/components_handler.h ++++ b/chrome/browser/ui/webui/components/components_handler.h +@@ -40,7 +40,7 @@ class ComponentsHandler : public content + void OnEvent(const update_client::CrxUpdateItem& item) override; + + private: +- static std::u16string ServiceStatusToString( ++ std::u16string ServiceStatusToString( + update_client::ComponentState state); + + base::Value::List LoadComponents(); diff --git a/patches/helium/core/onboarding-page.patch b/patches/helium/core/onboarding-page.patch index 3df01965..71633eb6 100644 --- a/patches/helium/core/onboarding-page.patch +++ b/patches/helium/core/onboarding-page.patch @@ -532,7 +532,7 @@ --- a/chrome/app/settings_strings.grdp +++ b/chrome/app/settings_strings.grdp -@@ -1953,6 +1953,12 @@ +@@ -1956,6 +1956,12 @@ Don't notify me again @@ -601,7 +601,7 @@ --- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc +++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc -@@ -2128,6 +2128,10 @@ void AddPrivacyStrings(content::WebUIDat - {"heliumSchemaUpdatedTitle", IDS_SETTINGS_HELIUM_SCHEMA_NOTICE_TITLE}, +@@ -2130,6 +2130,10 @@ void AddPrivacyStrings(content::WebUIDat + IDS_SETTINGS_HELIUM_SCHEMA_NOTICE_DESCRIPTION}, {"heliumGotIt", IDS_SETTINGS_GOT_IT}, {"heliumSchemaIgnore", IDS_SETTINGS_HELIUM_SCHEMA_IGNORE}, + {"heliumExtProxyToggle", @@ -214,7 +214,7 @@ IDS_SETTINGS_HELIUM_SERVICES_OVERRIDE_DESCRIPTION}, --- a/chrome/app/settings_strings.grdp +++ b/chrome/app/settings_strings.grdp -@@ -1981,6 +1981,12 @@ +@@ -1984,6 +1984,12 @@ When enabled, Helium will be able to connect to anonymous web services to provide additional functionality. When disabled, additional features will not work. diff --git a/patches/helium/core/reenable-spellcheck-downloads.patch b/patches/helium/core/reenable-spellcheck-downloads.patch index 891a09b4..a1d43abd 100644 --- a/patches/helium/core/reenable-spellcheck-downloads.patch +++ b/patches/helium/core/reenable-spellcheck-downloads.patch @@ -128,7 +128,7 @@ registry->RegisterBooleanPref(prefs::kHeliumServicesConsented, false); --- a/chrome/browser/resources/settings/privacy_page/services_page.html +++ b/chrome/browser/resources/settings/privacy_page/services_page.html -@@ -94,6 +94,13 @@ +@@ -97,6 +97,13 @@ label="$i18n{heliumBangsToggle}" sub-label="$i18n{heliumBangsToggleDescription}"> @@ -154,7 +154,7 @@ -@@ -1993,6 +1996,12 @@ +@@ -1996,6 +1999,12 @@ Helium will fetch a list of bangs that help you browse the Internet faster, such as !w or !gh. When disabled, bangs will not work. @@ -178,7 +178,7 @@ #endif #endif // !BUILDFLAG(IS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS) -@@ -2135,6 +2135,9 @@ void AddPrivacyStrings(content::WebUIDat +@@ -2137,6 +2137,9 @@ void AddPrivacyStrings(content::WebUIDat {"heliumBangsToggle", IDS_SETTINGS_HELIUM_SERVICES_BANGS_TOGGLE}, {"heliumBangsToggleDescription", IDS_SETTINGS_HELIUM_SERVICES_BANGS_TOGGLE_DESCRIPTION}, diff --git a/patches/helium/core/reenable-update-checks.patch b/patches/helium/core/reenable-update-checks.patch index 4cfb3a79..7ee66e55 100644 --- a/patches/helium/core/reenable-update-checks.patch +++ b/patches/helium/core/reenable-update-checks.patch @@ -19,15 +19,6 @@ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (url_source_override_.is_valid()) { return {GURL(url_source_override_)}; -@@ -123,7 +125,7 @@ bool ConfiguratorImpl::EnabledDeltas() c - - bool ConfiguratorImpl::EnabledComponentUpdates() const { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); -- return true; -+ return false; - } - - bool ConfiguratorImpl::EnabledBackgroundDownloader() const { @@ -133,7 +135,7 @@ bool ConfiguratorImpl::EnabledBackground bool ConfiguratorImpl::EnabledCupSigning() const { diff --git a/patches/helium/core/search/force-eu-search-features.patch b/patches/helium/core/search/force-eu-search-features.patch index fd7b6a76..5e080520 100644 --- a/patches/helium/core/search/force-eu-search-features.patch +++ b/patches/helium/core/search/force-eu-search-features.patch @@ -16,7 +16,7 @@ #include "components/safe_browsing/core/common/features.h" #include "components/safe_browsing/core/common/hashprefix_realtime/hash_realtime_utils.h" #include "components/saved_tab_groups/public/features.h" -@@ -2665,14 +2663,9 @@ void AddSearchStrings(content::WebUIData +@@ -2667,14 +2665,9 @@ void AddSearchStrings(content::WebUIData html_source->AddString("searchExplanationLearnMoreURL", chrome::kOmniboxLearnMoreURL); diff --git a/patches/helium/core/services-prefs.patch b/patches/helium/core/services-prefs.patch index c47820ce..a97b8320 100644 --- a/patches/helium/core/services-prefs.patch +++ b/patches/helium/core/services-prefs.patch @@ -1,6 +1,6 @@ --- a/chrome/app/settings_strings.grdp +++ b/chrome/app/settings_strings.grdp -@@ -1941,6 +1941,37 @@ +@@ -1941,6 +1941,40 @@ Safe Browsing (protection from dangerous sites) and other security settings @@ -13,6 +13,9 @@ + + Updates to Helium services: + ++ ++ These changes are not active until you dismiss this notice. ++ + + Don't notify me again + @@ -40,7 +43,7 @@ Google Advanced Protection Program --- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc +++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc -@@ -2117,6 +2117,21 @@ void AddPrivacyStrings(content::WebUIDat +@@ -2117,6 +2117,23 @@ void AddPrivacyStrings(content::WebUIDat {"siteSettingsSublabel", IDS_SETTINGS_PERMISSIONS_DESCRIPTION}, {"securityPageTitle", IDS_SETTINGS_SECURITY}, {"securityPageDescription", IDS_SETTINGS_SECURITY_DESCRIPTION}, @@ -50,6 +53,8 @@ + {"heliumServicesToggleDescription", + IDS_SETTINGS_HELIUM_SERVICES_TOGGLE_DESCRIPTION}, + {"heliumSchemaUpdatedTitle", IDS_SETTINGS_HELIUM_SCHEMA_NOTICE_TITLE}, ++ {"heliumSchemaUpdatedDescription", ++ IDS_SETTINGS_HELIUM_SCHEMA_NOTICE_DESCRIPTION}, + {"heliumGotIt", IDS_SETTINGS_GOT_IT}, + {"heliumSchemaIgnore", IDS_SETTINGS_HELIUM_SCHEMA_IGNORE}, + {"heliumOriginOverride", IDS_SETTINGS_HELIUM_SERVICES_OVERRIDE}, @@ -170,7 +175,7 @@ } --- /dev/null +++ b/chrome/browser/resources/settings/privacy_page/services_page.html -@@ -0,0 +1,86 @@ +@@ -0,0 +1,89 @@ +