mirror of
https://github.com/morgan9e/helium
synced 2026-04-14 00:14:20 +09:00
helium/core: component updates via helium services
managed by the same toggle as general browser updates
This commit is contained in:
@@ -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,17 +76,15 @@ 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 @@
|
||||
@@ -101,6 +101,11 @@
|
||||
sub-label="$i18n{heliumSpellcheckToggleDescription}">
|
||||
</settings-toggle-button>
|
||||
</if>
|
||||
+ <if expr="is_macosx">
|
||||
+ <settings-toggle-button id="updatesToggleButton"
|
||||
+ pref="{{prefs.helium.services.browser_updates}}"
|
||||
+ label="$i18n{heliumUpdatesToggle}"
|
||||
+ sub-label="$i18n{heliumUpdatesToggleDescription}">
|
||||
+ </settings-toggle-button>
|
||||
+ </if>
|
||||
+ <settings-toggle-button id="updatesToggleButton"
|
||||
+ pref="{{prefs.helium.services.browser_updates}}"
|
||||
+ label="$i18n{heliumUpdatesToggle}"
|
||||
+ sub-label="$i18n{heliumUpdatesToggleDescription}">
|
||||
+ </settings-toggle-button>
|
||||
</cr-collapse>
|
||||
</div>
|
||||
</template>
|
||||
@@ -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 @@
|
||||
@@ -2002,6 +2002,19 @@
|
||||
<message name="IDS_SETTINGS_HELIUM_SERVICES_SPELLCHECK_TOGGLE_DESCRIPTION" desc="Description of the for enabling/disabling of downloading spellcheck files">
|
||||
Helium will fetch dictionary files used for spell checking when requested. When disabled, spell checking will not work.
|
||||
</message>
|
||||
+ <message name="IDS_SETTINGS_HELIUM_SERVICES_UPDATE" desc="Toggle for automatic update downloads">
|
||||
+ Allow automatic browser updates
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_HELIUM_SERVICES_UPDATE_DESCRIPTION" desc="Description of the toggle for automatic update downloads">
|
||||
+ 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
|
||||
+ </message>
|
||||
+ <if expr="is_macosx">
|
||||
+ <message name="IDS_SETTINGS_HELIUM_SERVICES_UPDATE_DESCRIPTION" desc="Description of the toggle for automatic update downloads">
|
||||
+ 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.
|
||||
+ </message>
|
||||
+ </if>
|
||||
+ <if expr="not is_macosx">
|
||||
+ <message name="IDS_SETTINGS_HELIUM_SERVICES_UPDATE_DESCRIPTION" desc="Description of the toggle for automatic update downloads">
|
||||
+ 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.
|
||||
+ </message>
|
||||
+ </if>
|
||||
<message name="IDS_SETTINGS_HELIUM_SERVICES_OVERRIDE" desc="Text input for overriding the Helium services server">
|
||||
Use your own instance of Helium services
|
||||
</message>
|
||||
|
||||
129
patches/helium/core/component-updates.patch
Normal file
129
patches/helium/core/component-updates.patch
Normal file
@@ -0,0 +1,129 @@
|
||||
--- 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<GURL> 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<GURL> ChromeConfigurator::UpdateUrl() const {
|
||||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
- return configurator_impl_.UpdateUrl();
|
||||
+ return {helium::GetComponentUpdateURL(GetProfilePrefs())};
|
||||
}
|
||||
|
||||
std::vector<GURL> ChromeConfigurator::PingUrl() const {
|
||||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
- return configurator_impl_.PingUrl();
|
||||
+ return {helium::GetComponentUpdateURL(GetProfilePrefs())};
|
||||
}
|
||||
|
||||
std::string ChromeConfigurator::GetProdId() const {
|
||||
@@ -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 {
|
||||
|
||||
@@ -217,10 +217,10 @@
|
||||
if ( bin.assetSourceRegistry instanceof Object ) {
|
||||
--- a/chrome/app/settings_strings.grdp
|
||||
+++ b/chrome/app/settings_strings.grdp
|
||||
@@ -2008,6 +2008,12 @@
|
||||
<message name="IDS_SETTINGS_HELIUM_SERVICES_UPDATE_DESCRIPTION" desc="Description of the toggle for automatic update downloads">
|
||||
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.
|
||||
</message>
|
||||
@@ -2015,6 +2015,12 @@
|
||||
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.
|
||||
</message>
|
||||
</if>
|
||||
+ <message name="IDS_SETTINGS_HELIUM_SERVICES_UBO" desc="Description of the toggle for uBO filter lists">
|
||||
+ Allow downloading filter lists for uBlock Origin
|
||||
+ </message>
|
||||
@@ -232,10 +232,10 @@
|
||||
</message>
|
||||
--- a/chrome/browser/resources/settings/privacy_page/services_page.html
|
||||
+++ b/chrome/browser/resources/settings/privacy_page/services_page.html
|
||||
@@ -108,6 +108,11 @@
|
||||
sub-label="$i18n{heliumUpdatesToggleDescription}">
|
||||
</settings-toggle-button>
|
||||
</if>
|
||||
@@ -106,6 +106,11 @@
|
||||
label="$i18n{heliumUpdatesToggle}"
|
||||
sub-label="$i18n{heliumUpdatesToggleDescription}">
|
||||
</settings-toggle-button>
|
||||
+ <settings-toggle-button id="filterlistToggleButton"
|
||||
+ pref="{{prefs.helium.services.ublock_assets}}"
|
||||
+ label="$i18n{heliumUboToggle}"
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<message name="IDS_SETTINGS_ENABLE_DO_NOT_TRACK_DIALOG_LEARN_MORE_ACCESSIBILITY_LABEL" desc="The accessibility label for a link to learn more about Do Not Track">
|
||||
Learn more about Do Not Track
|
||||
</message>
|
||||
@@ -3213,6 +3216,9 @@
|
||||
@@ -3220,6 +3223,9 @@
|
||||
<message name="IDS_SETTINGS_TRACKING_PROTECTION_SITES_ALLOWED_COOKIES_DESCRIPTION" desc="Description of the section on the Tracking Protection settings page that lets users manage which sites are allowed to use third-party cookies. Explains how to use a wildcard to create an exception for an entire domain.">
|
||||
Affects the sites listed here. Inserting “[*.]” before a domain name creates an exception for the entire domain. For example, adding “[*.]google.com” means that third-party cookies can also be active for mail.google.com, because it’s part of google.com.
|
||||
</message>
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
};
|
||||
--- a/chrome/app/generated_resources.grd
|
||||
+++ b/chrome/app/generated_resources.grd
|
||||
@@ -13441,6 +13441,9 @@ Check your passwords anytime in <ph name
|
||||
@@ -13444,6 +13444,9 @@ Check your passwords anytime in <ph name
|
||||
<message name="IDS_EXTENSIONS_INSTALL_LOCATION_SHARED_MODULE" desc="The text explaining the the installation of the extension was because of extensions that depend on this shared module">
|
||||
Installed because of dependent extension(s).
|
||||
</message>
|
||||
|
||||
@@ -191,6 +191,7 @@ helium/core/webrtc-default-handling-policy.patch
|
||||
helium/core/browser-window-context-menu.patch
|
||||
helium/core/disable-ntp-footer.patch
|
||||
helium/core/tab-cycling-mru.patch
|
||||
helium/core/component-updates.patch
|
||||
|
||||
helium/settings/settings-page-icons.patch
|
||||
helium/settings/move-search-suggest.patch
|
||||
|
||||
Reference in New Issue
Block a user