From 714939df2c45c622073dfb55b4b5c6b851dbf99e Mon Sep 17 00:00:00 2001 From: wukko Date: Thu, 11 Dec 2025 21:03:27 +0600 Subject: [PATCH] helium/core/components: descriptive helium services state error now components show an error about disabled helium services if autoupdating is disabled --- patches/helium/core/component-updates.patch | 59 ++++++++++++++++++++ patches/helium/ui/toolbar-button-prefs.patch | 2 +- 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/patches/helium/core/component-updates.patch b/patches/helium/core/component-updates.patch index 70e199de..1f159be0 100644 --- a/patches/helium/core/component-updates.patch +++ b/patches/helium/core/component-updates.patch @@ -159,3 +159,62 @@ 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/ui/toolbar-button-prefs.patch b/patches/helium/ui/toolbar-button-prefs.patch index cd16b4e1..92171f78 100644 --- a/patches/helium/ui/toolbar-button-prefs.patch +++ b/patches/helium/ui/toolbar-button-prefs.patch @@ -517,7 +517,7 @@ // The container (and extensions-menu button) should not be visible if we have --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd -@@ -10466,6 +10466,9 @@ Keep your key file in a safe place. You +@@ -10469,6 +10469,9 @@ Keep your key file in a safe place. You Find