mirror of
https://github.com/morgan9e/helium
synced 2026-04-14 00:14:20 +09:00
helium/core: add helium services versioning & update alerts (#599)
This commit is contained in:
@@ -101,11 +101,11 @@ def c_all_new_headers_have_correct_guard():
|
||||
for _line in file[0]:
|
||||
line = str(_line)
|
||||
|
||||
if '#ifndef' in line:
|
||||
if expected["ifndef"] in line:
|
||||
assert found["define"] is None
|
||||
assert found["ifndef"] is None
|
||||
found["ifndef"] = line
|
||||
elif '#define' in line:
|
||||
elif expected["define"] in line:
|
||||
assert found["ifndef"] is not None
|
||||
assert found["define"] is None
|
||||
found["define"] = line
|
||||
|
||||
@@ -267,14 +267,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
// Supervised Users. This setting is queried in our Tast tests (b/241943380).
|
||||
--- a/chrome/browser/ui/webui/settings/settings_ui.cc
|
||||
+++ b/chrome/browser/ui/webui/settings/settings_ui.cc
|
||||
@@ -63,6 +63,7 @@
|
||||
#include "chrome/browser/ui/webui/settings/font_handler.h"
|
||||
#include "chrome/browser/ui/webui/settings/hats_handler.h"
|
||||
#include "chrome/browser/ui/webui/settings/import_data_handler.h"
|
||||
@@ -58,6 +58,7 @@
|
||||
#include "chrome/browser/ui/webui/settings/about_handler.h"
|
||||
#include "chrome/browser/ui/webui/settings/accessibility_main_handler.h"
|
||||
#include "chrome/browser/ui/webui/settings/appearance_handler.h"
|
||||
+#include "chrome/browser/ui/webui/settings/brave_import_data_handler.h"
|
||||
#include "chrome/browser/ui/webui/settings/metrics_reporting_handler.h"
|
||||
#include "chrome/browser/ui/webui/settings/on_startup_handler.h"
|
||||
#include "chrome/browser/ui/webui/settings/password_manager_handler.h"
|
||||
#include "chrome/browser/ui/webui/settings/browser_lifetime_handler.h"
|
||||
#include "chrome/browser/ui/webui/settings/downloads_handler.h"
|
||||
#include "chrome/browser/ui/webui/settings/font_handler.h"
|
||||
@@ -203,6 +204,7 @@ void SettingsUI::RegisterProfilePrefs(
|
||||
registry->RegisterBooleanPref(prefs::kImportDialogHistory, true);
|
||||
registry->RegisterBooleanPref(prefs::kImportDialogSavedPasswords, true);
|
||||
|
||||
@@ -700,7 +700,7 @@
|
||||
// Sanity check for https://crbug.com/781703.
|
||||
--- a/components/helium_services/helium_services_helpers.cc
|
||||
+++ b/components/helium_services/helium_services_helpers.cc
|
||||
@@ -66,6 +66,11 @@ bool ShouldAccessExtensionService(const
|
||||
@@ -67,6 +67,11 @@ bool ShouldAccessExtensionService(const
|
||||
prefs.GetBoolean(prefs::kHeliumExtProxyEnabled);
|
||||
}
|
||||
|
||||
@@ -714,9 +714,9 @@
|
||||
return GetDummyURL();
|
||||
--- a/components/helium_services/helium_services_helpers.h
|
||||
+++ b/components/helium_services/helium_services_helpers.h
|
||||
@@ -18,6 +18,7 @@ const char kHeliumDefaultOrigin[] =
|
||||
const char kHeliumDummyOrigin[] =
|
||||
"https://helium-services-are-disabled.qjz9zk";
|
||||
@@ -20,6 +20,7 @@ const char kHeliumDummyOrigin[] =
|
||||
|
||||
bool ShouldAccessServices(const PrefService& prefs);
|
||||
|
||||
+COMPONENT_EXPORT(HELIUM) bool ShouldFetchBangs(const PrefService& prefs);
|
||||
COMPONENT_EXPORT(HELIUM) bool ShouldAccessExtensionService(const PrefService& prefs);
|
||||
@@ -724,19 +724,19 @@
|
||||
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
|
||||
@@ -2125,6 +2125,9 @@ void AddPrivacyStrings(content::WebUIDat
|
||||
{"heliumServicesToggle", IDS_SETTINGS_HELIUM_SERVICES_TOGGLE},
|
||||
{"heliumServicesToggleDescription",
|
||||
IDS_SETTINGS_HELIUM_SERVICES_TOGGLE_DESCRIPTION},
|
||||
@@ -2132,6 +2132,9 @@ void AddPrivacyStrings(content::WebUIDat
|
||||
IDS_SETTINGS_HELIUM_SERVICES_EXT_PROXY_TOGGLE},
|
||||
{"heliumExtProxyToggleDescription",
|
||||
IDS_SETTINGS_HELIUM_SERVICES_EXT_PROXY_TOGGLE_DESCRIPTION},
|
||||
+ {"heliumBangsToggle", IDS_SETTINGS_HELIUM_SERVICES_BANGS_TOGGLE},
|
||||
+ {"heliumBangsToggleDescription",
|
||||
+ IDS_SETTINGS_HELIUM_SERVICES_BANGS_TOGGLE_DESCRIPTION},
|
||||
{"heliumExtProxyToggle",
|
||||
IDS_SETTINGS_HELIUM_SERVICES_EXT_PROXY_TOGGLE},
|
||||
{"heliumExtProxyToggleDescription",
|
||||
{"heliumOriginOverride", IDS_SETTINGS_HELIUM_SERVICES_OVERRIDE},
|
||||
{"heliumOriginOverrideDescription",
|
||||
IDS_SETTINGS_HELIUM_SERVICES_OVERRIDE_DESCRIPTION},
|
||||
--- a/chrome/app/settings_strings.grdp
|
||||
+++ b/chrome/app/settings_strings.grdp
|
||||
@@ -1981,6 +1981,12 @@
|
||||
@@ -1987,6 +1987,12 @@
|
||||
<message name="IDS_SETTINGS_HELIUM_SERVICES_EXT_PROXY_TOGGLE_DESCRIPTION" desc="Description of the toggle for enabling/disabling of downloading and proxying extensions">
|
||||
When enabled, Helium will proxy extension downloads and updates to protect your privacy. When disabled, downloading and updating extensions will not work.
|
||||
</message>
|
||||
@@ -751,7 +751,7 @@
|
||||
</message>
|
||||
--- a/chrome/browser/resources/settings/privacy_page/services_page.html
|
||||
+++ b/chrome/browser/resources/settings/privacy_page/services_page.html
|
||||
@@ -50,6 +50,11 @@
|
||||
@@ -89,6 +89,11 @@
|
||||
label="$i18n{heliumExtProxyToggle}"
|
||||
sub-label="$i18n{heliumExtProxyToggleDescription}">
|
||||
</settings-toggle-button>
|
||||
@@ -765,9 +765,9 @@
|
||||
</template>
|
||||
--- a/chrome/browser/ui/browser_ui_prefs.cc
|
||||
+++ b/chrome/browser/ui/browser_ui_prefs.cc
|
||||
@@ -211,6 +211,7 @@ void RegisterBrowserUserPrefs(user_prefs
|
||||
|
||||
{
|
||||
@@ -213,6 +213,7 @@ void RegisterBrowserUserPrefs(user_prefs
|
||||
registry->RegisterIntegerPref(prefs::kHeliumSchemaVersion, 0);
|
||||
registry->RegisterBooleanPref(prefs::kHeliumDisableSchemaAlerts, false);
|
||||
registry->RegisterBooleanPref(prefs::kHeliumServicesEnabled, true);
|
||||
+ registry->RegisterBooleanPref(prefs::kHeliumBangsEnabled, true);
|
||||
registry->RegisterBooleanPref(prefs::kHeliumExtProxyEnabled, true);
|
||||
@@ -786,7 +786,7 @@
|
||||
(*s_allowlist)[::prefs::kHeliumServicesConsented] =
|
||||
--- a/components/helium_services/pref_names.h
|
||||
+++ b/components/helium_services/pref_names.h
|
||||
@@ -24,6 +24,9 @@ inline constexpr char kHeliumDidOnboardi
|
||||
@@ -30,6 +30,9 @@ inline constexpr char kHeliumDidOnboardi
|
||||
inline constexpr char kHeliumExtProxyEnabled[] =
|
||||
"helium.services.ext_proxy";
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ TODO: guard services_page.html with is_mac
|
||||
|
||||
--- a/components/helium_services/pref_names.h
|
||||
+++ b/components/helium_services/pref_names.h
|
||||
@@ -27,6 +27,9 @@ inline constexpr char kHeliumExtProxyEna
|
||||
@@ -33,6 +33,9 @@ inline constexpr char kHeliumExtProxyEna
|
||||
inline constexpr char kHeliumBangsEnabled[] =
|
||||
"helium.services.bangs";
|
||||
|
||||
@@ -14,7 +14,7 @@ TODO: guard services_page.html with is_mac
|
||||
|
||||
--- a/components/helium_services/helium_services_helpers.h
|
||||
+++ b/components/helium_services/helium_services_helpers.h
|
||||
@@ -20,11 +20,13 @@ const char kHeliumDummyOrigin[] =
|
||||
@@ -22,11 +22,13 @@ bool ShouldAccessServices(const PrefServ
|
||||
|
||||
COMPONENT_EXPORT(HELIUM) bool ShouldFetchBangs(const PrefService& prefs);
|
||||
COMPONENT_EXPORT(HELIUM) bool ShouldAccessExtensionService(const PrefService& prefs);
|
||||
@@ -30,15 +30,7 @@ TODO: guard services_page.html with is_mac
|
||||
PrefChangeRegistrar& registrar, const base::RepeatingClosure& observer);
|
||||
--- a/components/helium_services/helium_services_helpers.cc
|
||||
+++ b/components/helium_services/helium_services_helpers.cc
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <optional>
|
||||
|
||||
#include "base/functional/bind.h"
|
||||
+#include "base/strings/stringprintf.h"
|
||||
#include "components/helium_services/pref_names.h"
|
||||
#include "components/prefs/pref_service.h"
|
||||
#include "net/base/url_util.h"
|
||||
@@ -15,6 +16,12 @@
|
||||
@@ -16,6 +16,12 @@
|
||||
|
||||
namespace helium {
|
||||
|
||||
@@ -51,7 +43,7 @@ TODO: guard services_page.html with is_mac
|
||||
std::optional<GURL> GetValidUserOverridenURL(std::string_view user_url_) {
|
||||
if (user_url_.empty()) {
|
||||
return std::nullopt;
|
||||
@@ -76,6 +83,11 @@ bool ShouldFetchBangs(const PrefService&
|
||||
@@ -77,6 +83,11 @@ bool ShouldFetchBangs(const PrefService&
|
||||
prefs.GetBoolean(prefs::kHeliumBangsEnabled);
|
||||
}
|
||||
|
||||
@@ -63,7 +55,7 @@ TODO: guard services_page.html with is_mac
|
||||
GURL GetExtensionUpdateURL(const PrefService& prefs) {
|
||||
if (!ShouldAccessExtensionService(prefs)) {
|
||||
return GetDummyURL();
|
||||
@@ -101,6 +113,20 @@ GURL GetSpellcheckURL(const PrefService&
|
||||
@@ -102,6 +113,20 @@ GURL GetSpellcheckURL(const PrefService&
|
||||
return GetServicesBaseURL(prefs).Resolve("/dict/");
|
||||
}
|
||||
|
||||
@@ -86,7 +78,7 @@ 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
|
||||
@@ -62,6 +62,13 @@
|
||||
@@ -101,6 +101,13 @@
|
||||
sub-label="$i18n{heliumSpellcheckToggleDescription}">
|
||||
</settings-toggle-button>
|
||||
</if>
|
||||
@@ -102,10 +94,10 @@ TODO: guard services_page.html with is_mac
|
||||
</template>
|
||||
--- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
|
||||
+++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
|
||||
@@ -2135,6 +2135,10 @@ void AddPrivacyStrings(content::WebUIDat
|
||||
IDS_SETTINGS_HELIUM_SERVICES_EXT_PROXY_TOGGLE},
|
||||
{"heliumExtProxyToggleDescription",
|
||||
IDS_SETTINGS_HELIUM_SERVICES_EXT_PROXY_TOGGLE_DESCRIPTION},
|
||||
@@ -2138,6 +2138,10 @@ void AddPrivacyStrings(content::WebUIDat
|
||||
{"heliumSpellcheckToggle", IDS_SETTINGS_HELIUM_SERVICES_SPELLCHECK_TOGGLE},
|
||||
{"heliumSpellcheckToggleDescription",
|
||||
IDS_SETTINGS_HELIUM_SERVICES_SPELLCHECK_TOGGLE_DESCRIPTION},
|
||||
+ {"heliumUpdatesToggle",
|
||||
+ IDS_SETTINGS_HELIUM_SERVICES_UPDATE},
|
||||
+ {"heliumUpdatesToggleDescription",
|
||||
@@ -126,7 +118,7 @@ TODO: guard services_page.html with is_mac
|
||||
(*s_allowlist)[::prefs::kHeliumServicesConsented] =
|
||||
--- a/chrome/browser/ui/browser_ui_prefs.cc
|
||||
+++ b/chrome/browser/ui/browser_ui_prefs.cc
|
||||
@@ -217,6 +217,7 @@ void RegisterBrowserUserPrefs(user_prefs
|
||||
@@ -219,6 +219,7 @@ void RegisterBrowserUserPrefs(user_prefs
|
||||
registry->RegisterStringPref(prefs::kHeliumServicesOrigin, "");
|
||||
registry->RegisterBooleanPref(prefs::kHeliumDidOnboarding, false);
|
||||
registry->RegisterBooleanPref(prefs::kHeliumServicesConsented, false);
|
||||
@@ -136,7 +128,7 @@ TODO: guard services_page.html with is_mac
|
||||
registry->RegisterBooleanPref(
|
||||
--- a/chrome/app/settings_strings.grdp
|
||||
+++ b/chrome/app/settings_strings.grdp
|
||||
@@ -1996,6 +1996,12 @@
|
||||
@@ -2002,6 +2002,12 @@
|
||||
<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>
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
}
|
||||
|
||||
void BrowserCommandController::TabStateChanged() {
|
||||
@@ -1176,6 +1178,14 @@ bool BrowserCommandController::ExecuteCo
|
||||
@@ -1179,6 +1181,14 @@ bool BrowserCommandController::ExecuteCo
|
||||
case IDC_DUPLICATE_TARGET_TAB:
|
||||
DuplicateKeyboardFocusedTab(browser_);
|
||||
break;
|
||||
@@ -66,7 +66,7 @@
|
||||
// Hosted App commands
|
||||
case IDC_COPY_URL:
|
||||
CopyURL(browser_, browser_->tab_strip_model()->GetActiveWebContents());
|
||||
@@ -1926,6 +1936,12 @@ void BrowserCommandController::UpdateCom
|
||||
@@ -1930,6 +1940,12 @@ void BrowserCommandController::UpdateCom
|
||||
|
||||
bool dev_tools_enabled = DevToolsWindow::AllowDevToolsFor(
|
||||
profile(), browser_->tab_strip_model()->GetActiveWebContents());
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/components/helium_services/pref_names.h
|
||||
+++ b/components/helium_services/pref_names.h
|
||||
@@ -7,12 +7,20 @@
|
||||
|
||||
namespace prefs {
|
||||
@@ -13,12 +13,20 @@ inline constexpr char kHeliumSchemaVersi
|
||||
inline constexpr char kHeliumDisableSchemaAlerts[] =
|
||||
"helium.services.disable_schema_alerts";
|
||||
|
||||
+inline constexpr char kHeliumPrefPrefix[] = "helium.";
|
||||
+
|
||||
@@ -23,8 +23,8 @@
|
||||
#endif // COMPONENTS_HELIUM_SERVICES_PREF_NAMES_H_
|
||||
--- a/chrome/browser/ui/browser_ui_prefs.cc
|
||||
+++ b/chrome/browser/ui/browser_ui_prefs.cc
|
||||
@@ -208,6 +208,8 @@ void RegisterBrowserUserPrefs(user_prefs
|
||||
{
|
||||
@@ -210,6 +210,8 @@ void RegisterBrowserUserPrefs(user_prefs
|
||||
registry->RegisterBooleanPref(prefs::kHeliumDisableSchemaAlerts, false);
|
||||
registry->RegisterBooleanPref(prefs::kHeliumServicesEnabled, true);
|
||||
registry->RegisterStringPref(prefs::kHeliumServicesOrigin, "");
|
||||
+ registry->RegisterBooleanPref(prefs::kHeliumDidOnboarding, false);
|
||||
@@ -160,36 +160,36 @@
|
||||
+
|
||||
+#include "chrome/browser/profiles/profile.h"
|
||||
+#include "chrome/browser/ui/webui/onboarding/onboarding_handler.h"
|
||||
+#include "chrome/browser/ui/webui/settings/brave_import_data_handler.h"
|
||||
+#include "chrome/browser/ui/webui/settings/search_engines_handler.h"
|
||||
+#include "chrome/browser/ui/webui/settings/settings_default_browser_handler.h"
|
||||
+#include "chrome/browser/ui/webui/settings/brave_import_data_handler.h"
|
||||
+#include "chrome/common/webui_url_constants.h"
|
||||
+#include "content/public/browser/web_ui_controller.h"
|
||||
+#include "content/public/browser/web_ui_data_source.h"
|
||||
+#include "components/helium_onboarding/resources/grit/helium_onboarding_generated.h"
|
||||
+#include "components/helium_onboarding/resources/grit/helium_onboarding_generated_map.h"
|
||||
+#include "content/public/browser/web_ui_controller.h"
|
||||
+#include "content/public/browser/web_ui_data_source.h"
|
||||
+#include "ui/webui/webui_util.h"
|
||||
+
|
||||
+HeliumOnboardingPage::HeliumOnboardingPage(content::WebUI* web_ui) : WebUIController(web_ui) {
|
||||
+ Profile* profile = Profile::FromWebUI(web_ui);
|
||||
+ content::WebUIDataSource* source =
|
||||
+ content::WebUIDataSource::CreateAndAdd(profile, chrome::kHeliumSetupHost);
|
||||
+HeliumOnboardingPage::HeliumOnboardingPage(content::WebUI* web_ui)
|
||||
+ : WebUIController(web_ui) {
|
||||
+ Profile* profile = Profile::FromWebUI(web_ui);
|
||||
+ content::WebUIDataSource* source =
|
||||
+ content::WebUIDataSource::CreateAndAdd(profile, chrome::kHeliumSetupHost);
|
||||
+
|
||||
+ webui::SetupWebUIDataSource(
|
||||
+ source, kHeliumOnboardingGenerated,
|
||||
+ IDR_HELIUM_ONBOARDING_INDEX_HTML);
|
||||
+ webui::SetupWebUIDataSource(source, kHeliumOnboardingGenerated,
|
||||
+ IDR_HELIUM_ONBOARDING_INDEX_HTML);
|
||||
+
|
||||
+ source->UseStringsJs();
|
||||
+ source->DisableTrustedTypesCSP();
|
||||
+ source->UseStringsJs();
|
||||
+ source->DisableTrustedTypesCSP();
|
||||
+
|
||||
+ web_ui->AddMessageHandler(
|
||||
+ std::make_unique<OnboardingMessageHandler>(profile));
|
||||
+ web_ui->AddMessageHandler(
|
||||
+ std::make_unique<settings::SearchEnginesHandler>(profile));
|
||||
+ web_ui->AddMessageHandler(
|
||||
+ std::make_unique<settings::DefaultBrowserHandler>());
|
||||
+ web_ui->AddMessageHandler(
|
||||
+ std::make_unique<settings::BraveImportDataHandler>());
|
||||
+ web_ui->AddMessageHandler(
|
||||
+ std::make_unique<OnboardingMessageHandler>(profile));
|
||||
+ web_ui->AddMessageHandler(
|
||||
+ std::make_unique<settings::SearchEnginesHandler>(profile));
|
||||
+ web_ui->AddMessageHandler(
|
||||
+ std::make_unique<settings::DefaultBrowserHandler>());
|
||||
+ web_ui->AddMessageHandler(
|
||||
+ std::make_unique<settings::BraveImportDataHandler>());
|
||||
+}
|
||||
+
|
||||
+HeliumOnboardingPage::~HeliumOnboardingPage() = default;
|
||||
@@ -204,8 +204,8 @@
|
||||
+#define CHROME_BROWSER_UI_WEBUI_ONBOARDING_ONBOARDING_PAGE_UI_H_
|
||||
+
|
||||
+#include "chrome/common/webui_url_constants.h"
|
||||
+#include "content/public/browser/webui_config.h"
|
||||
+#include "content/public/browser/web_ui_controller.h"
|
||||
+#include "content/public/browser/webui_config.h"
|
||||
+
|
||||
+class HeliumOnboardingPage;
|
||||
+
|
||||
@@ -213,23 +213,23 @@
|
||||
+ : public content::DefaultWebUIConfig<HeliumOnboardingPage> {
|
||||
+ public:
|
||||
+ HeliumOnboardingPageConfig()
|
||||
+ : DefaultWebUIConfig(content::kChromeUIScheme,
|
||||
+ chrome::kHeliumSetupHost) {}
|
||||
+ : DefaultWebUIConfig(content::kChromeUIScheme, chrome::kHeliumSetupHost) {
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+class HeliumOnboardingPage : public content::WebUIController {
|
||||
+public:
|
||||
+ explicit HeliumOnboardingPage(content::WebUI* web_ui);
|
||||
+ public:
|
||||
+ explicit HeliumOnboardingPage(content::WebUI* web_ui);
|
||||
+
|
||||
+ HeliumOnboardingPage(const HeliumOnboardingPage&) = delete;
|
||||
+ HeliumOnboardingPage& operator=(const HeliumOnboardingPage&) = delete;
|
||||
+ ~HeliumOnboardingPage() override;
|
||||
+ HeliumOnboardingPage(const HeliumOnboardingPage&) = delete;
|
||||
+ HeliumOnboardingPage& operator=(const HeliumOnboardingPage&) = delete;
|
||||
+ ~HeliumOnboardingPage() override;
|
||||
+};
|
||||
+
|
||||
+#endif // CHROME_BROWSER_UI_WEBUI_ONBOARDING_ONBOARDING_PAGE_UI_H_
|
||||
+#endif // CHROME_BROWSER_UI_WEBUI_ONBOARDING_ONBOARDING_PAGE_UI_H_
|
||||
--- /dev/null
|
||||
+++ b/chrome/browser/ui/webui/onboarding/onboarding_handler.cc
|
||||
@@ -0,0 +1,190 @@
|
||||
@@ -0,0 +1,188 @@
|
||||
+// Copyright 2025 The Helium Authors
|
||||
+// You can use, redistribute, and/or modify this source code under
|
||||
+// the terms of the GPL-3.0 license that can be found in the LICENSE file.
|
||||
@@ -248,6 +248,7 @@
|
||||
+#include "chrome/browser/themes/theme_service_factory.h"
|
||||
+#include "chrome/browser/ui/color/chrome_color_id.h"
|
||||
+#include "components/helium_services/pref_names.h"
|
||||
+#include "components/helium_services/schema.h"
|
||||
+#include "components/prefs/pref_change_registrar.h"
|
||||
+#include "components/prefs/pref_service.h"
|
||||
+#include "content/public/browser/web_contents.h"
|
||||
@@ -255,174 +256,171 @@
|
||||
+#include "ui/gfx/color_utils.h"
|
||||
+
|
||||
+OnboardingMessageHandler::OnboardingMessageHandler(Profile* profile)
|
||||
+ : profile_(profile),
|
||||
+ pref_service_(profile->GetPrefs()) {
|
||||
+ pref_change_registrar_.Init(pref_service_);
|
||||
+ : profile_(profile), pref_service_(profile->GetPrefs()) {
|
||||
+ pref_change_registrar_.Init(pref_service_);
|
||||
+
|
||||
+ for (const auto [ key, _ ] : GetPreferencesDict()) {
|
||||
+ pref_change_registrar_.Add(
|
||||
+ prefs::kHeliumPrefPrefix + key,
|
||||
+ base::BindRepeating(
|
||||
+ &OnboardingMessageHandler::OnPreferencesChanged,
|
||||
+ base::Unretained(this)
|
||||
+ )
|
||||
+ );
|
||||
+ }
|
||||
+ for (const auto [key, _] : GetPreferencesDict()) {
|
||||
+ pref_change_registrar_.Add(
|
||||
+ prefs::kHeliumPrefPrefix + key,
|
||||
+ base::BindRepeating(&OnboardingMessageHandler::OnPreferencesChanged,
|
||||
+ base::Unretained(this)));
|
||||
+ }
|
||||
+
|
||||
+ ThemeServiceFactory::GetForProfile(profile_)->AddObserver(this);
|
||||
+ ThemeServiceFactory::GetForProfile(profile_)->AddObserver(this);
|
||||
+}
|
||||
+
|
||||
+OnboardingMessageHandler::~OnboardingMessageHandler() {
|
||||
+ ThemeServiceFactory::GetForProfile(profile_)->RemoveObserver(this);
|
||||
+ ThemeServiceFactory::GetForProfile(profile_)->RemoveObserver(this);
|
||||
+}
|
||||
+
|
||||
+base::Value::Dict OnboardingMessageHandler::GetPreferencesDict() {
|
||||
+ std::vector<PrefService::PreferenceValueAndStore> values =
|
||||
+ pref_service_->GetPreferencesValueAndStore();
|
||||
+ base::Value::Dict output;
|
||||
+ std::vector<PrefService::PreferenceValueAndStore> values =
|
||||
+ pref_service_->GetPreferencesValueAndStore();
|
||||
+ base::Value::Dict output;
|
||||
+
|
||||
+ for (const auto& [name, value, _] : values) {
|
||||
+ if (!base::StartsWith(name, prefs::kHeliumPrefPrefix,
|
||||
+ base::CompareCase::SENSITIVE)) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ output.Set(
|
||||
+ name.substr(sizeof(prefs::kHeliumPrefPrefix) - 1),
|
||||
+ value.Clone()
|
||||
+ );
|
||||
+ for (const auto& [name, value, _] : values) {
|
||||
+ if (!base::StartsWith(name, prefs::kHeliumPrefPrefix,
|
||||
+ base::CompareCase::SENSITIVE)) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ return output;
|
||||
+ output.Set(name.substr(sizeof(prefs::kHeliumPrefPrefix) - 1),
|
||||
+ value.Clone());
|
||||
+ }
|
||||
+
|
||||
+ return output;
|
||||
+}
|
||||
+
|
||||
+void OnboardingMessageHandler::OnThemeChanged() {
|
||||
+ AllowJavascript();
|
||||
+ FireWebUIListener("ntp-background-changed", GetNTPBackgroundColor());
|
||||
+ AllowJavascript();
|
||||
+ FireWebUIListener("ntp-background-changed", GetNTPBackgroundColor());
|
||||
+}
|
||||
+
|
||||
+void OnboardingMessageHandler::OnPreferencesChanged() {
|
||||
+ AllowJavascript();
|
||||
+ FireWebUIListener("helium-prefs-changed", GetPreferencesDict());
|
||||
+ AllowJavascript();
|
||||
+ FireWebUIListener("helium-prefs-changed", GetPreferencesDict());
|
||||
+}
|
||||
+
|
||||
+void OnboardingMessageHandler::RegisterMessages() {
|
||||
+ web_ui()->RegisterMessageCallback(
|
||||
+ "getPrefs",
|
||||
+ base::BindRepeating(&OnboardingMessageHandler::HandleGetPreferences,
|
||||
+ base::Unretained(this)));
|
||||
+
|
||||
+ web_ui()->RegisterMessageCallback(
|
||||
+ "setPref",
|
||||
+ base::BindRepeating(&OnboardingMessageHandler::HandleSetPreference,
|
||||
+ base::Unretained(this)));
|
||||
+
|
||||
+ web_ui()->RegisterMessageCallback(
|
||||
+ "getProfileName",
|
||||
+ base::BindRepeating(&OnboardingMessageHandler::HandleGetProfileName,
|
||||
+ base::Unretained(this)));
|
||||
+
|
||||
+ web_ui()->RegisterMessageCallback(
|
||||
+ "setProfileName",
|
||||
+ base::BindRepeating(&OnboardingMessageHandler::HandleSetProfileName,
|
||||
+ base::Unretained(this)));
|
||||
+
|
||||
+ web_ui()->RegisterMessageCallback(
|
||||
+ "getBackgroundColor",
|
||||
+ base::BindRepeating(&OnboardingMessageHandler::HandleGetBackgroundColor,
|
||||
+ base::Unretained(this)));
|
||||
+ web_ui()->RegisterMessageCallback(
|
||||
+ "getPrefs",
|
||||
+ base::BindRepeating(&OnboardingMessageHandler::HandleGetPreferences,
|
||||
+ base::Unretained(this)));
|
||||
+ web_ui()->RegisterMessageCallback(
|
||||
+ "setPref",
|
||||
+ base::BindRepeating(&OnboardingMessageHandler::HandleSetPreference,
|
||||
+ base::Unretained(this)));
|
||||
+ web_ui()->RegisterMessageCallback(
|
||||
+ "acceptLatestSchema",
|
||||
+ base::BindRepeating(&OnboardingMessageHandler::HandleAcceptSchema,
|
||||
+ base::Unretained(this)));
|
||||
+ web_ui()->RegisterMessageCallback(
|
||||
+ "getProfileName",
|
||||
+ base::BindRepeating(&OnboardingMessageHandler::HandleGetProfileName,
|
||||
+ base::Unretained(this)));
|
||||
+ web_ui()->RegisterMessageCallback(
|
||||
+ "setProfileName",
|
||||
+ base::BindRepeating(&OnboardingMessageHandler::HandleSetProfileName,
|
||||
+ base::Unretained(this)));
|
||||
+ web_ui()->RegisterMessageCallback(
|
||||
+ "getBackgroundColor",
|
||||
+ base::BindRepeating(&OnboardingMessageHandler::HandleGetBackgroundColor,
|
||||
+ base::Unretained(this)));
|
||||
+}
|
||||
+
|
||||
+base::Value OnboardingMessageHandler::GetNTPBackgroundColor() {
|
||||
+ return base::Value(
|
||||
+ color_utils::SkColorToRgbaString(
|
||||
+ web_ui()
|
||||
+ ->GetWebContents()
|
||||
+ ->GetColorProvider().GetColor(kColorNewTabPageBackground)
|
||||
+ )
|
||||
+ );
|
||||
+ return base::Value(color_utils::SkColorToRgbaString(
|
||||
+ web_ui()->GetWebContents()->GetColorProvider().GetColor(
|
||||
+ kColorNewTabPageBackground)));
|
||||
+}
|
||||
+
|
||||
+void OnboardingMessageHandler::HandleGetBackgroundColor(const base::Value::List& args) {
|
||||
+ CHECK_EQ(1U, args.size());
|
||||
+ const auto& callback_id = args[0].GetString();
|
||||
+void OnboardingMessageHandler::HandleGetBackgroundColor(
|
||||
+ const base::Value::List& args) {
|
||||
+ CHECK_EQ(1U, args.size());
|
||||
+ const auto& callback_id = args[0].GetString();
|
||||
+
|
||||
+ AllowJavascript();
|
||||
+ ResolveJavascriptCallback(
|
||||
+ base::Value(callback_id), GetNTPBackgroundColor());
|
||||
+ AllowJavascript();
|
||||
+ ResolveJavascriptCallback(base::Value(callback_id), GetNTPBackgroundColor());
|
||||
+}
|
||||
+
|
||||
+void OnboardingMessageHandler::HandleGetPreferences(const base::Value::List& args) {
|
||||
+ CHECK_EQ(1U, args.size());
|
||||
+ const auto& callback_id = args[0].GetString();
|
||||
+void OnboardingMessageHandler::HandleGetPreferences(
|
||||
+ const base::Value::List& args) {
|
||||
+ CHECK_EQ(1U, args.size());
|
||||
+ const auto& callback_id = args[0].GetString();
|
||||
+
|
||||
+ AllowJavascript();
|
||||
+ ResolveJavascriptCallback(
|
||||
+ base::Value(callback_id), base::Value(GetPreferencesDict()));
|
||||
+ AllowJavascript();
|
||||
+ ResolveJavascriptCallback(base::Value(callback_id),
|
||||
+ base::Value(GetPreferencesDict()));
|
||||
+}
|
||||
+
|
||||
+void OnboardingMessageHandler::HandleGetProfileName(const base::Value::List& args) {
|
||||
+ CHECK_EQ(1U, args.size());
|
||||
+ const auto& callback_id = args[0].GetString();
|
||||
+void OnboardingMessageHandler::HandleGetProfileName(
|
||||
+ const base::Value::List& args) {
|
||||
+ CHECK_EQ(1U, args.size());
|
||||
+ const auto& callback_id = args[0].GetString();
|
||||
+
|
||||
+ ProfileAttributesEntry* entry =
|
||||
+ g_browser_process->profile_manager()
|
||||
+ ->GetProfileAttributesStorage()
|
||||
+ .GetProfileAttributesWithPath(profile_->GetPath());
|
||||
+ ProfileAttributesEntry* entry =
|
||||
+ g_browser_process->profile_manager()
|
||||
+ ->GetProfileAttributesStorage()
|
||||
+ .GetProfileAttributesWithPath(profile_->GetPath());
|
||||
+
|
||||
+ if (!entry) {
|
||||
+ return RejectJavascriptCallback(callback_id, "entry not found");
|
||||
+ }
|
||||
+ if (!entry) {
|
||||
+ return RejectJavascriptCallback(callback_id, "entry not found");
|
||||
+ }
|
||||
+
|
||||
+ AllowJavascript();
|
||||
+ ResolveJavascriptCallback(
|
||||
+ base::Value(callback_id),
|
||||
+ base::Value(entry->GetLocalProfileName()));
|
||||
+ AllowJavascript();
|
||||
+ ResolveJavascriptCallback(base::Value(callback_id),
|
||||
+ base::Value(entry->GetLocalProfileName()));
|
||||
+}
|
||||
+
|
||||
+void OnboardingMessageHandler::HandleSetProfileName(const base::Value::List& args) {
|
||||
+ CHECK_EQ(1U, args.size());
|
||||
+ std::u16string new_name = base::UTF8ToUTF16(args[0].GetString());
|
||||
+ base::TrimWhitespace(new_name, base::TRIM_ALL, &new_name);
|
||||
+void OnboardingMessageHandler::HandleSetProfileName(
|
||||
+ const base::Value::List& args) {
|
||||
+ CHECK_EQ(1U, args.size());
|
||||
+ std::u16string new_name = base::UTF8ToUTF16(args[0].GetString());
|
||||
+ base::TrimWhitespace(new_name, base::TRIM_ALL, &new_name);
|
||||
+
|
||||
+ if (!new_name.empty()) {
|
||||
+ profiles::UpdateProfileName(profile_, new_name);
|
||||
+ }
|
||||
+ if (!new_name.empty()) {
|
||||
+ profiles::UpdateProfileName(profile_, new_name);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void OnboardingMessageHandler::HandleSetPreference(const base::Value::List& args) {
|
||||
+ if (args.size() == 0) {
|
||||
+ return;
|
||||
+ }
|
||||
+void OnboardingMessageHandler::HandleSetPreference(
|
||||
+ const base::Value::List& args) {
|
||||
+ if (args.size() == 0) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ AllowJavascript();
|
||||
+ AllowJavascript();
|
||||
+
|
||||
+ const auto& callback_id = args[0].GetString();
|
||||
+ if (args.size() != 3) {
|
||||
+ return RejectJavascriptCallback(callback_id, "invalid arguments");
|
||||
+ }
|
||||
+ const auto& callback_id = args[0].GetString();
|
||||
+ if (args.size() != 3) {
|
||||
+ return RejectJavascriptCallback(callback_id, "invalid arguments");
|
||||
+ }
|
||||
+
|
||||
+ if (!args[1].is_string()) {
|
||||
+ return RejectJavascriptCallback(callback_id, "pref is not a string");
|
||||
+ }
|
||||
+ if (!args[1].is_string()) {
|
||||
+ return RejectJavascriptCallback(callback_id, "pref is not a string");
|
||||
+ }
|
||||
+
|
||||
+ const auto& pref_name = prefs::kHeliumPrefPrefix + args[1].GetString();
|
||||
+ auto* pref = pref_service_->FindPreference(pref_name);
|
||||
+ if (!pref) {
|
||||
+ return RejectJavascriptCallback(callback_id, pref_name + " does not exist");
|
||||
+ }
|
||||
+ const auto& pref_name = prefs::kHeliumPrefPrefix + args[1].GetString();
|
||||
+ auto* pref = pref_service_->FindPreference(pref_name);
|
||||
+ if (!pref) {
|
||||
+ return RejectJavascriptCallback(callback_id, pref_name + " does not exist");
|
||||
+ }
|
||||
+
|
||||
+ if (args[2].type() != pref->GetType()) {
|
||||
+ return RejectJavascriptCallback(callback_id, "invalid value type");
|
||||
+ }
|
||||
+ if (args[2].type() != pref->GetType()) {
|
||||
+ return RejectJavascriptCallback(callback_id, "invalid value type");
|
||||
+ }
|
||||
+
|
||||
+ pref_service_->Set(pref_name, args[2].Clone());
|
||||
+ pref_service_->Set(pref_name, args[2].Clone());
|
||||
+
|
||||
+ ResolveJavascriptCallback(callback_id, {});
|
||||
+ ResolveJavascriptCallback(callback_id, {});
|
||||
+}
|
||||
+
|
||||
+void OnboardingMessageHandler::HandleAcceptSchema(const base::Value::List&) {
|
||||
+ helium::AcceptCurrentSchema(*pref_service_);
|
||||
+}
|
||||
--- /dev/null
|
||||
+++ b/chrome/browser/ui/webui/onboarding/onboarding_handler.h
|
||||
@@ -0,0 +1,51 @@
|
||||
@@ -0,0 +1,52 @@
|
||||
+// Copyright 2025 The Helium Authors
|
||||
+// You can use, redistribute, and/or modify this source code under
|
||||
+// the terms of the GPL-3.0 license that can be found in the LICENSE file.
|
||||
@@ -437,10 +435,10 @@
|
||||
+#include "base/memory/weak_ptr.h"
|
||||
+#include "base/values.h"
|
||||
+#include "chrome/browser/profiles/profile.h"
|
||||
+#include "components/prefs/pref_service.h"
|
||||
+#include "components/prefs/pref_change_registrar.h"
|
||||
+#include "content/public/browser/web_ui_message_handler.h"
|
||||
+#include "chrome/browser/themes/theme_service_observer.h"
|
||||
+#include "components/prefs/pref_change_registrar.h"
|
||||
+#include "components/prefs/pref_service.h"
|
||||
+#include "content/public/browser/web_ui_message_handler.h"
|
||||
+
|
||||
+class OnboardingMessageHandler : public content::WebUIMessageHandler,
|
||||
+ public ThemeServiceObserver {
|
||||
@@ -455,6 +453,7 @@
|
||||
+ private:
|
||||
+ base::Value::Dict GetPreferencesDict();
|
||||
+ void HandleGetPreferences(const base::Value::List& args);
|
||||
+ void HandleAcceptSchema(const base::Value::List& args);
|
||||
+ void HandleSetPreference(const base::Value::List& args);
|
||||
+ void HandleGetProfileName(const base::Value::List& args);
|
||||
+ void HandleSetProfileName(const base::Value::List& args);
|
||||
@@ -473,7 +472,7 @@
|
||||
+ base::WeakPtrFactory<OnboardingMessageHandler> weak_ptr_factory_{this};
|
||||
+};
|
||||
+
|
||||
+#endif // CHROME_BROWSER_UI_WEBUI_ONBOARDING_ONBOARDING_HANDLER_H_
|
||||
+#endif // CHROME_BROWSER_UI_WEBUI_ONBOARDING_ONBOARDING_HANDLER_H_
|
||||
--- a/components/helium_services/helium_services_helpers.cc
|
||||
+++ b/components/helium_services/helium_services_helpers.cc
|
||||
@@ -53,12 +53,18 @@ GURL GetDummyURL() {
|
||||
@@ -494,8 +493,8 @@
|
||||
registrar.Add(prefs::kHeliumServicesEnabled, observer);
|
||||
+ registrar.Add(prefs::kHeliumServicesConsented, observer);
|
||||
registrar.Add(prefs::kHeliumServicesOrigin, observer);
|
||||
registrar.Add(prefs::kHeliumSchemaVersion, observer);
|
||||
registrar.Add(pref_name, observer);
|
||||
}
|
||||
--- a/chrome/browser/ui/incognito_allowed_url.cc
|
||||
+++ b/chrome/browser/ui/incognito_allowed_url.cc
|
||||
@@ -48,7 +48,8 @@ bool IsHostAllowedInIncognito(const GURL
|
||||
@@ -533,9 +532,9 @@
|
||||
|
||||
--- a/chrome/app/settings_strings.grdp
|
||||
+++ b/chrome/app/settings_strings.grdp
|
||||
@@ -1947,6 +1947,12 @@
|
||||
<message name="IDS_SETTINGS_HELIUM_SERVICES_DESCRIPTION" desc="Description of the controls available on the Helium services settings page">
|
||||
Manage what Helium services are allowed in your browser
|
||||
@@ -1953,6 +1953,12 @@
|
||||
<message name="IDS_SETTINGS_HELIUM_SCHEMA_IGNORE" desc="Checkbox label to ignore any future services change alerts">
|
||||
Don't notify me again
|
||||
</message>
|
||||
+ <message name="IDS_SETTINGS_HELIUM_SERVICES_SETUP_PENDING_TEXT" desc="Description shown in services settings when user has not completed onboarding">
|
||||
+ Helium services are not available until setup is complete to ensure your privacy and consent.
|
||||
@@ -559,9 +558,9 @@
|
||||
(*s_allowlist)[::prefs::kPrivacyGuideViewed] =
|
||||
--- a/chrome/browser/resources/settings/privacy_page/services_page.html
|
||||
+++ b/chrome/browser/resources/settings/privacy_page/services_page.html
|
||||
@@ -2,10 +2,42 @@
|
||||
.label-wrapper {
|
||||
padding: var(--cr-section-vertical-padding) 0;
|
||||
@@ -25,10 +25,42 @@
|
||||
margin-top: var(--cr-changelog-padding);
|
||||
padding-top: calc(var(--cr-changelog-padding) / 2);
|
||||
}
|
||||
+
|
||||
+ #onboarding-link {
|
||||
@@ -599,10 +598,10 @@
|
||||
+ </template>
|
||||
+
|
||||
+ <template is="dom-if" if="[[prefs.helium.services.user_consented.value]]">
|
||||
<settings-toggle-button id="servicesToggleButton"
|
||||
pref="{{prefs.helium.services.enabled}}"
|
||||
label="$i18n{heliumServicesToggle}"
|
||||
@@ -15,6 +47,7 @@
|
||||
<template is="dom-if" if="[[changes_.length]]">
|
||||
<div id="changelog-notice">
|
||||
<div id="changelog-title">$i18n{heliumSchemaUpdatedTitle}</div>
|
||||
@@ -54,6 +86,7 @@
|
||||
<cr-collapse id="servicesCollapse" opened="[[prefs.helium.services.enabled.value]]">
|
||||
</cr-collapse>
|
||||
</div>
|
||||
|
||||
@@ -177,9 +177,9 @@
|
||||
(*s_allowlist)[::prefs::kHeliumServicesConsented] =
|
||||
--- a/chrome/browser/ui/browser_ui_prefs.cc
|
||||
+++ b/chrome/browser/ui/browser_ui_prefs.cc
|
||||
@@ -211,6 +211,7 @@ void RegisterBrowserUserPrefs(user_prefs
|
||||
|
||||
{
|
||||
@@ -213,6 +213,7 @@ void RegisterBrowserUserPrefs(user_prefs
|
||||
registry->RegisterIntegerPref(prefs::kHeliumSchemaVersion, 0);
|
||||
registry->RegisterBooleanPref(prefs::kHeliumDisableSchemaAlerts, false);
|
||||
registry->RegisterBooleanPref(prefs::kHeliumServicesEnabled, true);
|
||||
+ registry->RegisterBooleanPref(prefs::kHeliumExtProxyEnabled, true);
|
||||
registry->RegisterStringPref(prefs::kHeliumServicesOrigin, "");
|
||||
@@ -187,7 +187,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
|
||||
@@ -45,6 +45,11 @@
|
||||
@@ -84,6 +84,11 @@
|
||||
</settings-toggle-button>
|
||||
<div class="cr-col">
|
||||
<cr-collapse id="servicesCollapse" opened="[[prefs.helium.services.enabled.value]]">
|
||||
@@ -201,10 +201,10 @@
|
||||
</template>
|
||||
--- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
|
||||
+++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
|
||||
@@ -2125,6 +2125,10 @@ void AddPrivacyStrings(content::WebUIDat
|
||||
{"heliumServicesToggle", IDS_SETTINGS_HELIUM_SERVICES_TOGGLE},
|
||||
{"heliumServicesToggleDescription",
|
||||
IDS_SETTINGS_HELIUM_SERVICES_TOGGLE_DESCRIPTION},
|
||||
@@ -2128,6 +2128,10 @@ void AddPrivacyStrings(content::WebUIDat
|
||||
{"heliumSchemaUpdatedTitle", IDS_SETTINGS_HELIUM_SCHEMA_NOTICE_TITLE},
|
||||
{"heliumGotIt", IDS_SETTINGS_GOT_IT},
|
||||
{"heliumSchemaIgnore", IDS_SETTINGS_HELIUM_SCHEMA_IGNORE},
|
||||
+ {"heliumExtProxyToggle",
|
||||
+ IDS_SETTINGS_HELIUM_SERVICES_EXT_PROXY_TOGGLE},
|
||||
+ {"heliumExtProxyToggleDescription",
|
||||
@@ -214,7 +214,7 @@
|
||||
IDS_SETTINGS_HELIUM_SERVICES_OVERRIDE_DESCRIPTION},
|
||||
--- a/chrome/app/settings_strings.grdp
|
||||
+++ b/chrome/app/settings_strings.grdp
|
||||
@@ -1975,6 +1975,12 @@
|
||||
@@ -1981,6 +1981,12 @@
|
||||
<message name="IDS_SETTINGS_HELIUM_SERVICES_TOGGLE_DESCRIPTION" desc="Description of the toggle for enabling/disabling of all Helium services">
|
||||
When enabled, Helium will be able to connect to anonymous web services to provide additional functionality. When disabled, additional features will not work.
|
||||
</message>
|
||||
@@ -229,7 +229,7 @@
|
||||
</message>
|
||||
--- a/components/helium_services/pref_names.h
|
||||
+++ b/components/helium_services/pref_names.h
|
||||
@@ -21,6 +21,9 @@ inline constexpr char kHeliumServicesCon
|
||||
@@ -27,6 +27,9 @@ inline constexpr char kHeliumServicesCon
|
||||
inline constexpr char kHeliumDidOnboarding[] =
|
||||
"helium.completed_onboarding";
|
||||
|
||||
@@ -241,7 +241,15 @@
|
||||
#endif // COMPONENTS_HELIUM_SERVICES_PREF_NAMES_H_
|
||||
--- a/components/helium_services/helium_services_helpers.cc
|
||||
+++ b/components/helium_services/helium_services_helpers.cc
|
||||
@@ -61,6 +61,28 @@ bool ShouldAccessServices(const PrefServ
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <optional>
|
||||
|
||||
#include "base/functional/bind.h"
|
||||
+#include "base/strings/stringprintf.h"
|
||||
#include "components/helium_services/pref_names.h"
|
||||
#include "components/prefs/pref_service.h"
|
||||
#include "net/base/url_util.h"
|
||||
@@ -61,6 +62,28 @@ bool ShouldAccessServices(const PrefServ
|
||||
|| prefs.HasPrefPath(prefs::kHeliumServicesEnabled));
|
||||
}
|
||||
|
||||
@@ -272,9 +280,9 @@
|
||||
registrar.Add(prefs::kHeliumServicesEnabled, observer);
|
||||
--- a/components/helium_services/helium_services_helpers.h
|
||||
+++ b/components/helium_services/helium_services_helpers.h
|
||||
@@ -18,8 +18,11 @@ const char kHeliumDefaultOrigin[] =
|
||||
const char kHeliumDummyOrigin[] =
|
||||
"https://helium-services-are-disabled.qjz9zk";
|
||||
@@ -20,8 +20,11 @@ const char kHeliumDummyOrigin[] =
|
||||
|
||||
bool ShouldAccessServices(const PrefService& prefs);
|
||||
|
||||
+COMPONENT_EXPORT(HELIUM) bool ShouldAccessExtensionService(const PrefService& prefs);
|
||||
COMPONENT_EXPORT(HELIUM) GURL GetServicesBaseURL(const PrefService& prefs);
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
--- a/components/helium_services/helium_services_helpers.cc
|
||||
+++ b/components/helium_services/helium_services_helpers.cc
|
||||
@@ -66,6 +66,11 @@ bool ShouldAccessExtensionService(const
|
||||
@@ -67,6 +67,11 @@ bool ShouldAccessExtensionService(const
|
||||
prefs.GetBoolean(prefs::kHeliumExtProxyEnabled);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
bool ShouldFetchBangs(const PrefService& prefs) {
|
||||
return ShouldAccessServices(prefs) &&
|
||||
prefs.GetBoolean(prefs::kHeliumBangsEnabled);
|
||||
@@ -88,6 +93,14 @@ GURL GetWebstoreSnippetURL(const PrefSer
|
||||
@@ -89,6 +94,14 @@ GURL GetWebstoreSnippetURL(const PrefSer
|
||||
base::StringPrintf("/ext/cws_snippet?id=%s", id));
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
registrar.Add(prefs::kHeliumServicesEnabled, observer);
|
||||
--- a/components/helium_services/helium_services_helpers.h
|
||||
+++ b/components/helium_services/helium_services_helpers.h
|
||||
@@ -24,6 +24,7 @@ COMPONENT_EXPORT(HELIUM) GURL GetService
|
||||
@@ -26,6 +26,7 @@ COMPONENT_EXPORT(HELIUM) GURL GetService
|
||||
COMPONENT_EXPORT(HELIUM) GURL GetDummyURL();
|
||||
COMPONENT_EXPORT(HELIUM) GURL GetExtensionUpdateURL(const PrefService& prefs);
|
||||
COMPONENT_EXPORT(HELIUM) GURL GetWebstoreSnippetURL(const PrefService& prefs, std::string_view id);
|
||||
@@ -84,7 +84,7 @@
|
||||
PrefChangeRegistrar& registrar, const base::RepeatingClosure& observer);
|
||||
--- a/components/helium_services/pref_names.h
|
||||
+++ b/components/helium_services/pref_names.h
|
||||
@@ -27,6 +27,9 @@ inline constexpr char kHeliumExtProxyEna
|
||||
@@ -33,6 +33,9 @@ inline constexpr char kHeliumExtProxyEna
|
||||
inline constexpr char kHeliumBangsEnabled[] =
|
||||
"helium.services.bangs";
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
(*s_allowlist)[::prefs::kHeliumServicesConsented] =
|
||||
--- a/chrome/browser/ui/browser_ui_prefs.cc
|
||||
+++ b/chrome/browser/ui/browser_ui_prefs.cc
|
||||
@@ -213,6 +213,7 @@ void RegisterBrowserUserPrefs(user_prefs
|
||||
@@ -215,6 +215,7 @@ void RegisterBrowserUserPrefs(user_prefs
|
||||
registry->RegisterBooleanPref(prefs::kHeliumServicesEnabled, true);
|
||||
registry->RegisterBooleanPref(prefs::kHeliumBangsEnabled, true);
|
||||
registry->RegisterBooleanPref(prefs::kHeliumExtProxyEnabled, true);
|
||||
@@ -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
|
||||
@@ -55,6 +55,13 @@
|
||||
@@ -94,6 +94,13 @@
|
||||
label="$i18n{heliumBangsToggle}"
|
||||
sub-label="$i18n{heliumBangsToggleDescription}">
|
||||
</settings-toggle-button>
|
||||
@@ -154,7 +154,7 @@
|
||||
</if>
|
||||
</if>
|
||||
<if expr="is_chromeos">
|
||||
@@ -1987,6 +1990,12 @@
|
||||
@@ -1993,6 +1996,12 @@
|
||||
<message name="IDS_SETTINGS_HELIUM_SERVICES_BANGS_TOGGLE_DESCRIPTION" desc="Description of the toggle for enabling/disabling of downloading bangs">
|
||||
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.
|
||||
</message>
|
||||
@@ -178,16 +178,16 @@
|
||||
#endif
|
||||
#endif // !BUILDFLAG(IS_CHROMEOS)
|
||||
#if BUILDFLAG(IS_CHROMEOS)
|
||||
@@ -2128,6 +2128,9 @@ void AddPrivacyStrings(content::WebUIDat
|
||||
@@ -2135,6 +2135,9 @@ void AddPrivacyStrings(content::WebUIDat
|
||||
{"heliumBangsToggle", IDS_SETTINGS_HELIUM_SERVICES_BANGS_TOGGLE},
|
||||
{"heliumBangsToggleDescription",
|
||||
IDS_SETTINGS_HELIUM_SERVICES_BANGS_TOGGLE_DESCRIPTION},
|
||||
+ {"heliumSpellcheckToggle", IDS_SETTINGS_HELIUM_SERVICES_SPELLCHECK_TOGGLE},
|
||||
+ {"heliumSpellcheckToggleDescription",
|
||||
+ IDS_SETTINGS_HELIUM_SERVICES_SPELLCHECK_TOGGLE_DESCRIPTION},
|
||||
{"heliumExtProxyToggle",
|
||||
IDS_SETTINGS_HELIUM_SERVICES_EXT_PROXY_TOGGLE},
|
||||
{"heliumExtProxyToggleDescription",
|
||||
{"heliumOriginOverride", IDS_SETTINGS_HELIUM_SERVICES_OVERRIDE},
|
||||
{"heliumOriginOverrideDescription",
|
||||
IDS_SETTINGS_HELIUM_SERVICES_OVERRIDE_DESCRIPTION},
|
||||
--- a/chrome/common/features.gni
|
||||
+++ b/chrome/common/features.gni
|
||||
@@ -10,6 +10,7 @@ import("//components/compose/features.gn
|
||||
|
||||
@@ -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"
|
||||
@@ -2662,14 +2660,9 @@ void AddSearchStrings(content::WebUIData
|
||||
@@ -2665,14 +2663,9 @@ void AddSearchStrings(content::WebUIData
|
||||
html_source->AddString("searchExplanationLearnMoreURL",
|
||||
chrome::kOmniboxLearnMoreURL);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/chrome/app/settings_strings.grdp
|
||||
+++ b/chrome/app/settings_strings.grdp
|
||||
@@ -1941,6 +1941,31 @@
|
||||
@@ -1941,6 +1941,37 @@
|
||||
<message name="IDS_SETTINGS_SECURITY_DESCRIPTION" desc="Description of the controls available on the security settings page">
|
||||
Safe Browsing (protection from dangerous sites) and other security settings
|
||||
</message>
|
||||
@@ -10,6 +10,12 @@
|
||||
+ <message name="IDS_SETTINGS_HELIUM_SERVICES_DESCRIPTION" desc="Description of the controls available on the Helium services settings page">
|
||||
+ Manage what Helium services are allowed in your browser
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_HELIUM_SCHEMA_NOTICE_TITLE" desc="Title of the alert shown when Helium services have a change in behavior">
|
||||
+ Updates to Helium services:
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_HELIUM_SCHEMA_IGNORE" desc="Checkbox label to ignore any future services change alerts">
|
||||
+ Don't notify me again
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_HELIUM_SERVICES_TOGGLE" desc="Global toggle for enabling/disabling of all Helium services">
|
||||
+ Allow connecting to Helium services
|
||||
+ </message>
|
||||
@@ -34,7 +40,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,18 @@ void AddPrivacyStrings(content::WebUIDat
|
||||
@@ -2117,6 +2117,21 @@ void AddPrivacyStrings(content::WebUIDat
|
||||
{"siteSettingsSublabel", IDS_SETTINGS_PERMISSIONS_DESCRIPTION},
|
||||
{"securityPageTitle", IDS_SETTINGS_SECURITY},
|
||||
{"securityPageDescription", IDS_SETTINGS_SECURITY_DESCRIPTION},
|
||||
@@ -43,6 +49,9 @@
|
||||
+ {"heliumServicesToggle", IDS_SETTINGS_HELIUM_SERVICES_TOGGLE},
|
||||
+ {"heliumServicesToggleDescription",
|
||||
+ IDS_SETTINGS_HELIUM_SERVICES_TOGGLE_DESCRIPTION},
|
||||
+ {"heliumSchemaUpdatedTitle", IDS_SETTINGS_HELIUM_SCHEMA_NOTICE_TITLE},
|
||||
+ {"heliumGotIt", IDS_SETTINGS_GOT_IT},
|
||||
+ {"heliumSchemaIgnore", IDS_SETTINGS_HELIUM_SCHEMA_IGNORE},
|
||||
+ {"heliumOriginOverride", IDS_SETTINGS_HELIUM_SERVICES_OVERRIDE},
|
||||
+ {"heliumOriginOverrideDescription",
|
||||
+ IDS_SETTINGS_HELIUM_SERVICES_OVERRIDE_DESCRIPTION},
|
||||
@@ -151,17 +160,64 @@
|
||||
"privacy_sandbox/privacy_sandbox_ad_measurement_subpage.ts",
|
||||
"privacy_sandbox/privacy_sandbox_fledge_subpage.ts",
|
||||
"privacy_sandbox/privacy_sandbox_interest_item.ts",
|
||||
@@ -390,6 +391,7 @@ build_webui("build") {
|
||||
"languages_page/languages_util.ts",
|
||||
"people_page/import_data_browser_proxy.ts",
|
||||
"people_page/manage_profile_browser_proxy.ts",
|
||||
+ "privacy_page/changelog_proxy.ts",
|
||||
"system_page/system_page_browser_proxy.ts",
|
||||
]
|
||||
}
|
||||
--- /dev/null
|
||||
+++ b/chrome/browser/resources/settings/privacy_page/services_page.html
|
||||
@@ -0,0 +1,47 @@
|
||||
@@ -0,0 +1,86 @@
|
||||
+<style include="cr-shared-style settings-shared">
|
||||
+ .label-wrapper {
|
||||
+ padding: var(--cr-section-vertical-padding) 0;
|
||||
+ }
|
||||
+
|
||||
+ #changelog-notice {
|
||||
+ --cr-changelog-padding: 16px;
|
||||
+ border-radius: calc(var(--cr-changelog-padding) / 2);
|
||||
+ margin: var(--cr-changelog-padding);
|
||||
+ margin-top: 0;
|
||||
+ padding: var(--cr-changelog-padding);
|
||||
+ background: var(--md-background-color);
|
||||
+ }
|
||||
+
|
||||
+ #changelog-title {
|
||||
+ font-size: 15px;
|
||||
+ font-weight: 500;
|
||||
+ }
|
||||
+
|
||||
+ #changelog-notice-actions {
|
||||
+ --cr-checkbox-label-padding-start: 8px;
|
||||
+ display: flex;
|
||||
+ gap: var(--cr-changelog-padding);
|
||||
+ border-top: var(--cr-separator-line);
|
||||
+ margin-top: var(--cr-changelog-padding);
|
||||
+ padding-top: calc(var(--cr-changelog-padding) / 2);
|
||||
+ }
|
||||
+</style>
|
||||
+
|
||||
+<settings-subpage page-title="$i18n{heliumServicesTitle}" route-path$="[[routePath]]">
|
||||
+<div class="cr-col first">
|
||||
+ <template is="dom-if" if="[[changes_.length]]">
|
||||
+ <div id="changelog-notice">
|
||||
+ <div id="changelog-title">$i18n{heliumSchemaUpdatedTitle}</div>
|
||||
+ <ul>
|
||||
+ <template is="dom-repeat" items="[[changes_]]" as="change">
|
||||
+ <li>[[change]]</li>
|
||||
+ </template>
|
||||
+ </ul>
|
||||
+ <div id="changelog-notice-actions">
|
||||
+ <cr-button on-click="onAcknowledgedChangelog_">$i18n{heliumGotIt}</cr-button>
|
||||
+ <cr-checkbox id="checkbox" checked="{{ignoreChecked_}}">
|
||||
+ $i18n{heliumSchemaIgnore}
|
||||
+ </cr-checkbox>
|
||||
+ </div>
|
||||
+ </div>
|
||||
+ </template>
|
||||
+ <settings-toggle-button id="servicesToggleButton"
|
||||
+ pref="{{prefs.helium.services.enabled}}"
|
||||
+ label="$i18n{heliumServicesToggle}"
|
||||
@@ -203,24 +259,29 @@
|
||||
+</settings-subpage>
|
||||
--- /dev/null
|
||||
+++ b/chrome/browser/resources/settings/privacy_page/services_page.ts
|
||||
@@ -0,0 +1,67 @@
|
||||
@@ -0,0 +1,97 @@
|
||||
+// Copyright 2025 The Helium Authors
|
||||
+// You can use, redistribute, and/or modify this source code under
|
||||
+// the terms of the GPL-3.0 license that can be found in the LICENSE file.
|
||||
+
|
||||
+import {HelpBubbleMixin} from 'chrome://resources/cr_components/help_bubble/help_bubble_mixin.js';
|
||||
+import {I18nMixin} from 'chrome://resources/cr_elements/i18n_mixin.js';
|
||||
+import {PrefsMixin} from '/shared/settings/prefs/prefs_mixin.js';
|
||||
+import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
|
||||
+import {getTemplate} from './services_page.html.js';
|
||||
+import {HelpBubbleMixin} from 'chrome://resources/cr_components/help_bubble/help_bubble_mixin.js';
|
||||
+import type {CrInputElement} from 'chrome://resources/cr_elements/cr_input/cr_input.js';
|
||||
+import {I18nMixin} from 'chrome://resources/cr_elements/i18n_mixin.js';
|
||||
+import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
|
||||
+
|
||||
+import type {HeliumServicesChangeHandler} from './changelog_proxy.js';
|
||||
+import {HeliumServicesChangeHandlerImpl} from './changelog_proxy.js';
|
||||
+import {getTemplate} from './services_page.html.js';
|
||||
+
|
||||
+const SettingsHeliumServicesPageElementBase =
|
||||
+ HelpBubbleMixin(I18nMixin(PrefsMixin(PolymerElement)));
|
||||
+
|
||||
+export class SettingsHeliumServicesPageElement
|
||||
+ extends SettingsHeliumServicesPageElementBase
|
||||
+{
|
||||
+export class SettingsHeliumServicesPageElement extends
|
||||
+ SettingsHeliumServicesPageElementBase {
|
||||
+ private changeProxy_: HeliumServicesChangeHandler =
|
||||
+ HeliumServicesChangeHandlerImpl.getInstance();
|
||||
+
|
||||
+ static get is() {
|
||||
+ return 'settings-helium-services-page';
|
||||
+ }
|
||||
@@ -230,9 +291,15 @@
|
||||
+ }
|
||||
+
|
||||
+ static get properties() {
|
||||
+ return {};
|
||||
+ return {
|
||||
+ ignoreChecked_: Boolean,
|
||||
+ changes_: Array,
|
||||
+ };
|
||||
+ }
|
||||
+
|
||||
+ declare private changes_: string[];
|
||||
+ declare private ignoreChecked_: boolean;
|
||||
+
|
||||
+ private toOrigin(thing: string) {
|
||||
+ try {
|
||||
+ return new URL(thing).origin;
|
||||
@@ -241,6 +308,25 @@
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private updateChangelogState(changes: string[]) {
|
||||
+ this.changes_ = changes.flatMap(ch => ch.split('\n'));
|
||||
+ }
|
||||
+
|
||||
+ private requestChangelog() {
|
||||
+ this.changeProxy_.requestChangelog().then(
|
||||
+ this.updateChangelogState.bind(this));
|
||||
+ }
|
||||
+
|
||||
+ private onAcknowledgedChangelog_() {
|
||||
+ this.changeProxy_.acknowledgeChanges(this.ignoreChecked_);
|
||||
+ this.requestChangelog();
|
||||
+ }
|
||||
+
|
||||
+ override ready() {
|
||||
+ super.ready();
|
||||
+ this.requestChangelog();
|
||||
+ }
|
||||
+
|
||||
+ protected onOriginOverrideKeydown_(event: KeyboardEvent) {
|
||||
+ const target = event.target as CrInputElement;
|
||||
+
|
||||
@@ -299,11 +385,13 @@
|
||||
#include "components/policy/core/common/policy_pref_names.h"
|
||||
#include "components/pref_registry/pref_registry_syncable.h"
|
||||
#include "components/prefs/pref_registry_simple.h"
|
||||
@@ -204,6 +205,11 @@ void RegisterBrowserUserPrefs(user_prefs
|
||||
@@ -204,6 +205,13 @@ void RegisterBrowserUserPrefs(user_prefs
|
||||
false);
|
||||
#endif
|
||||
|
||||
+ {
|
||||
+ registry->RegisterIntegerPref(prefs::kHeliumSchemaVersion, 0);
|
||||
+ registry->RegisterBooleanPref(prefs::kHeliumDisableSchemaAlerts, false);
|
||||
+ registry->RegisterBooleanPref(prefs::kHeliumServicesEnabled, true);
|
||||
+ registry->RegisterStringPref(prefs::kHeliumServicesOrigin, "");
|
||||
+ }
|
||||
@@ -336,7 +424,7 @@
|
||||
settings_api::PrefType::kBoolean;
|
||||
--- /dev/null
|
||||
+++ b/components/helium_services/BUILD.gn
|
||||
@@ -0,0 +1,20 @@
|
||||
@@ -0,0 +1,22 @@
|
||||
+# Copyright 2025 The Helium Authors
|
||||
+# You can use, redistribute, and/or modify this source code under
|
||||
+# the terms of the GPL-3.0 license that can be found in the LICENSE file.
|
||||
@@ -346,6 +434,8 @@
|
||||
+ "helium_services_helpers.cc",
|
||||
+ "helium_services_helpers.h",
|
||||
+ "pref_names.h",
|
||||
+ "schema.cc",
|
||||
+ "schema.h",
|
||||
+ ]
|
||||
+
|
||||
+ public_deps = [
|
||||
@@ -359,7 +449,7 @@
|
||||
+}
|
||||
--- /dev/null
|
||||
+++ b/components/helium_services/helium_services_helpers.cc
|
||||
@@ -0,0 +1,66 @@
|
||||
@@ -0,0 +1,67 @@
|
||||
+// Copyright 2025 The Helium Authors
|
||||
+// You can use, redistribute, and/or modify this source code under
|
||||
+// the terms of the GPL-3.0 license that can be found in the LICENSE file.
|
||||
@@ -422,13 +512,14 @@
|
||||
+ PrefChangeRegistrar& registrar, const base::RepeatingClosure& observer) {
|
||||
+ registrar.Add(prefs::kHeliumServicesEnabled, observer);
|
||||
+ registrar.Add(prefs::kHeliumServicesOrigin, observer);
|
||||
+ registrar.Add(prefs::kHeliumSchemaVersion, observer);
|
||||
+ registrar.Add(pref_name, observer);
|
||||
+}
|
||||
+
|
||||
+} // namespace helium
|
||||
--- /dev/null
|
||||
+++ b/components/helium_services/helium_services_helpers.h
|
||||
@@ -0,0 +1,28 @@
|
||||
@@ -0,0 +1,30 @@
|
||||
+// Copyright 2025 The Helium Authors
|
||||
+// You can use, redistribute, and/or modify this source code under
|
||||
+// the terms of the GPL-3.0 license that can be found in the LICENSE file.
|
||||
@@ -449,6 +540,8 @@
|
||||
+const char kHeliumDummyOrigin[] =
|
||||
+ "https://helium-services-are-disabled.qjz9zk";
|
||||
+
|
||||
+bool ShouldAccessServices(const PrefService& prefs);
|
||||
+
|
||||
+COMPONENT_EXPORT(HELIUM) GURL GetServicesBaseURL(const PrefService& prefs);
|
||||
+COMPONENT_EXPORT(HELIUM) GURL GetDummyURL();
|
||||
+COMPONENT_EXPORT(HELIUM) std::optional<GURL> GetValidUserOverridenURL(std::string_view user_url_);
|
||||
@@ -459,7 +552,7 @@
|
||||
+#endif // COMPONENTS_HELIUM_SERVICES_HELIUM_SERVICES_HELPERS_H_
|
||||
--- /dev/null
|
||||
+++ b/components/helium_services/pref_names.h
|
||||
@@ -0,0 +1,18 @@
|
||||
@@ -0,0 +1,24 @@
|
||||
+// Copyright 2025 The Helium Authors
|
||||
+// You can use, redistribute, and/or modify this source code under
|
||||
+// the terms of the GPL-3.0 license that can be found in the LICENSE file.
|
||||
@@ -469,6 +562,12 @@
|
||||
+
|
||||
+namespace prefs {
|
||||
+
|
||||
+inline constexpr char kHeliumSchemaVersion[] =
|
||||
+ "helium.services.schema_version";
|
||||
+
|
||||
+inline constexpr char kHeliumDisableSchemaAlerts[] =
|
||||
+ "helium.services.disable_schema_alerts";
|
||||
+
|
||||
+inline constexpr char kHeliumServicesEnabled[] =
|
||||
+ "helium.services.enabled";
|
||||
+
|
||||
@@ -478,3 +577,248 @@
|
||||
+} // namespace prefs
|
||||
+
|
||||
+#endif // COMPONENTS_HELIUM_SERVICES_PREF_NAMES_H_
|
||||
--- /dev/null
|
||||
+++ b/chrome/browser/resources/settings/privacy_page/changelog_proxy.ts
|
||||
@@ -0,0 +1,40 @@
|
||||
+// Copyright 2025 The Helium Authors
|
||||
+// You can use, redistribute, and/or modify this source code under
|
||||
+// the terms of the GPL-3.0 license that can be found in the LICENSE file.
|
||||
+
|
||||
+/**
|
||||
+ * @fileoverview A helper object used from the "Helium services" section
|
||||
+ * to request a changelog (if one exists).
|
||||
+ */
|
||||
+
|
||||
+// clang-format off
|
||||
+import {sendWithPromise} from 'chrome://resources/js/cr.js';
|
||||
+// clang-format on
|
||||
+
|
||||
+export interface HeliumServicesChangeHandler {
|
||||
+ // Get the pending changes to Helium services to announce
|
||||
+ // to the user.
|
||||
+ requestChangelog(): Promise<string[]>;
|
||||
+ acknowledgeChanges(ignoreAllChangelogs: boolean): void;
|
||||
+}
|
||||
+
|
||||
+export class HeliumServicesChangeHandlerImpl implements
|
||||
+ HeliumServicesChangeHandler {
|
||||
+ requestChangelog() {
|
||||
+ return sendWithPromise('getServicesSchemaChangelog');
|
||||
+ }
|
||||
+
|
||||
+ acknowledgeChanges(ignoreAllChangelogs: boolean) {
|
||||
+ chrome.send('updateServicesSchemaVersion', [ignoreAllChangelogs]);
|
||||
+ }
|
||||
+
|
||||
+ static getInstance(): HeliumServicesChangeHandler {
|
||||
+ return instance || (instance = new HeliumServicesChangeHandlerImpl());
|
||||
+ }
|
||||
+
|
||||
+ static setInstance(obj: HeliumServicesChangeHandler) {
|
||||
+ instance = obj;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+let instance: HeliumServicesChangeHandler|null = null;
|
||||
--- /dev/null
|
||||
+++ b/chrome/browser/ui/webui/settings/services_schema_handler.h
|
||||
@@ -0,0 +1,36 @@
|
||||
+// Copyright 2025 The Helium Authors
|
||||
+// You can use, redistribute, and/or modify this source code under
|
||||
+// the terms of the GPL-3.0 license that can be found in the LICENSE file.
|
||||
+
|
||||
+#ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_SERVICES_SCHEMA_HANDLER_H_
|
||||
+#define CHROME_BROWSER_UI_WEBUI_SETTINGS_SERVICES_SCHEMA_HANDLER_H_
|
||||
+
|
||||
+#include <optional>
|
||||
+#include <string>
|
||||
+
|
||||
+#include "base/memory/raw_ptr.h"
|
||||
+#include "base/values.h"
|
||||
+#include "content/public/browser/web_ui_message_handler.h"
|
||||
+
|
||||
+class Profile;
|
||||
+class PrefService;
|
||||
+
|
||||
+class HeliumServicesSchemaHandler : public content::WebUIMessageHandler {
|
||||
+ public:
|
||||
+ explicit HeliumServicesSchemaHandler(Profile* profile);
|
||||
+ HeliumServicesSchemaHandler(const HeliumServicesSchemaHandler&) = delete;
|
||||
+ HeliumServicesSchemaHandler& operator=(const HeliumServicesSchemaHandler&) =
|
||||
+ delete;
|
||||
+ ~HeliumServicesSchemaHandler() override;
|
||||
+
|
||||
+ // SettingsPageUIHandler:
|
||||
+ void RegisterMessages() override;
|
||||
+
|
||||
+ private:
|
||||
+ void HandleChangelogRequest(const base::Value::List&);
|
||||
+ void HandleChangelogAcknowledgment(const base::Value::List&);
|
||||
+
|
||||
+ raw_ptr<PrefService> pref_service_ = nullptr;
|
||||
+};
|
||||
+
|
||||
+#endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_SERVICES_SCHEMA_HANDLER_H_
|
||||
--- /dev/null
|
||||
+++ b/components/helium_services/schema.cc
|
||||
@@ -0,0 +1,36 @@
|
||||
+// Copyright 2025 The Helium Authors
|
||||
+// You can use, redistribute, and/or modify this source code under
|
||||
+// the terms of the GPL-3.0 license that can be found in the LICENSE file.
|
||||
+
|
||||
+#include "components/helium_services/schema.h"
|
||||
+
|
||||
+#include "components/helium_services/helium_services_helpers.h"
|
||||
+#include "components/helium_services/pref_names.h"
|
||||
+#include "components/prefs/pref_service.h"
|
||||
+
|
||||
+namespace helium {
|
||||
+
|
||||
+bool HasAcceptedSchema(const PrefService& prefs, int version) {
|
||||
+ return prefs.GetBoolean(prefs::kHeliumDisableSchemaAlerts) ||
|
||||
+ prefs.GetInteger(prefs::kHeliumSchemaVersion) >= version;
|
||||
+}
|
||||
+
|
||||
+void AcceptCurrentSchema(PrefService& prefs) {
|
||||
+ prefs.SetInteger(prefs::kHeliumSchemaVersion, kHeliumCurrentSchemaVersion);
|
||||
+}
|
||||
+
|
||||
+bool ShouldShowSchemaNotification(const PrefService& prefs) {
|
||||
+ return ShouldAccessServices(prefs) &&
|
||||
+ !HasAcceptedSchema(prefs, kHeliumCurrentSchemaVersion);
|
||||
+}
|
||||
+
|
||||
+ServicesChangelog& GetChangelog() {
|
||||
+ static constexpr auto kHeliumSchemaChangelog =
|
||||
+ base::MakeFixedFlatMap<int, std::string_view>({
|
||||
+ {1, "TBA ____________________"}
|
||||
+ });
|
||||
+
|
||||
+ return kHeliumSchemaChangelog;
|
||||
+}
|
||||
+
|
||||
+} // namespace helium
|
||||
--- /dev/null
|
||||
+++ b/components/helium_services/schema.h
|
||||
@@ -0,0 +1,30 @@
|
||||
+// Copyright 2025 The Helium Authors
|
||||
+// You can use, redistribute, and/or modify this source code under
|
||||
+// the terms of the GPL-3.0 license that can be found in the LICENSE file.
|
||||
+
|
||||
+#ifndef COMPONENTS_HELIUM_SERVICES_SCHEMA_H_
|
||||
+#define COMPONENTS_HELIUM_SERVICES_SCHEMA_H_
|
||||
+
|
||||
+#include "base/component_export.h"
|
||||
+#include "base/containers/fixed_flat_map.h"
|
||||
+#include "components/prefs/pref_service.h"
|
||||
+
|
||||
+namespace helium {
|
||||
+
|
||||
+inline constexpr int kHeliumCurrentSchemaVersion = 1;
|
||||
+
|
||||
+using ServicesChangelog = const base::
|
||||
+ fixed_flat_map<int, std::string_view, kHeliumCurrentSchemaVersion>;
|
||||
+
|
||||
+#define EX COMPONENT_EXPORT(HELIUM)
|
||||
+
|
||||
+EX bool HasAcceptedSchema(const PrefService& prefs, int version);
|
||||
+EX void AcceptCurrentSchema(PrefService& prefs);
|
||||
+EX bool ShouldShowSchemaNotification(const PrefService& prefs);
|
||||
+EX ServicesChangelog& GetChangelog();
|
||||
+
|
||||
+#undef EX
|
||||
+
|
||||
+} // namespace helium
|
||||
+
|
||||
+#endif // COMPONENTS_HELIUM_SERVICES_SCHEMA_H_
|
||||
--- a/chrome/browser/ui/BUILD.gn
|
||||
+++ b/chrome/browser/ui/BUILD.gn
|
||||
@@ -1296,6 +1296,8 @@ static_library("ui") {
|
||||
"webui/settings/saved_info_handler.h",
|
||||
"webui/settings/search_engines_handler.cc",
|
||||
"webui/settings/search_engines_handler.h",
|
||||
+ "webui/settings/services_schema_handler.cc",
|
||||
+ "webui/settings/services_schema_handler.h",
|
||||
"webui/settings/settings_clear_browsing_data_handler.cc",
|
||||
"webui/settings/settings_clear_browsing_data_handler.h",
|
||||
"webui/settings/settings_localized_strings_privacy_sandbox_provider.cc",
|
||||
--- /dev/null
|
||||
+++ b/chrome/browser/ui/webui/settings/services_schema_handler.cc
|
||||
@@ -0,0 +1,58 @@
|
||||
+// Copyright 2025 The Helium Authors
|
||||
+// You can use, redistribute, and/or modify this source code under
|
||||
+// the terms of the GPL-3.0 license that can be found in the LICENSE file.
|
||||
+
|
||||
+#include "chrome/browser/ui/webui/settings/services_schema_handler.h"
|
||||
+
|
||||
+#include "base/functional/bind.h"
|
||||
+#include "base/values.h"
|
||||
+#include "chrome/browser/profiles/profile.h"
|
||||
+#include "components/helium_services/pref_names.h"
|
||||
+#include "components/helium_services/schema.h"
|
||||
+#include "components/prefs/pref_service.h"
|
||||
+
|
||||
+HeliumServicesSchemaHandler::HeliumServicesSchemaHandler(Profile* profile)
|
||||
+ : pref_service_(profile->GetPrefs()) {}
|
||||
+
|
||||
+HeliumServicesSchemaHandler::~HeliumServicesSchemaHandler() = default;
|
||||
+
|
||||
+void HeliumServicesSchemaHandler::RegisterMessages() {
|
||||
+ web_ui()->RegisterMessageCallback(
|
||||
+ "getServicesSchemaChangelog",
|
||||
+ base::BindRepeating(&HeliumServicesSchemaHandler::HandleChangelogRequest,
|
||||
+ base::Unretained(this)));
|
||||
+ web_ui()->RegisterMessageCallback(
|
||||
+ "updateServicesSchemaVersion",
|
||||
+ base::BindRepeating(
|
||||
+ &HeliumServicesSchemaHandler::HandleChangelogAcknowledgment,
|
||||
+ base::Unretained(this)));
|
||||
+}
|
||||
+
|
||||
+void HeliumServicesSchemaHandler::HandleChangelogRequest(
|
||||
+ const base::Value::List& args) {
|
||||
+ CHECK_EQ(1U, args.size());
|
||||
+ const auto& callback_id = args[0].GetString();
|
||||
+ base::Value::List out;
|
||||
+
|
||||
+ if (helium::ShouldShowSchemaNotification(*pref_service_)) {
|
||||
+ int user_version = pref_service_->GetInteger(prefs::kHeliumSchemaVersion);
|
||||
+ auto& changelog = helium::GetChangelog();
|
||||
+
|
||||
+ for (auto it = changelog.upper_bound(user_version); it != changelog.end();
|
||||
+ ++it) {
|
||||
+ out.Append(it->second);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ AllowJavascript();
|
||||
+ ResolveJavascriptCallback(base::Value(callback_id), std::move(out));
|
||||
+}
|
||||
+
|
||||
+void HeliumServicesSchemaHandler::HandleChangelogAcknowledgment(
|
||||
+ const base::Value::List& args) {
|
||||
+ CHECK_EQ(1U, args.size());
|
||||
+ bool ignore_alerts = args[0].GetBool();
|
||||
+
|
||||
+ helium::AcceptCurrentSchema(*pref_service_);
|
||||
+ pref_service_->SetBoolean(prefs::kHeliumDisableSchemaAlerts, ignore_alerts);
|
||||
+}
|
||||
--- a/chrome/browser/ui/webui/settings/settings_ui.cc
|
||||
+++ b/chrome/browser/ui/webui/settings/settings_ui.cc
|
||||
@@ -76,6 +76,7 @@
|
||||
#include "chrome/browser/ui/webui/settings/safety_hub_handler.h"
|
||||
#include "chrome/browser/ui/webui/settings/saved_info_handler.h"
|
||||
#include "chrome/browser/ui/webui/settings/search_engines_handler.h"
|
||||
+#include "chrome/browser/ui/webui/settings/services_schema_handler.h"
|
||||
#include "chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.h"
|
||||
#include "chrome/browser/ui/webui/settings/settings_localized_strings_provider.h"
|
||||
#include "chrome/browser/ui/webui/settings/settings_media_devices_selection_handler.h"
|
||||
@@ -252,6 +253,8 @@ SettingsUI::SettingsUI(content::WebUI* w
|
||||
AddSettingsPageUIHandler(std::make_unique<ProtocolHandlersHandler>(profile));
|
||||
AddSettingsPageUIHandler(std::make_unique<PrivacySandboxHandler>());
|
||||
AddSettingsPageUIHandler(std::make_unique<SearchEnginesHandler>(profile));
|
||||
+ AddSettingsPageUIHandler(
|
||||
+ std::make_unique<HeliumServicesSchemaHandler>(profile));
|
||||
AddSettingsPageUIHandler(std::make_unique<SecureDnsHandler>());
|
||||
AddSettingsPageUIHandler(std::make_unique<SiteSettingsHandler>(profile));
|
||||
AddSettingsPageUIHandler(std::make_unique<StartupPagesHandler>(web_ui));
|
||||
|
||||
232
patches/helium/core/services-schema-nag.patch
Normal file
232
patches/helium/core/services-schema-nag.patch
Normal file
@@ -0,0 +1,232 @@
|
||||
--- a/chrome/app/chromium_strings.grd
|
||||
+++ b/chrome/app/chromium_strings.grd
|
||||
@@ -956,6 +956,10 @@ Chromium is unable to recover your setti
|
||||
Customize and control Chromium. Update is available.
|
||||
</message>
|
||||
|
||||
+ <message name="IDS_APPMENU_TOOLTIP_HELIUM_SERVICES_UPDATE" desc="The tooltip to show for the browser menu when Helium services schema changes">
|
||||
+ Helium services have been updated. Please review the changes.
|
||||
+ </message>
|
||||
+
|
||||
<message name="IDS_APPMENU_TOOLTIP_ALERT" desc="The tooltip to show for the browser menu when a non-update alert is displayed">
|
||||
Customize and control Chromium. Something needs your attention - click for details.
|
||||
</message>
|
||||
@@ -1620,6 +1624,11 @@ Chromium is unable to recover your setti
|
||||
Chromium couldn't update to the latest version, so you're missing out on new features and security fixes.
|
||||
</message>
|
||||
|
||||
+ <!-- Helium services schema change bubble -->
|
||||
+ <message name="IDS_HELIUM_SERVICES_SCHEMA_MENU_ITEM" desc="Text for the bubble that notifies the user of a schema change in Helium services.">
|
||||
+ Review Helium services updates
|
||||
+ </message>
|
||||
+
|
||||
<!-- User menu errors -->
|
||||
<message name="IDS_SYNC_ERROR_USER_MENU_UPGRADE_BUTTON" desc="Button in the header of desktop user menu that prompts the user to update Chrome to fix the out-of-date Chrome client error.">
|
||||
Update Chromium
|
||||
--- a/chrome/app/generated_resources.grd
|
||||
+++ b/chrome/app/generated_resources.grd
|
||||
@@ -13186,6 +13186,9 @@ Check your passwords anytime in <ph name
|
||||
<message name="IDS_APP_MENU_BUTTON_UPDATE" desc="Short label next to app-menu button when an update is available.">
|
||||
Update
|
||||
</message>
|
||||
+ <message name="IDS_APP_MENU_BUTTON_HELIUM_SERVICES_UPDATE" desc="Short label next to app-menu button when Helium services behavior changes.">
|
||||
+ Services updated
|
||||
+ </message>
|
||||
<if expr="is_win or is_macosx or is_linux">
|
||||
<message name="IDS_APP_MENU_BUTTON_UPDATE_ALT1" desc="Alternate short label next to app-menu button when an update is available.">
|
||||
Finish update
|
||||
--- a/chrome/app/chrome_command_ids.h
|
||||
+++ b/chrome/app/chrome_command_ids.h
|
||||
@@ -301,6 +301,7 @@
|
||||
#define IDC_SHOW_COMMENTS_SIDE_PANEL 40297
|
||||
#define IDC_RECENT_TABS_SEE_DEVICE_TABS 40298
|
||||
#define IDC_SHOW_AI_MODE_OMNIBOX_BUTTON 40299
|
||||
+#define IDC_HELIUM_SERVICES_OPEN 40300
|
||||
|
||||
// Spell-check
|
||||
// Insert any additional suggestions before _LAST; these have to be consecutive.
|
||||
--- a/chrome/browser/ui/chrome_pages.h
|
||||
+++ b/chrome/browser/ui/chrome_pages.h
|
||||
@@ -138,6 +138,7 @@ void ShowSafeBrowsingEnhancedProtectionW
|
||||
safe_browsing::SafeBrowsingSettingReferralMethod referral_method);
|
||||
void ShowImportDialog(Browser* browser);
|
||||
void ShowAboutChrome(Browser* browser);
|
||||
+void ShowHeliumServices(Browser* browser);
|
||||
void ShowSearchEngineSettings(Browser* browser);
|
||||
void ShowWebStore(Browser* browser, std::string_view utm_source_value);
|
||||
void ShowPrivacySandboxSettings(Browser* browser);
|
||||
--- a/chrome/browser/ui/chrome_pages.cc
|
||||
+++ b/chrome/browser/ui/chrome_pages.cc
|
||||
@@ -615,6 +615,11 @@ void ShowAboutChrome(Browser* browser) {
|
||||
ShowSingletonTabIgnorePathOverwriteNTP(browser, GURL(kChromeUIHelpURL));
|
||||
}
|
||||
|
||||
+void ShowHeliumServices(Browser* browser) {
|
||||
+ ShowSingletonTabIgnorePathOverwriteNTP(
|
||||
+ browser, GURL("chrome://settings/privacy/services"));
|
||||
+}
|
||||
+
|
||||
void ShowSearchEngineSettings(Browser* browser) {
|
||||
base::RecordAction(UserMetricsAction("EditSearchEngines"));
|
||||
ShowSettingsSubPage(browser, kSearchEnginesSubPage);
|
||||
--- a/chrome/browser/ui/browser_command_controller.cc
|
||||
+++ b/chrome/browser/ui/browser_command_controller.cc
|
||||
@@ -1067,6 +1067,9 @@ bool BrowserCommandController::ExecuteCo
|
||||
case IDC_UPGRADE_DIALOG:
|
||||
OpenUpdateChromeDialog(browser_);
|
||||
break;
|
||||
+ case IDC_HELIUM_SERVICES_OPEN:
|
||||
+ ShowHeliumServices(browser_->GetBrowserForOpeningWebUi());
|
||||
+ break;
|
||||
case IDC_OPEN_SAFETY_HUB:
|
||||
ShowSettingsSubPage(browser_->GetBrowserForOpeningWebUi(),
|
||||
chrome::kSafetyHubSubPage);
|
||||
@@ -1631,6 +1634,7 @@ void BrowserCommandController::InitComma
|
||||
|
||||
// These are always enabled; the menu determines their menu item visibility.
|
||||
command_updater_.UpdateCommandEnabled(IDC_UPGRADE_DIALOG, true);
|
||||
+ command_updater_.UpdateCommandEnabled(IDC_HELIUM_SERVICES_OPEN, true);
|
||||
command_updater_.UpdateCommandEnabled(IDC_SET_BROWSER_AS_DEFAULT, true);
|
||||
|
||||
// Safety Hub commands.
|
||||
--- a/chrome/browser/ui/toolbar/app_menu_model.h
|
||||
+++ b/chrome/browser/ui/toolbar/app_menu_model.h
|
||||
@@ -281,6 +281,9 @@ class AppMenuModel : public ui::SimpleMe
|
||||
// boolean indicating whether any menu items were added.
|
||||
bool AddDefaultBrowserMenuItems();
|
||||
|
||||
+ // Adds a nag to review Helium services permission changes
|
||||
+ bool AddHeliumSchemaItem();
|
||||
+
|
||||
// Adds the Safety Hub menu notifications to the menu. Returns a boolean
|
||||
// indicating whether any menu items were added.
|
||||
[[nodiscard]] bool AddSafetyHubMenuItem();
|
||||
--- a/chrome/browser/ui/toolbar/app_menu_model.cc
|
||||
+++ b/chrome/browser/ui/toolbar/app_menu_model.cc
|
||||
@@ -104,6 +104,7 @@
|
||||
#include "components/dom_distiller/core/url_utils.h"
|
||||
#include "components/feature_engagement/public/event_constants.h"
|
||||
#include "components/feature_engagement/public/feature_constants.h"
|
||||
+#include "components/helium_services/schema.h"
|
||||
#include "components/lens/lens_features.h"
|
||||
#include "components/omnibox/browser/vector_icons.h"
|
||||
#include "components/password_manager/content/common/web_ui_constants.h"
|
||||
@@ -2062,7 +2063,8 @@ bool AppMenuModel::AddGlobalErrorMenuIte
|
||||
// how update the menu if new errors are added.
|
||||
const GlobalErrorService::GlobalErrorList& errors =
|
||||
GlobalErrorServiceFactory::GetForProfile(browser_->profile())->errors();
|
||||
- bool menu_items_added = false;
|
||||
+ bool menu_items_added = AddHeliumSchemaItem();
|
||||
+
|
||||
for (GlobalError* error : errors) {
|
||||
DCHECK(error);
|
||||
if (error->HasMenuItem()) {
|
||||
@@ -2126,6 +2128,22 @@ bool AppMenuModel::AddSafetyHubMenuItem(
|
||||
return true;
|
||||
}
|
||||
|
||||
+bool AppMenuModel::AddHeliumSchemaItem() {
|
||||
+ if (!helium::ShouldShowSchemaNotification(
|
||||
+ *browser()->profile()->GetPrefs())) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ const auto update_icon = ui::ImageModel::FromVectorIcon(
|
||||
+ omnibox::kProductChromeRefreshIcon, ui::kColorMenuIcon, kDefaultIconSize);
|
||||
+ AddItemWithIcon(
|
||||
+ IDC_HELIUM_SERVICES_OPEN,
|
||||
+ l10n_util::GetStringUTF16(IDS_HELIUM_SERVICES_SCHEMA_MENU_ITEM),
|
||||
+ update_icon);
|
||||
+
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
#if BUILDFLAG(IS_CHROMEOS)
|
||||
void AppMenuModel::UpdateSettingsItemState() {
|
||||
bool is_disabled =
|
||||
--- a/chrome/browser/ui/toolbar/app_menu_icon_controller.cc
|
||||
+++ b/chrome/browser/ui/toolbar/app_menu_icon_controller.cc
|
||||
@@ -8,11 +8,15 @@
|
||||
#include "build/build_config.h"
|
||||
#include "chrome/app/vector_icons/vector_icons.h"
|
||||
#include "chrome/browser/defaults.h"
|
||||
+#include "chrome/browser/profiles/profile.h"
|
||||
#include "chrome/browser/ui/global_error/global_error.h"
|
||||
#include "chrome/browser/ui/global_error/global_error_service_factory.h"
|
||||
#include "chrome/browser/ui/ui_features.h"
|
||||
#include "chrome/browser/upgrade_detector/upgrade_detector.h"
|
||||
#include "chrome/common/channel_info.h"
|
||||
+#include "components/helium_services/pref_names.h"
|
||||
+#include "components/helium_services/schema.h"
|
||||
+#include "components/prefs/pref_change_registrar.h"
|
||||
#include "components/version_info/channel.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
|
||||
@@ -109,6 +113,14 @@ AppMenuIconController::AppMenuIconContro
|
||||
GlobalErrorServiceFactory::GetForProfile(profile_));
|
||||
|
||||
upgrade_detector_->AddObserver(this);
|
||||
+
|
||||
+ if (auto* prefs = profile->GetPrefs()) {
|
||||
+ registrar_.Init(prefs);
|
||||
+ registrar_.Add(
|
||||
+ prefs::kHeliumSchemaVersion,
|
||||
+ base::BindRepeating(&AppMenuIconController::OnGlobalErrorsChanged,
|
||||
+ base::Unretained(this)));
|
||||
+ }
|
||||
}
|
||||
|
||||
AppMenuIconController::~AppMenuIconController() {
|
||||
@@ -141,6 +153,12 @@ AppMenuIconController::GetTypeAndSeverit
|
||||
->GetHighestSeverityGlobalErrorWithAppMenuItem()) {
|
||||
return {IconType::kGlobalError, SeverityFromError(error)};
|
||||
}
|
||||
+
|
||||
+ if (auto* prefs = profile_->GetPrefs()) {
|
||||
+ if (helium::ShouldShowSchemaNotification(*prefs)) {
|
||||
+ return {IconType::kHeliumServicesUpdate, Severity::kLow};
|
||||
+ }
|
||||
+ }
|
||||
#endif
|
||||
|
||||
return {IconType::kNone, Severity::kNone};
|
||||
--- a/chrome/browser/ui/toolbar/app_menu_icon_controller.h
|
||||
+++ b/chrome/browser/ui/toolbar/app_menu_icon_controller.h
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "chrome/browser/ui/global_error/global_error_observer.h"
|
||||
#include "chrome/browser/ui/global_error/global_error_service.h"
|
||||
#include "chrome/browser/upgrade_detector/upgrade_observer.h"
|
||||
+#include "components/prefs/pref_change_registrar.h"
|
||||
#include "third_party/skia/include/core/SkColor.h"
|
||||
#include "ui/base/models/image_model.h"
|
||||
|
||||
@@ -29,6 +30,7 @@ class AppMenuIconController : public Glo
|
||||
enum class IconType {
|
||||
kNone,
|
||||
kUpgradeNotification,
|
||||
+ kHeliumServicesUpdate,
|
||||
kGlobalError,
|
||||
};
|
||||
enum class Severity {
|
||||
@@ -93,6 +95,7 @@ class AppMenuIconController : public Glo
|
||||
const raw_ptr<Delegate> delegate_;
|
||||
base::ScopedObservation<GlobalErrorService, GlobalErrorObserver>
|
||||
global_error_observation_{this};
|
||||
+ PrefChangeRegistrar registrar_;
|
||||
};
|
||||
|
||||
#endif // CHROME_BROWSER_UI_TOOLBAR_APP_MENU_ICON_CONTROLLER_H_
|
||||
--- a/chrome/browser/ui/views/toolbar/browser_app_menu_button.cc
|
||||
+++ b/chrome/browser/ui/views/toolbar/browser_app_menu_button.cc
|
||||
@@ -214,6 +214,11 @@ void BrowserAppMenuButton::UpdateTextAnd
|
||||
#else
|
||||
text = l10n_util::GetStringUTF16(IDS_APP_MENU_BUTTON_UPDATE);
|
||||
#endif
|
||||
+ } else if (type_and_severity_.type ==
|
||||
+ AppMenuIconController::IconType::kHeliumServicesUpdate) {
|
||||
+ tooltip_message_id = IDS_APPMENU_TOOLTIP_HELIUM_SERVICES_UPDATE;
|
||||
+ text =
|
||||
+ l10n_util::GetStringUTF16(IDS_APP_MENU_BUTTON_HELIUM_SERVICES_UPDATE);
|
||||
} else {
|
||||
tooltip_message_id = IDS_APPMENU_TOOLTIP_ALERT;
|
||||
const int text_id =
|
||||
@@ -29,7 +29,7 @@
|
||||
registrar.Add(prefs::kHeliumServicesEnabled, observer);
|
||||
--- a/components/helium_services/helium_services_helpers.h
|
||||
+++ b/components/helium_services/helium_services_helpers.h
|
||||
@@ -21,12 +21,14 @@ const char kHeliumDummyOrigin[] =
|
||||
@@ -23,12 +23,14 @@ 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);
|
||||
@@ -46,7 +46,7 @@
|
||||
PrefChangeRegistrar& registrar, const base::RepeatingClosure& observer);
|
||||
--- a/components/helium_services/pref_names.h
|
||||
+++ b/components/helium_services/pref_names.h
|
||||
@@ -33,6 +33,8 @@ inline constexpr char kHeliumUpdateFetch
|
||||
@@ -39,6 +39,8 @@ inline constexpr char kHeliumUpdateFetch
|
||||
inline constexpr char kHeliumSpellcheckEnabled[] =
|
||||
"helium.services.spellcheck_files";
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
(*s_allowlist)[::prefs::kHeliumServicesConsented] =
|
||||
--- a/chrome/browser/ui/browser_ui_prefs.cc
|
||||
+++ b/chrome/browser/ui/browser_ui_prefs.cc
|
||||
@@ -218,6 +218,7 @@ void RegisterBrowserUserPrefs(user_prefs
|
||||
@@ -220,6 +220,7 @@ void RegisterBrowserUserPrefs(user_prefs
|
||||
registry->RegisterBooleanPref(prefs::kHeliumDidOnboarding, false);
|
||||
registry->RegisterBooleanPref(prefs::kHeliumServicesConsented, false);
|
||||
registry->RegisterBooleanPref(prefs::kHeliumUpdateFetchingEnabled, true);
|
||||
@@ -217,7 +217,7 @@
|
||||
if ( bin.assetSourceRegistry instanceof Object ) {
|
||||
--- a/chrome/app/settings_strings.grdp
|
||||
+++ b/chrome/app/settings_strings.grdp
|
||||
@@ -2002,6 +2002,12 @@
|
||||
@@ -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>
|
||||
@@ -232,7 +232,7 @@
|
||||
</message>
|
||||
--- a/chrome/browser/resources/settings/privacy_page/services_page.html
|
||||
+++ b/chrome/browser/resources/settings/privacy_page/services_page.html
|
||||
@@ -69,6 +69,11 @@
|
||||
@@ -108,6 +108,11 @@
|
||||
sub-label="$i18n{heliumUpdatesToggleDescription}">
|
||||
</settings-toggle-button>
|
||||
</if>
|
||||
@@ -246,7 +246,7 @@
|
||||
</template>
|
||||
--- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
|
||||
+++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
|
||||
@@ -2139,6 +2139,10 @@ void AddPrivacyStrings(content::WebUIDat
|
||||
@@ -2142,6 +2142,10 @@ void AddPrivacyStrings(content::WebUIDat
|
||||
IDS_SETTINGS_HELIUM_SERVICES_UPDATE},
|
||||
{"heliumUpdatesToggleDescription",
|
||||
IDS_SETTINGS_HELIUM_SERVICES_UPDATE_DESCRIPTION},
|
||||
|
||||
@@ -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>
|
||||
@@ -3207,6 +3210,9 @@
|
||||
@@ -3213,6 +3216,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>
|
||||
@@ -31,7 +31,7 @@
|
||||
{"doNotTrackDialogLearnMoreA11yLabel",
|
||||
IDS_SETTINGS_ENABLE_DO_NOT_TRACK_DIALOG_LEARN_MORE_ACCESSIBILITY_LABEL},
|
||||
// TODO(crbug.com/40122957): This string is no longer used. Remove.
|
||||
@@ -2829,7 +2829,7 @@ void AddSiteSettingsStrings(content::Web
|
||||
@@ -2832,7 +2832,7 @@ void AddSiteSettingsStrings(content::Web
|
||||
{"trackingProtectionSitesAllowedCookiesTitle",
|
||||
IDS_SETTINGS_TRACKING_PROTECTION_SITES_ALLOWED_COOKIES_TITLE},
|
||||
{"trackingProtectionSitesAllowedCookiesDescription",
|
||||
|
||||
@@ -52,10 +52,10 @@
|
||||
-#else
|
||||
text = l10n_util::GetStringUTF16(IDS_APP_MENU_BUTTON_UPDATE);
|
||||
-#endif
|
||||
} else {
|
||||
tooltip_message_id = IDS_APPMENU_TOOLTIP_ALERT;
|
||||
const int text_id =
|
||||
@@ -228,37 +199,19 @@ void BrowserAppMenuButton::UpdateTextAnd
|
||||
} else if (type_and_severity_.type ==
|
||||
AppMenuIconController::IconType::kHeliumServicesUpdate) {
|
||||
tooltip_message_id = IDS_APPMENU_TOOLTIP_HELIUM_SERVICES_UPDATE;
|
||||
@@ -233,37 +204,19 @@ void BrowserAppMenuButton::UpdateTextAnd
|
||||
}
|
||||
|
||||
bool BrowserAppMenuButton::ShouldPaintBorder() const {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/chrome/browser/ui/toolbar/app_menu_model.cc
|
||||
+++ b/chrome/browser/ui/toolbar/app_menu_model.cc
|
||||
@@ -739,9 +739,6 @@ SaveAndShareSubMenuModel::SaveAndShareSu
|
||||
@@ -740,9 +740,6 @@ SaveAndShareSubMenuModel::SaveAndShareSu
|
||||
if (!sharing_hub::SharingIsDisabledByPolicy(browser->profile())) {
|
||||
AddItemWithStringIdAndVectorIcon(
|
||||
this, IDC_COPY_URL, IDS_APP_MENU_COPY_LINK, kLinkChromeRefreshIcon);
|
||||
@@ -10,7 +10,7 @@
|
||||
AddItemWithStringIdAndVectorIcon(this, IDC_QRCODE_GENERATOR,
|
||||
IDS_APP_MENU_CREATE_QR_CODE,
|
||||
kQrCodeChromeRefreshIcon);
|
||||
@@ -885,14 +882,6 @@ void ToolsMenuModel::Build(Browser* brow
|
||||
@@ -886,14 +883,6 @@ void ToolsMenuModel::Build(Browser* brow
|
||||
AddItemWithStringIdAndVectorIcon(this, IDC_NAME_WINDOW, IDS_NAME_WINDOW,
|
||||
kNameWindowIcon);
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
if (base::FeatureList::IsEnabled(contextual_tasks::kContextualTasks)) {
|
||||
AddItemWithStringIdAndVectorIcon(
|
||||
this, IDC_SHOW_CONTEXTUAL_TASKS_SIDE_PANEL,
|
||||
@@ -901,15 +890,6 @@ void ToolsMenuModel::Build(Browser* brow
|
||||
@@ -902,15 +891,6 @@ void ToolsMenuModel::Build(Browser* brow
|
||||
|
||||
AddSeparator(ui::NORMAL_SEPARATOR);
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
AddItemWithStringIdAndVectorIcon(this, IDC_PERFORMANCE, IDS_SHOW_PERFORMANCE,
|
||||
kPerformanceIcon);
|
||||
SetElementIdentifierAt(GetIndexOfCommandId(IDC_PERFORMANCE).value(),
|
||||
@@ -1760,22 +1740,8 @@ void AppMenuModel::Build() {
|
||||
@@ -1761,22 +1741,8 @@ void AppMenuModel::Build() {
|
||||
// Build (and, by extension, Init) should only be called once.
|
||||
DCHECK_EQ(0u, GetItemCount());
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
AddSeparator(ui::NORMAL_SEPARATOR);
|
||||
}
|
||||
|
||||
@@ -1812,43 +1778,6 @@ void AppMenuModel::Build() {
|
||||
@@ -1813,43 +1779,6 @@ void AppMenuModel::Build() {
|
||||
|
||||
AddSeparator(ui::NORMAL_SEPARATOR);
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
if (!browser_->profile()->IsOffTheRecord()) {
|
||||
auto recent_tabs_sub_menu =
|
||||
std::make_unique<RecentTabsSubMenuModel>(provider_, browser_);
|
||||
@@ -1870,7 +1799,7 @@ void AppMenuModel::Build() {
|
||||
@@ -1871,7 +1800,7 @@ void AppMenuModel::Build() {
|
||||
std::make_unique<BookmarkSubMenuModel>(this, browser_);
|
||||
|
||||
AddSubMenuWithStringIdAndVectorIcon(
|
||||
@@ -119,7 +119,7 @@
|
||||
bookmark_sub_menu_model_.get(), kBookmarksListsMenuIcon);
|
||||
SetElementIdentifierAt(GetIndexOfCommandId(IDC_BOOKMARKS_MENU).value(),
|
||||
kBookmarksMenuItem);
|
||||
@@ -1887,23 +1816,10 @@ void AppMenuModel::Build() {
|
||||
@@ -1888,23 +1817,10 @@ void AppMenuModel::Build() {
|
||||
kTabGroupsMenuItem);
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@
|
||||
|
||||
AddItemWithStringIdAndVectorIcon(this, IDC_CLEAR_BROWSING_DATA,
|
||||
IDS_CLEAR_BROWSING_DATA,
|
||||
@@ -1950,9 +1866,6 @@ void AppMenuModel::Build() {
|
||||
@@ -1951,9 +1867,6 @@ void AppMenuModel::Build() {
|
||||
lens::features::kLensOverlay));
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@
|
||||
CreateFindAndEditSubMenu();
|
||||
|
||||
sub_menus_.push_back(
|
||||
@@ -2001,6 +1914,12 @@ void AppMenuModel::Build() {
|
||||
@@ -2002,6 +1915,12 @@ void AppMenuModel::Build() {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -170,7 +170,7 @@
|
||||
AddItemWithStringIdAndVectorIcon(this, IDC_OPTIONS, IDS_SETTINGS,
|
||||
kSettingsMenuIcon);
|
||||
|
||||
@@ -2096,34 +2015,21 @@ bool AppMenuModel::AddDefaultBrowserMenu
|
||||
@@ -2098,34 +2017,21 @@ bool AppMenuModel::AddDefaultBrowserMenu
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -217,12 +217,12 @@
|
||||
+ return false;
|
||||
}
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS)
|
||||
bool AppMenuModel::AddHeliumSchemaItem() {
|
||||
--- a/chrome/browser/ui/toolbar/app_menu_model.h
|
||||
+++ b/chrome/browser/ui/toolbar/app_menu_model.h
|
||||
@@ -281,6 +281,9 @@ class AppMenuModel : public ui::SimpleMe
|
||||
// boolean indicating whether any menu items were added.
|
||||
bool AddDefaultBrowserMenuItems();
|
||||
@@ -284,6 +284,9 @@ class AppMenuModel : public ui::SimpleMe
|
||||
// Adds a nag to review Helium services permission changes
|
||||
bool AddHeliumSchemaItem();
|
||||
|
||||
+ // Adds a nag to relaunch the browser after an update
|
||||
+ bool AddUpgradeMenuItem();
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
};
|
||||
--- a/chrome/app/generated_resources.grd
|
||||
+++ b/chrome/app/generated_resources.grd
|
||||
@@ -13438,6 +13438,9 @@ Check your passwords anytime in <ph name
|
||||
@@ -13441,6 +13441,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>
|
||||
|
||||
@@ -118,6 +118,7 @@ helium/core/add-zen-importer.patch
|
||||
helium/core/disable-unsupported-importers.patch
|
||||
helium/core/fix-building-without-safebrowsing.patch
|
||||
helium/core/services-prefs.patch
|
||||
helium/core/services-schema-nag.patch
|
||||
helium/core/override-chrome-protocol.patch
|
||||
helium/core/onboarding-page.patch
|
||||
helium/core/change-chromium-branding.patch
|
||||
|
||||
Reference in New Issue
Block a user