Compare commits

...

44 Commits

Author SHA1 Message Date
wukko dfd5a4b8f8 revision: bump to 15 2025-08-04 23:00:24 +06:00
wukko 89ee3b3b14 helium/settings: fix section separators 2025-08-04 16:28:28 +06:00
wukko cfa6338be0 helium/core/eu-search: replace the settings subtitle 2025-08-04 16:28:06 +06:00
wukko fe8ffb61e4 helium/core/flags-setup: put helium flags on top 2025-08-04 16:27:43 +06:00
wukko af66427d7a helium/ui: clean incognito & guest ntp
- removed inactive 3rd party cookies toggle
- replaced incognito text with a helium variant
- removed learn more link from guest ntp
2025-08-02 16:32:23 +06:00
wukko 72be230adb revision: bump to 14 2025-07-31 13:09:07 +06:00
wukko 5973e33db0 helium/core: add a flag for disabling ECH 2025-07-31 12:58:13 +06:00
wukko ce3794932e patches: refresh for 138.0.7204.183 2025-07-31 12:10:12 +06:00
wukko c3c2cfdce5 Update to Chromium 138.0.7204.183 2025-07-30 20:49:41 +06:00
wukko d5328e5468 revision: bump to 13 2025-07-29 15:34:02 +06:00
wukko df3f623ce3 utils: raise an error if a line in resource file is invalid 2025-07-29 15:29:34 +06:00
wukko c85860fa87 utils & resources: generate scaled resources with a script 2025-07-29 15:29:28 +06:00
wukko 5bf0662a2e resources/branding: add various app icons 2025-07-29 13:53:16 +06:00
wukko 9721334c56 resources/branding: remove product_icon dir
it'll be replaced with automatically generated resources
2025-07-29 13:34:05 +06:00
wukko 374735e1ba resouces/branding: update & fix colored skia product logo 2025-07-28 17:54:36 +06:00
wukko 5333dad88e resources/branding: update product_logo.svg with new icon design 2025-07-28 17:54:36 +06:00
wukko f353c28ab7 resources/branding: update product_logo for better legibility 2025-07-28 17:54:35 +06:00
jj 0d9cf8aefa lint/tests: convert prints into asserts 2025-07-28 11:45:32 +00:00
jj 9d9d4479ae devutils/lint: fix pylint errors 2025-07-28 11:45:31 +00:00
jj b2ea2d84bd patches: refresh add-update-channel-flag.patch 2025-07-28 11:45:05 +00:00
wukko ea001f53af patches/helium: add helium license header to files that don't have it 2025-07-28 17:10:30 +06:00
wukko 29b9fd70dd devutils/lint_tests: fix license header check 2025-07-28 16:15:21 +06:00
wukko cd5f460053 patches/helium/core: fix incorrect header guards 2025-07-28 16:02:51 +06:00
wukko 0c784d8e79 devutils: add script for checking patch correctness (#29) 2025-07-28 15:28:27 +06:00
jj a86284a2c8 dev/lint: handle error correctly if defines are completely missing 2025-07-27 22:30:49 +00:00
jj 10132253e9 ci: add linting to ci 2025-07-27 22:25:45 +00:00
jj deeebee817 devutils: add script for checking patch correctness 2025-07-27 22:25:45 +00:00
jj 88d7a03d8d replace_resources: clean up error handling 2025-07-27 20:45:59 +00:00
jj 7b231012ef scripts: fix lint errors
utils: lint

helium_version: fix lint errors

name_substitution: fix lint errors

devutils: lint
2025-07-27 20:52:01 +00:00
jj 8013b3af73 ci: add ensurepip to cirrus 2025-07-27 20:24:53 +00:00
jj d2bb884eee ci: run cirrus tasks 2025-07-27 20:15:02 +00:00
wukko a25b8fdf15 revision: bump to 12 2025-07-24 20:38:09 +06:00
wukko 07314070e0 helium/core/split-view: fix corner radius 2025-07-24 20:32:46 +06:00
wukko b8e154c0a4 merge: update to ungoogled-chromium 138.0.7204.168 2025-07-24 18:45:59 +06:00
jj edd517e75f extras: update onboarding 2025-07-24 12:04:50 +00:00
jj dc4a8b6686 patches/scan-chrome-native-messaging-hosts: fix windows constant type 2025-07-23 21:26:08 +00:00
Blaise 5fd0da8902 Update to Chromium 138.0.7204.168 2025-07-23 15:43:49 -05:00
jj 2fe35f1cbc extras: update onboarding 2025-07-23 14:37:25 +00:00
jj c0e49a6e5f patches/disable-gcm: disable additional gcm client methods 2025-07-18 16:49:32 +00:00
wukko a68148b1b3 revision: bump to 11 2025-07-18 14:43:27 +06:00
wukko d7a24f79d3 patches: refresh for 138.0.7204.157 2025-07-18 14:27:57 +06:00
wukko ba4fee2f1c merge: update to ungoogled-chromium 138.0.7204.157 2025-07-18 13:01:57 +06:00
Derron Hu ada3db3214 Add -snld flag to 7z (#3387) 2025-07-17 17:29:20 -05:00
networkException 4473e83be8 Update to Chromium 138.0.7204.157 2025-07-15 21:09:55 +02:00
53 changed files with 774 additions and 221 deletions
+2 -2
View File
@@ -11,7 +11,7 @@ code_check_task:
pip_cache:
folder: /usr/local/lib/python3.10/site-packages
fingerprint_script: cat .cirrus_requirements.txt
populate_script: pip install -r .cirrus_requirements.txt
populate_script: python3 -m ensurepip && pip install -r .cirrus_requirements.txt
utils_script:
- python3 -m yapf --style '.style.yapf' -e '*/third_party/*' -rpd utils
- ./devutils/run_utils_pylint.py --hide-fixme
@@ -28,7 +28,7 @@ validate_with_source_task:
pip_cache:
folder: /usr/local/lib/python3.10/site-packages
fingerprint_script: cat .cirrus_requirements.txt
populate_script: pip install -r .cirrus_requirements.txt
populate_script: python3 -m ensurepip && pip install -r .cirrus_requirements.txt
chromium_download_script: |
# These directories will not exist when this is called, unless cache retrieval
# fails and leaves partially-complete files around.
+1
View File
@@ -6,4 +6,5 @@ pytest-cov==4.0.0
pytest==7.2.1
httplib2==0.20.4
requests==2.28.1
pillow==11.3.0
yapf==0.32.0
+13
View File
@@ -0,0 +1,13 @@
name: cirrus
on: [push, pull_request]
permissions:
contents: read
jobs:
cirrus:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cirruslabs/cirrus-action@ac5191d18a9bff05ff1a38f280f2b6d768e32153
+16
View File
@@ -0,0 +1,16 @@
name: Check patch series correctness
on: [push, pull_request]
permissions:
contents: read
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.13'
- run: python3 ./devutils/lint.py
+3
View File
@@ -11,3 +11,6 @@ __pycache__/
# Ignore optional build / cache directory
/build
# Ignore generated resources
/resources/generated
+1 -1
View File
@@ -1 +1 @@
138.0.7204.100
138.0.7204.183
+114
View File
@@ -0,0 +1,114 @@
# pylint: disable=missing-function-docstring,invalid-name,global-statement,missing-module-docstring
# 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.
from third_party import unidiff
LICENSE_HEADER_IGNORES = ["html", "license", "readme"]
patches_dir = None
series = None
def _read_text(path):
with open(patches_dir / path, "r", encoding="utf-8") as f:
return filter(str, f.read().splitlines())
def _init(root):
global patches_dir
global series
patches_dir = root / "patches"
series = set(_read_text("series"))
def a_all_patches_in_series_exist():
for patch in series:
assert (patches_dir / patch).is_file(), \
f"{patch} is in series, but does not exist in the source tree"
def a_all_patches_in_tree_are_in_series():
for patch in patches_dir.rglob('*'):
if not patch.is_file() or patch == patches_dir / "series":
continue
assert str(patch.relative_to(patches_dir)) in series, \
f"{patch} exists in source tree, but is not included in the series"
def b_all_patches_have_meaningful_contents():
for patch in series:
assert any(l.startswith('+++ ') for l in _read_text(patch)), \
f"{patch} does not have any meaningful content"
def b_all_patches_have_no_trailing_whitespace():
for patch in series:
for i, line in enumerate(_read_text(patch)):
if not line.startswith('+ '):
continue
assert not line.endswith(' '), \
f"{patch} contains trailing whitespace on line {i + 1}"
def c_all_new_files_have_license_header():
for patch in series:
if 'helium' not in patch:
continue
patch_set = unidiff.PatchSet('\n'.join(_read_text(patch)))
added_files = filter(lambda f: f.is_added_file, patch_set)
for file in added_files:
if any(p in file.path.lower() for p in LICENSE_HEADER_IGNORES):
continue
assert any('terms of the GPL-3.0 license' in str(hunk) for hunk in file), \
f"File {file.path} was added in {patch}, but contains no Helium license header"
def c_all_new_headers_have_correct_guard():
for patch in series:
if 'helium' not in patch:
continue
patch_set = unidiff.PatchSet('\n'.join(_read_text(patch)))
added_files = filter(lambda f: f.is_added_file and f.path.endswith('.h'), patch_set)
for file in added_files:
expected_macro_name = file.path.upper() \
.replace('.', '_') \
.replace('/', '_') + '_'
assert len(file) == 1
expected = {
"ifndef": f'#ifndef {expected_macro_name}',
"define": f'#define {expected_macro_name}'
}
found = {
"ifndef": None,
"define": None,
}
for _line in file[0]:
line = str(_line)
if '#ifndef' in line:
assert found["define"] is None
assert found["ifndef"] is None
found["ifndef"] = line
elif '#define' in line:
assert found["ifndef"] is not None
assert found["define"] is None
found["define"] = line
for macro_type, value in found.items():
value_print = (value or '(none)').rstrip()
assert value == f"+{expected[macro_type]}\n", \
f"Patch {patch} has unexpected {macro_type} in {file.path}:" \
f"{value_print}, expecting: {expected[macro_type]}"
+46
View File
@@ -0,0 +1,46 @@
#!/usr/bin/env python3
# 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.
"""Script to run sanity checks against the Helium patchset."""
import sys
import inspect
import argparse
from pathlib import Path
import _lint_tests
def parse_args():
"""Parses the CLI arguments."""
parser = argparse.ArgumentParser()
parser.add_argument('-t', '--tree', help='root of the source tree to check')
return parser.parse_args()
def main():
"""CLI entrypoint for executing tests"""
args = parse_args()
root_dir = (Path(__file__).parent / "..").resolve()
if args.tree:
root_dir = Path(args.tree).resolve()
_lint_tests._init(root_dir) # pylint: disable=protected-access
for name, func in inspect.getmembers(_lint_tests, inspect.isfunction):
if name.startswith("_"):
continue
try:
func()
print(f"[OK] {name}")
except Exception:
print(f"[ERR] {name}:", file=sys.stderr)
raise
if __name__ == '__main__':
main()
-1
View File
@@ -7,7 +7,6 @@
# Copyright (c) 2019 The ungoogled-chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE.ungoogled_chromium file.
"""
Update binary pruning and domain substitution lists automatically.
-1
View File
@@ -8,7 +8,6 @@
# Copyright (c) 2019 The ungoogled-chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE.ungoogled_chromium file.
"""
Utility to ease the updating of platform patches against ungoogled-chromium's patches
"""
+2 -2
View File
@@ -5,8 +5,8 @@ sha256 = cd954c7257f126be871f79ecf8fff143425708d5d33501d0ba870fa466dafbe7
output_path = ./components/resources/default_100_percent/search_engine_choice
[onboarding]
version = 202507171319
version = 202507241203
url = https://github.com/imputnet/helium-onboarding/releases/download/%(version)s/helium-onboarding-%(version)s.tar.gz
download_filename = onboarding-page-%(version)s.tar.gz
sha256 = 63fd245da57884d1fde5e48a6ed56b6204170f082af35dd280ab3ccbab3da57e
sha256 = ee993f917371f53f5f9e5fee347425d96f1793a5613058dc18f123f41e84f02f
output_path = ./components/helium_onboarding
@@ -2,7 +2,46 @@
--- a/components/gcm_driver/gcm_client_impl.cc
+++ b/components/gcm_driver/gcm_client_impl.cc
@@ -431,6 +431,7 @@ void GCMClientImpl::StartGCM() {
@@ -296,38 +296,6 @@ void GCMClientImpl::Initialize(
}
void GCMClientImpl::Start(StartMode start_mode) {
- DCHECK_NE(UNINITIALIZED, state_);
- DCHECK(io_task_runner_->RunsTasksInCurrentSequence());
-
- if (state_ == LOADED) {
- // Start the GCM if not yet.
- if (start_mode == IMMEDIATE_START) {
- // Give up the scheduling to wipe out the store since now some one starts
- // to use GCM.
- destroying_gcm_store_ptr_factory_.InvalidateWeakPtrs();
-
- StartGCM();
- }
- return;
- }
-
- // The delay start behavior will be abandoned when Start has been called
- // once with IMMEDIATE_START behavior.
- if (start_mode == IMMEDIATE_START)
- start_mode_ = IMMEDIATE_START;
-
- // Bail out if the loading is not started or completed.
- if (state_ != INITIALIZED)
- return;
-
- // Once the loading is completed, the check-in will be initiated.
- // If we're in lazy start mode, don't create a new store since none is really
- // using GCM functionality yet.
- gcm_store_->Load((start_mode == IMMEDIATE_START) ? GCMStore::CREATE_IF_MISSING
- : GCMStore::DO_NOT_CREATE,
- base::BindOnce(&GCMClientImpl::OnLoadCompleted,
- weak_ptr_factory_.GetWeakPtr()));
- state_ = LOADING;
}
void GCMClientImpl::OnLoadCompleted(
@@ -431,6 +399,7 @@ void GCMClientImpl::StartGCM() {
void GCMClientImpl::InitializeMCSClient() {
DCHECK(network_connection_tracker_);
@@ -10,7 +49,37 @@
std::vector<GURL> endpoints;
endpoints.push_back(gservices_settings_.GetMCSMainEndpoint());
GURL fallback_endpoint = gservices_settings_.GetMCSFallbackEndpoint();
@@ -610,23 +611,6 @@ void GCMClientImpl::RemoveHeartbeatInter
@@ -482,8 +451,6 @@ void GCMClientImpl::OnReady(const std::v
void GCMClientImpl::StartMCSLogin() {
DCHECK_EQ(READY, state_);
DCHECK(device_checkin_info_.IsValid());
- mcs_client_->Login(device_checkin_info_.android_id,
- device_checkin_info_.secret);
}
void GCMClientImpl::DestroyStoreWhenNotNeeded() {
@@ -554,8 +521,6 @@ void GCMClientImpl::SetLastTokenFetchTim
void GCMClientImpl::UpdateHeartbeatTimer(
std::unique_ptr<base::RetainingOneShotTimer> timer) {
DCHECK(io_task_runner_->RunsTasksInCurrentSequence());
- DCHECK(mcs_client_);
- mcs_client_->UpdateHeartbeatTimer(std::move(timer));
}
void GCMClientImpl::AddInstanceIDData(const std::string& app_id,
@@ -598,35 +563,14 @@ void GCMClientImpl::GetInstanceIDData(co
void GCMClientImpl::AddHeartbeatInterval(const std::string& scope,
int interval_ms) {
DCHECK(io_task_runner_->RunsTasksInCurrentSequence());
- DCHECK(mcs_client_);
- mcs_client_->AddHeartbeatInterval(scope, interval_ms);
}
void GCMClientImpl::RemoveHeartbeatInterval(const std::string& scope) {
DCHECK(io_task_runner_->RunsTasksInCurrentSequence());
- DCHECK(mcs_client_);
- mcs_client_->RemoveHeartbeatInterval(scope);
}
void GCMClientImpl::StartCheckin() {
DCHECK(io_task_runner_->RunsTasksInCurrentSequence());
@@ -34,7 +103,7 @@
}
void GCMClientImpl::OnCheckinCompleted(
@@ -683,24 +667,6 @@ void GCMClientImpl::SetGServicesSettings
@@ -683,24 +627,6 @@ void GCMClientImpl::SetGServicesSettings
void GCMClientImpl::SchedulePeriodicCheckin() {
DCHECK(io_task_runner_->RunsTasksInCurrentSequence());
@@ -59,3 +128,29 @@
}
base::TimeDelta GCMClientImpl::GetTimeToNextCheckin() const {
@@ -1124,25 +1050,6 @@ void GCMClientImpl::Send(const std::stri
const OutgoingMessage& message) {
DCHECK_EQ(state_, READY);
DCHECK(io_task_runner_->RunsTasksInCurrentSequence());
-
- mcs_proto::DataMessageStanza stanza;
- stanza.set_ttl(message.time_to_live);
- stanza.set_sent(clock_->Now().ToInternalValue() /
- base::Time::kMicrosecondsPerSecond);
- stanza.set_id(message.id);
- stanza.set_from(kSendMessageFromValue);
- stanza.set_to(receiver_id);
- stanza.set_category(app_id);
-
- for (auto iter = message.data.begin(); iter != message.data.end(); ++iter) {
- mcs_proto::AppData* app_data = stanza.add_app_data();
- app_data->set_key(iter->first);
- app_data->set_value(iter->second);
- }
-
- MCSMessage mcs_message(stanza);
- DVLOG(1) << "MCS message size: " << mcs_message.size();
- mcs_client_->SendMessage(mcs_message);
}
std::string GCMClientImpl::GetStateString() const {
@@ -930,7 +930,7 @@
"//chrome/browser/search/background",
"//chrome/browser/search/background:constants",
"//chrome/browser/search_engine_choice:unit_tests",
@@ -8413,7 +8405,6 @@ test("unit_tests") {
@@ -8414,7 +8406,6 @@ test("unit_tests") {
"//components/webapps/browser",
"//services/metrics/public/cpp:ukm_builders",
"//services/network:test_support",
@@ -41,7 +41,7 @@
#include "base/feature_list.h"
#include "base/format_macros.h"
#include "base/functional/bind.h"
@@ -566,6 +567,15 @@ AutocompleteController::AutocompleteCont
@@ -568,6 +569,15 @@ AutocompleteController::AutocompleteCont
steady_state_omnibox_position_(
metrics::OmniboxEventProto::UNKNOWN_POSITION) {
provider_types &= ~OmniboxFieldTrial::GetDisabledProviderTypes();
@@ -0,0 +1,44 @@
--- a/chrome/browser/helium_flag_choices.h
+++ b/chrome/browser/helium_flag_choices.h
@@ -26,6 +26,8 @@ namespace helium {
{kChannelBeta, kChannelCommandLine, kChannelBeta},
};
+ constexpr const char kDisableEchCommandLine[] = "disable-ech";
+
} // namespace helium
#endif /* CHROME_BROWSER_HELIUM_FLAG_CHOICES_H_ */
--- a/chrome/browser/helium_flag_entries.h
+++ b/chrome/browser/helium_flag_entries.h
@@ -11,4 +11,9 @@
"Maximum frame rate for Energy Saver",
"Configures the frame rate the browser is throttled to when Energy Saver is enabled. Helium flag.",
kOsDesktop, MULTI_VALUE_TYPE(helium::kEnergySaverFrameRateChoices)},
+ {helium::kDisableEchCommandLine,
+ "Disable ECH (Encrypted Client Hello)",
+ "Disables TLS Encrypted Client Hello. Not recommended unless you live in an area with heavy Internet"
+ " censorship and ECH prevents websites from loading. Helium flag.",
+ kOsAll, SINGLE_VALUE_TYPE(helium::kDisableEchCommandLine)},
#endif /* CHROME_BROWSER_HELIUM_FLAG_ENTRIES_H_ */
--- a/chrome/browser/ssl/ssl_config_service_manager.cc
+++ b/chrome/browser/ssl/ssl_config_service_manager.cc
@@ -10,6 +10,7 @@
#include <string_view>
#include <vector>
+#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/location.h"
@@ -232,6 +233,10 @@ network::mojom::SSLConfigPtr SSLConfigSe
config->ech_enabled = ech_enabled_.GetValue();
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch("disable-ech")) {
+ config->ech_enabled = false;
+ }
+
if (post_quantum_enabled_.IsManaged()) {
config->post_quantum_key_agreement_enabled =
post_quantum_enabled_.GetValue();
@@ -1,6 +1,6 @@
--- a/chrome/browser/helium_flag_choices.h
+++ b/chrome/browser/helium_flag_choices.h
@@ -7,6 +7,15 @@
@@ -11,6 +11,15 @@
namespace helium {
using namespace ::helium;
@@ -18,12 +18,13 @@
#endif /* CHROME_BROWSER_HELIUM_FLAG_CHOICES_H_ */
--- a/chrome/browser/helium_flag_entries.h
+++ b/chrome/browser/helium_flag_entries.h
@@ -1,3 +1,7 @@
@@ -4,4 +4,8 @@
#ifndef CHROME_BROWSER_HELIUM_FLAG_ENTRIES_H_
#define CHROME_BROWSER_HELIUM_FLAG_ENTRIES_H_
+ {helium::kEnergySaverFrameRateCommandLine,
+ "Maximum frame rate for Energy Saver",
+ "Configures the frame rate the browser is throttled to when Energy Saver is enabled. Helium flag",
+ "Configures the frame rate the browser is throttled to when Energy Saver is enabled. Helium flag.",
+ kOsDesktop, MULTI_VALUE_TYPE(helium::kEnergySaverFrameRateChoices)},
#endif /* CHROME_BROWSER_HELIUM_FLAG_ENTRIES_H_ */
--- a/chrome/browser/performance_manager/user_tuning/battery_saver_mode_manager.cc
+3 -3
View File
@@ -472,8 +472,8 @@
+// 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_SEARCH_ENGINES_BANG_PROVIDER_H_
+#define COMPONENTS_SEARCH_ENGINES_BANG_PROVIDER_H_
+#ifndef COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_BANG_MANAGER_H_
+#define COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_BANG_MANAGER_H_
+
+#include <memory>
+#include <string>
@@ -541,7 +541,7 @@
+ };
+}
+
+#endif // COMPONENTS_SEARCH_ENGINES_BANG_PROVIDER_H_
+#endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_BANG_MANAGER_H_
+
--- a/components/omnibox/browser/autocomplete_input.cc
+++ b/components/omnibox/browser/autocomplete_input.cc
@@ -10,13 +10,16 @@
#include "chrome/browser/ip_protection/ip_protection_switches.h"
--- /dev/null
+++ b/chrome/browser/channel_selection.cc
@@ -0,0 +1,25 @@
@@ -0,0 +1,28 @@
+// 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 <string>
+
+#include "base/command_line.h"
+#include "chrome/browser/channel_selection.h"
+
+
+namespace helium {
+
+std::string GetSelectedChannel() {
@@ -38,7 +41,11 @@
+} // namespace helium
--- /dev/null
+++ b/chrome/browser/channel_selection.h
@@ -0,0 +1,15 @@
@@ -0,0 +1,19 @@
+// 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_CHANNEL_SELECTION_H_
+#define CHROME_BROWSER_CHANNEL_SELECTION_H_
+
@@ -56,7 +63,7 @@
+#endif /* CHROME_BROWSER_CHANNEL_SELECTION_H_ */
--- a/chrome/browser/helium_flag_choices.h
+++ b/chrome/browser/helium_flag_choices.h
@@ -16,6 +16,12 @@ namespace helium {
@@ -20,6 +20,12 @@ namespace helium {
{"Disabled", kEnergySaverFrameRateCommandLine, "9001"},
};
@@ -71,7 +78,8 @@
#endif /* CHROME_BROWSER_HELIUM_FLAG_CHOICES_H_ */
--- a/chrome/browser/helium_flag_entries.h
+++ b/chrome/browser/helium_flag_entries.h
@@ -1,5 +1,8 @@
@@ -4,6 +4,9 @@
#ifndef CHROME_BROWSER_HELIUM_FLAG_ENTRIES_H_
#define CHROME_BROWSER_HELIUM_FLAG_ENTRIES_H_
+ {helium::kChannelCommandLine,
@@ -79,7 +87,7 @@
+ kOsAll, MULTI_VALUE_TYPE(helium::kChannelChoices)},
{helium::kEnergySaverFrameRateCommandLine,
"Maximum frame rate for Energy Saver",
"Configures the frame rate the browser is throttled to when Energy Saver is enabled. Helium flag",
"Configures the frame rate the browser is throttled to when Energy Saver is enabled. Helium flag.",
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -281,6 +281,8 @@ static_library("browser") {
@@ -33,7 +33,7 @@
ui::VKEY_N},
--- a/chrome/browser/ui/views/accelerator_table.cc
+++ b/chrome/browser/ui/views/accelerator_table.cc
@@ -267,7 +267,7 @@ const AcceleratorMapping kDevToolsAccele
@@ -269,7 +269,7 @@ const AcceleratorMapping kDevToolsAccele
{ui::VKEY_J, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN,
IDC_DEV_TOOLS_CONSOLE},
{ui::VKEY_C, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN,
+17 -9
View File
@@ -1,22 +1,26 @@
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -4733,11 +4733,13 @@ const FeatureEntry::FeatureVariation kHi
@@ -4729,11 +4729,13 @@ const FeatureEntry::FeatureVariation kHi
// calculate and verify checksum.
//
// When adding a new choice, add it to the end of the list.
+#include "chrome/browser/helium_flag_choices.h"
#include "chrome/browser/ungoogled_flag_choices.h"
#include "chrome/browser/bromite_flag_choices.h"
#include "chrome/browser/ungoogled_platform_flag_choices.h"
#include "chrome/browser/existing_switch_flag_choices.h"
+#include "chrome/browser/helium_flag_choices.h"
const FeatureEntry kFeatureEntries[] = {
+#include "chrome/browser/helium_flag_entries.h"
#include "chrome/browser/ungoogled_flag_entries.h"
#include "chrome/browser/bromite_flag_entries.h"
#include "chrome/browser/ungoogled_platform_flag_entries.h"
#include "chrome/browser/existing_switch_flag_entries.h"
+#include "chrome/browser/helium_flag_entries.h"
// Include generated flags for flag unexpiry; see //docs/flag_expiry.md and
// //tools/flags/generate_unexpire_flags.py.
#include "build/chromeos_buildflags.h"
--- /dev/null
+++ b/chrome/browser/helium_flag_choices.h
@@ -0,0 +1,12 @@
@@ -0,0 +1,16 @@
+// 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_HELIUM_FLAG_CHOICES_H_
+#define CHROME_BROWSER_HELIUM_FLAG_CHOICES_H_
+
@@ -31,7 +35,11 @@
+#endif /* CHROME_BROWSER_HELIUM_FLAG_CHOICES_H_ */
--- /dev/null
+++ b/chrome/browser/helium_flag_entries.h
@@ -0,0 +1,3 @@
@@ -0,0 +1,7 @@
+// 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_HELIUM_FLAG_ENTRIES_H_
+#define CHROME_BROWSER_HELIUM_FLAG_ENTRIES_H_
+#endif /* CHROME_BROWSER_HELIUM_FLAG_ENTRIES_H_ */
@@ -28,7 +28,7 @@
- regional_capabilities->IsInEeaCountry()
- ? IDS_SEARCH_ENGINE_CHOICE_SETTINGS_SUBTITLE
- : IDS_SEARCH_ENGINE_CHOICE_SETTINGS_SUBTITLE_NON_EEA);
+ IDS_SEARCH_ENGINE_CHOICE_SETTINGS_SUBTITLE);
+ IDS_SEARCH_ENGINE_CHOICE_SETTINGS_SUBTITLE_HELIUM);
html_source->AddLocalizedString(
"saveGuestChoiceText", IDS_SEARCH_ENGINE_CHOICE_GUEST_SESSION_CHECKBOX);
@@ -44,3 +44,16 @@
// The `HasSearchEngineCountryListOverride()` check is here for compatibility
// with the way EEA presence was checked from `search_engines`. But it should
// logically be done only when the EEA presence is checked specifically for
--- a/components/search_engine_choice_strings.grdp
+++ b/components/search_engine_choice_strings.grdp
@@ -98,6 +98,10 @@
These search engines are popular in your region
</message>
+ <message name="IDS_SEARCH_ENGINE_CHOICE_SETTINGS_SUBTITLE_HELIUM" desc="This is the body text of a dialog where the user can change their default search engine. This string explains that the list of search engines is randomized (not in order of recommendation).">
+ This list of search engines is shown in random order.
+ </message>
+
<message name="IDS_SEARCH_ENGINE_CHOICE_SETTINGS_ENTRY_POINT_SUBTITLE" desc="This string is body text of a Chrome setting that lets a user select the search engine that they want to use. (A search engine provides answers to search queries; this is different from a browser, which displays web pages. A search engine powers many experiences within a browser.) The string explains how a search engine will impact their experience in Chrome. The “Learn more” link opens a help center article about the default search engine.">
The search engine you choose will be used for features like searching from the address bar and from images on web pages.
</message>
+3 -3
View File
@@ -201,8 +201,8 @@
+// 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_ONBOARDING_ONBOARDING_PAGE_H_
+#define CHROME_BROWSER_UI_WEBUI_ONBOARDING_ONBOARDING_PAGE_H_
+#ifndef CHROME_BROWSER_UI_WEBUI_ONBOARDING_ONBOARDING_PAGE_UI_H_
+#define CHROME_BROWSER_UI_WEBUI_ONBOARDING_ONBOARDING_PAGE_UI_H_
+
+#include "chrome/common/webui_url_constants.h"
+#include "content/public/browser/webui_config.h"
@@ -227,7 +227,7 @@
+ ~HeliumOnboardingPage() override;
+};
+
+#endif // CHROME_BROWSER_UI_WEBUI_ONBOARDING_ONBOARDING_PAGE_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 @@
@@ -147,7 +147,7 @@
+bool GetChromeUserDataDirectory(base::FilePath* result) {
+ if (!base::PathService::Get(base::DIR_LOCAL_APP_DATA, result))
+ return false;
+ *result = result->Append("Google\\Chrome");
+ *result = result->Append(L"Google\\Chrome");
+ *result = result->Append(chrome::kUserDataDirname);
+ return true;
+}
+8 -4
View File
@@ -177,7 +177,11 @@
+</div>
--- /dev/null
+++ b/chrome/browser/resources/settings/privacy_page/services_page.ts
@@ -0,0 +1,70 @@
@@ -0,0 +1,74 @@
+// 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';
@@ -410,8 +414,8 @@
+// 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_SEREVICES_HELIUM_SERVICES_HELPERS_H_
+#define COMPONENTS_HELIUM_SEREVICES_HELIUM_SERVICES_HELPERS_H_
+#ifndef COMPONENTS_HELIUM_SERVICES_HELIUM_SERVICES_HELPERS_H_
+#define COMPONENTS_HELIUM_SERVICES_HELIUM_SERVICES_HELPERS_H_
+
+#include "base/functional/bind.h"
+#include "components/prefs/pref_change_registrar.h"
@@ -433,7 +437,7 @@
+ PrefChangeRegistrar& registrar, const base::RepeatingClosure& observer);
+} // namespace helium
+
+#endif // COMPONENTS_HELIUM_SEREVICES_HELIUM_SERVICES_HELPERS_H_
+#endif // COMPONENTS_HELIUM_SERVICES_HELIUM_SERVICES_HELPERS_H_
--- /dev/null
+++ b/components/helium_services/pref_names.h
@@ -0,0 +1,18 @@
+11 -4
View File
@@ -38,8 +38,9 @@
static constexpr int kMinWebContentsWidth = 200;
static constexpr double kMinWebContentsWidthPercentage = 0.1;
- static constexpr int kContentCornerRadius = 6;
- static constexpr int kContentOutlineCornerRadius = 8;
+ static constexpr int kContentCornerRadius = 8;
static constexpr int kContentOutlineCornerRadius = 8;
+ static constexpr int kContentOutlineCornerRadius = 9;
static constexpr int kContentOutlineThickness = 1;
- static constexpr int kSplitViewContentInset = 8;
- static constexpr int kSplitViewContentPadding = 4;
@@ -129,13 +130,19 @@
return;
}
@@ -347,9 +327,6 @@ void MultiContentsView::UpdateContentsBo
@@ -343,13 +323,9 @@ void MultiContentsView::UpdateContentsBo
kColorMulitContentsViewActiveContentOutline)
: GetColorProvider()->GetColor(
kColorMulitContentsViewInactiveContentOutline);
- contents_container_view->SetBorder(views::CreatePaddedBorder(
+ contents_container_view->SetBorder(
views::CreateRoundedRectBorder(kContentOutlineThickness,
kContentOutlineCornerRadius, color),
gfx::Insets(kSplitViewContentPadding)));
- kContentOutlineCornerRadius, color),
- gfx::Insets(kSplitViewContentPadding)));
- // Mini toolbar should only be visible for the inactive contents
- // container view.
- contents_container_view->GetMiniToolbar()->SetVisible(!is_active);
+ kContentOutlineCornerRadius, color));
};
for (auto* contents_container_view : contents_container_views_) {
set_contents_border_and_mini_toolbar(contents_container_view);
@@ -0,0 +1,28 @@
--- a/chrome/browser/resources/settings/a11y_page/a11y_page.html
+++ b/chrome/browser/resources/settings/a11y_page/a11y_page.html
@@ -11,14 +11,7 @@
</if>
<if expr="not is_chromeos">
<template is="dom-if" if="[[captionSettingsOpensExternally_]]">
- <template is="dom-if" if="[[enableLiveCaption_]]">
- <settings-live-caption prefs="{{prefs}}"
- languages="[[languages]]"
- language-helper="[[languageHelper]]">
- </settings-live-caption>
- </template>
<cr-link-row id="captions"
- class="hr"
label="$i18n{captionsPreferencesTitle}"
sub-label="$i18n{captionsPreferencesSubtitle}"
on-click="onCaptionsClick_"
--- a/chrome/browser/resources/settings/languages_page/spell_check_page.html
+++ b/chrome/browser/resources/settings/languages_page/spell_check_page.html
@@ -57,7 +57,7 @@
<settings-animated-pages id="pages" section="spellCheck"
focus-config="[[focusConfig_]]">
<div route-path="default">
- <settings-toggle-button id="enableSpellcheckingToggle" class="hr"
+ <settings-toggle-button id="enableSpellcheckingToggle"
label="$i18n{offerToEnableSpellCheck}"
sub-label="[[getSpellCheckSubLabel_(spellCheckLanguages_)]]"
pref="{{prefs.browser.enable_spellchecking}}"
+1 -1
View File
@@ -59,7 +59,7 @@
#include "components/search_engines/template_url_service.h"
#include "components/search_engines/template_url_starter_pack_data.h"
#include "components/strings/grit/components_strings.h"
@@ -1850,7 +1851,21 @@ void AutocompleteController::UpdateKeywo
@@ -1855,7 +1856,21 @@ void AutocompleteController::UpdateKeywo
// - For contextual search matches, the description indicates the
// alternative UX because they're opened in the side panel.
i->description = template_url->AdjustedShortNameForLocaleDirection();
@@ -0,0 +1,69 @@
--- a/chrome/browser/resources/new_tab_page_incognito_guest/guest_tab.html
+++ b/chrome/browser/resources/new_tab_page_incognito_guest/guest_tab.html
@@ -10,8 +10,6 @@
<div class="content">
<h1>$i18n{guestTabHeading}</h1>
<p>$i18n{guestTabDescription}</p>
- <a class="learn-more-button" href="$i18n{learnMoreLink}"
- aria-label="$i18nPolymer{learnMoreA11yLabel}">$i18n{learnMore}</a>
</div>
</body>
</html>
--- a/chrome/browser/resources/new_tab_page_incognito_guest/incognito_tab.html
+++ b/chrome/browser/resources/new_tab_page_incognito_guest/incognito_tab.html
@@ -29,32 +29,6 @@ document.querySelector('#incognitothemec
<div class="bulletpoints first">$i18nRaw{incognitoTabFeatures}</div>
<div class="bulletpoints">$i18nRaw{incognitoTabWarning}</div>
</div>
- <div id="cookie-controls">
- <div id="cookie-controls-description">
- <div id="$i18n{cookieControlsHeader}">
- <svg viewBox="0 -960 960 960" $i18n{hideUserBypassIcon}
- aria-hidden="true">
- <path d="m637-425-62-62q4-38-23-65.5T487-576l-62-62q13-5 27-7.5t28-2.5q70 0 119 49t49 119q0 14-2.5 28t-8.5 27Zm133 133-52-52q36-28 65.5-61.5T833-480q-49-101-144.5-158.5T480-696q-26 0-51 3t-49 10l-58-58q38-15 77.5-21t80.5-6q143 0 261.5 77.5T912-480q-22 57-58.5 103.5T770-292Zm-2 202L638-220q-38 14-77.5 21t-80.5 7q-143 0-261.5-77.5T48-480q22-57 58-104t84-85L90-769l51-51 678 679-51 51ZM241-617q-35 28-65 61.5T127-480q49 101 144.5 158.5T480-264q26 0 51-3.5t50-9.5l-45-45q-14 5-28 7.5t-28 2.5q-70 0-119-49t-49-119q0-14 3.5-28t6.5-28l-81-81Zm287 89Zm-96 96Z"/>
- </svg>
- <em>$i18n{cookieControlsTitle}</em>
- </div>
- <span>$i18nRaw{cookieControlsDescription}</span>
- </div>
- <div $i18n{hideTooltipIcon}>
- <cr-tooltip-icon id="cookie-controls-tooltip-icon"
- icon-aria-label="$i18n{cookieControlsTitle}"
- icon-class="$i18n{cookieControlsToolTipIcon}"
- tooltip-text="$i18n{cookieControlsTooltipText}"
- role="link" style="cursor: pointer;">
- </cr-tooltip-icon>
- </div>
- <cr-toggle id="cookie-controls-toggle"
- aria-label="$i18n{cookieControlsTitle}"
- $i18n{hideBlockCookiesToggle}
- $i18n{cookieControlsToggleChecked}></cr-toggle>
- </div>
- <a class="learn-more-button" href="$i18n{learnMoreLink}"
- aria-label="$i18nPolymer{learnMoreA11yLabel}">$i18n{learnMore}</a>
</div>
<script type="module" src="incognito_tab.js"></script>
<!-- Lazy-load cr_elements to avoid performance penalty introduced by loading Polymer -->
--- a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
+++ b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
@@ -277,7 +277,7 @@ void NTPResourceCache::CreateNewTabIncog
CookieControlsServiceFactory::GetForProfile(incognito_profile);
replacements["incognitoTabDescription"] =
- l10n_util::GetStringUTF8(IDS_NEW_TAB_OTR_SUBTITLE_WITH_READING_LIST);
+ l10n_util::GetStringUTF8(IDS_NEW_TAB_OTR_SUBTITLE_HELIUM);
privacy_sandbox::TrackingProtectionSettings* tracking_protection_settings =
TrackingProtectionSettingsFactory::GetForProfile(incognito_profile);
--- a/components/new_or_sad_tab_strings.grdp
+++ b/components/new_or_sad_tab_strings.grdp
@@ -158,6 +158,9 @@
Others who use this device won’t see your activity, so you can browse more privately. This won't change how data is collected by websites you visit and the services they use, including Google. Downloads and bookmarks will be saved.
</message>
</if>
+ <message name="IDS_NEW_TAB_OTR_SUBTITLE_HELIUM" desc="Subtitle of the Incognito new tab page, explaining to the user that the Incognito mode hides their browsing activity from other people using the same device, and what data is exempt from it.">
+ Helium will not save anything about your browsing in Incognito, but downloads and bookmarks will stick around. Your browsing won't leave any traces on this device, and other users won't be able to see your activity.
+ </message>
<message name="IDS_NEW_TAB_OTR_SUBTITLE_WITH_READING_LIST" desc="Subtitle of the Incognito new tab page, explaining to the user that the Incognito mode hides their browsing activity from other people using the same device. The second sentence clarifies that there are two important exceptions from this rule - downloaded files and added bookmarks will be persisted even after the Incognito session is closed." formatter_data="android_java">
Others who use this device won’t see your activity, so you can browse more privately. This won't change how data is collected by websites you visit and the services they use, including Google. Downloads, bookmarks and reading list items will be saved.
</message>
+3
View File
@@ -148,6 +148,7 @@ helium/core/flags-setup.patch
helium/core/add-low-power-framerate-flag.patch
helium/core/add-update-channel-flag.patch
helium/core/add-updater-preference.patch
helium/core/add-disable-ech-flag.patch
helium/settings/move-search-suggest.patch
helium/settings/remove-autofill.patch
@@ -159,6 +160,7 @@ helium/settings/remove-translate-section.patch
helium/settings/remove-safety-hub-entry-points.patch
helium/settings/reenable-update-status.patch
helium/settings/privacy-page-tweaks.patch
helium/settings/fix-section-separators.patch
helium/hop/setup.patch
helium/hop/disable-password-manager.patch
@@ -209,3 +211,4 @@ helium/ui/fix-pwa-toolbar.patch
helium/ui/top-container.patch
helium/ui/toolbar-avatar-button.patch
helium/ui/status-bubble.patch
helium/ui/clean-incognito-guest-ntp.patch
Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 617 B

After

Width:  |  Height:  |  Size: 600 B

+1 -1
View File
@@ -1 +1 @@
<svg width="256" height="256" viewBox="0 0 256 256" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M256 79.7288C256 76.6897 256.001 73.6504 255.983 70.611C255.967 68.0507 255.938 65.491 255.868 62.932C255.718 57.3544 255.389 51.7289 254.397 46.2134C253.391 40.6184 251.748 35.4111 249.159 30.3275C246.614 25.3309 243.29 20.7586 239.323 16.7947C235.357 12.8307 230.784 9.50832 225.785 6.96479C220.696 4.37529 215.483 2.73304 209.882 1.72737C204.366 0.736929 198.739 0.408542 193.161 0.257863C190.601 0.188582 188.04 0.159378 185.478 0.143533C182.437 0.124893 179.396 0.126446 176.355 0.126446L141.048 0H114.64L79.9568 0.126446C76.91 0.126446 73.8632 0.124893 70.8164 0.143533C68.2496 0.159378 65.684 0.188582 63.1181 0.257863C57.5275 0.408542 51.8878 0.73724 46.3586 1.72893C40.75 2.73428 35.5294 4.37591 30.4336 6.96355C25.4246 9.50738 20.8412 12.8301 16.867 16.7947C12.8934 20.7583 9.56265 25.3296 7.01292 30.3253C4.4169 35.4114 2.77093 40.6218 1.76247 46.2199C0.769548 51.7333 0.44054 57.3568 0.289241 62.932C0.22027 65.4913 0.190445 68.051 0.174911 70.611C0.156271 73.6507 0 77.4264 0 80.4657L0.000932032 114.668L0 141.359L0.157824 176.288C0.157824 179.331 0.156581 182.375 0.174911 185.418C0.190445 187.982 0.22027 190.545 0.289551 193.108C0.44054 198.693 0.770169 204.326 1.76403 209.849C2.77217 215.451 4.41783 220.666 7.01168 225.756C9.56172 230.76 12.8931 235.338 16.867 239.308C20.8409 243.277 25.423 246.604 30.4312 249.151C35.53 251.744 40.7531 253.389 46.3652 254.396C51.8918 255.388 57.5297 255.717 63.1181 255.867C65.684 255.937 68.2499 255.966 70.8167 255.982C73.8635 256 76.91 255.999 79.9568 255.999L114.953 256H141.427L176.355 255.999C179.396 255.999 182.437 256 185.478 255.982C188.04 255.966 190.601 255.937 193.161 255.867C198.741 255.716 204.37 255.387 209.889 254.394C215.486 253.388 220.697 251.744 225.783 249.152C230.782 246.605 235.357 243.278 239.323 239.308C243.289 235.339 246.613 230.761 249.158 225.759C251.749 220.666 253.392 215.449 254.398 209.843C255.389 204.322 255.718 198.69 255.869 193.108C255.938 190.545 255.967 187.982 255.983 185.418C256.002 182.375 256 179.331 256 176.288C256 176.288 255.998 141.975 255.998 141.359V114.64C255.998 114.185 256 79.7288 256 79.7288Z" fill="#5566B1"/><path d="M122.494 51.4321C122.494 48.6035 124.787 46.3105 127.615 46.3105C130.444 46.3105 132.737 48.6035 132.737 51.4321V203.797C132.737 206.625 130.444 208.918 127.615 208.918C124.787 208.918 122.494 206.625 122.494 203.797V51.4321Z" fill="white"/><path d="M56.1719 63.3416C54.1719 61.3415 54.1719 58.0987 56.1719 56.0987C58.172 54.0986 61.4148 54.0986 63.4148 56.0987L199.899 192.582C201.899 194.582 201.899 197.825 199.899 199.825C197.899 201.825 194.656 201.825 192.656 199.825L56.1719 63.3416Z" fill="white"/><path d="M192.655 56.0977C194.655 54.0976 197.898 54.0976 199.898 56.0977C201.898 58.0978 201.898 61.3405 199.898 63.3406L63.4148 199.825C61.4147 201.825 58.172 201.825 56.1719 199.825C54.1718 197.824 54.1718 194.582 56.1719 192.582L192.655 56.0977Z" fill="white"/><path d="M204.182 122.876C207.01 122.876 209.303 125.169 209.303 127.998C209.303 130.826 207.01 133.119 204.182 133.119H51.8168C48.9883 133.119 46.6953 130.826 46.6953 127.998C46.6953 125.169 48.9883 122.876 51.8168 122.876H204.182Z" fill="white"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 256 256"><g clip-path="url(#a)"><path fill="url(#b)" d="M84.93 0h86.14c29.53 0 40.24 3.07 51.04 8.85a60.2 60.2 0 0 1 25.04 25.04c5.78 10.8 8.85 21.5 8.85 51.04v86.14c0 29.53-3.07 40.24-8.85 51.04a60.2 60.2 0 0 1-25.04 25.04c-10.8 5.78-21.5 8.85-51.04 8.85H84.93c-29.53 0-40.24-3.07-51.04-8.85a60.2 60.2 0 0 1-25.04-25.04C3.07 211.3 0 200.6 0 171.07V84.93C0 55.4 3.07 44.69 8.85 33.89A60.2 60.2 0 0 1 33.89 8.85C44.7 3.07 55.4 0 84.93 0Z"/><path fill="#fff" d="M133.38 47.5a5.5 5.5 0 1 0-11.01 0v160.24a5.5 5.5 0 1 0 11.01 0V47.51Z"/><path fill="#fff" d="M213.5 127.88a5.5 5.5 0 0 1-5.5 5.5H48.25a5.5 5.5 0 1 1 0-11.01h159.73a5.5 5.5 0 0 1 5.51 5.5Z"/><path fill="#fff" d="M52.45 52.07c2.1-2.1 5.5-2.1 7.6 0l143.32 143.74a5.4 5.4 0 0 1 0 7.63 5.37 5.37 0 0 1-7.59.01l-.01-.01L52.45 59.7a5.4 5.4 0 0 1 0-7.63Z"/><path fill="#fff" d="M203.38 52.07a5.4 5.4 0 0 1 0 7.63L60.06 203.44a5.37 5.37 0 0 1-7.6 0 5.4 5.4 0 0 1 0-7.63L195.76 52.07c2.1-2.1 5.5-2.1 7.6 0Z"/></g><defs><linearGradient id="b" x1="128" x2="128" y1="41.25" y2="256" gradientUnits="userSpaceOnUse"><stop stop-color="#152671"/><stop offset="1" stop-color="#5669BD"/></linearGradient><clipPath id="a"><path fill="#fff" d="M0 0h256v256H0z"/></clipPath></defs></svg>

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1009 B

+51 -82
View File
@@ -3,97 +3,66 @@
// the terms of the GPL-3.0 license that can be found in the LICENSE file.
CANVAS_DIMENSIONS, 256,
MOVE_TO, 256, 79.73f,
CUBIC_TO, 256, 76.69f, 256, 73.65f, 255.98f, 70.61f,
CUBIC_TO, 255.97f, 68.05f, 255.94f, 65.49f, 255.87f, 62.93f,
CUBIC_TO, 255.72f, 57.35f, 255.39f, 51.73f, 254.4f, 46.21f,
CUBIC_TO, 253.39f, 40.62f, 251.75f, 35.41f, 249.16f, 30.33f,
CUBIC_TO, 246.61f, 25.33f, 243.29f, 20.76f, 239.32f, 16.79f,
CUBIC_TO, 235.36f, 12.83f, 230.78f, 9.51f, 225.79f, 6.96f,
CUBIC_TO, 220.7f, 4.38f, 215.48f, 2.73f, 209.88f, 1.73f,
CUBIC_TO, 204.37f, 0.74f, 198.74f, 0.41f, 193.16f, 0.26f,
CUBIC_TO, 190.6f, 0.19f, 188.04f, 0.16f, 185.48f, 0.14f,
CUBIC_TO, 182.44f, 0.12f, 179.4f, 0.13f, 176.36f, 0.13f,
LINE_TO, 141.05f, 0,
H_LINE_TO, 114.64f,
LINE_TO, 79.96f, 0.13f,
CUBIC_TO, 76.91f, 0.13f, 73.86f, 0.12f, 70.82f, 0.14f,
CUBIC_TO, 68.25f, 0.16f, 65.68f, 0.19f, 63.12f, 0.26f,
CUBIC_TO, 57.53f, 0.41f, 51.89f, 0.74f, 46.36f, 1.73f,
CUBIC_TO, 40.75f, 2.73f, 35.53f, 4.38f, 30.43f, 6.96f,
CUBIC_TO, 25.42f, 9.51f, 20.84f, 12.83f, 16.87f, 16.79f,
CUBIC_TO, 12.89f, 20.76f, 9.56f, 25.33f, 7.01f, 30.33f,
CUBIC_TO, 4.42f, 35.41f, 2.77f, 40.62f, 1.76f, 46.22f,
CUBIC_TO, 0.77f, 51.73f, 0.44f, 57.36f, 0.29f, 62.93f,
CUBIC_TO, 0.22f, 65.49f, 0.19f, 68.05f, 0.17f, 70.61f,
CUBIC_TO, 0.16f, 73.65f, 0, 77.43f, 0, 80.47f,
LINE_TO, 0, 114.67f,
LINE_TO, 0, 141.36f,
LINE_TO, 0.16f, 176.29f,
CUBIC_TO, 0.16f, 179.33f, 0.16f, 182.38f, 0.17f, 185.42f,
CUBIC_TO, 0.19f, 187.98f, 0.22f, 190.55f, 0.29f, 193.11f,
CUBIC_TO, 0.44f, 198.69f, 0.77f, 204.33f, 1.76f, 209.85f,
CUBIC_TO, 2.77f, 215.45f, 4.42f, 220.67f, 7.01f, 225.76f,
CUBIC_TO, 9.56f, 230.76f, 12.89f, 235.34f, 16.87f, 239.31f,
CUBIC_TO, 20.84f, 243.28f, 25.42f, 246.6f, 30.43f, 249.15f,
CUBIC_TO, 35.53f, 251.74f, 40.75f, 253.39f, 46.37f, 254.4f,
CUBIC_TO, 51.89f, 255.39f, 57.53f, 255.72f, 63.12f, 255.87f,
CUBIC_TO, 65.68f, 255.94f, 68.25f, 255.97f, 70.82f, 255.98f,
CUBIC_TO, 73.86f, 256, 76.91f, 256, 79.96f, 256,
LINE_TO, 114.95f, 256,
H_LINE_TO, 141.43f,
LINE_TO, 176.36f, 256,
CUBIC_TO, 179.4f, 256, 182.44f, 256, 185.48f, 255.98f,
CUBIC_TO, 188.04f, 255.97f, 190.6f, 255.94f, 193.16f, 255.87f,
CUBIC_TO, 198.74f, 255.72f, 204.37f, 255.39f, 209.89f, 254.39f,
CUBIC_TO, 215.49f, 253.39f, 220.7f, 251.74f, 225.78f, 249.15f,
CUBIC_TO, 230.78f, 246.61f, 235.36f, 243.28f, 239.32f, 239.31f,
CUBIC_TO, 243.29f, 235.34f, 246.61f, 230.76f, 249.16f, 225.76f,
CUBIC_TO, 251.75f, 220.67f, 253.39f, 215.45f, 254.4f, 209.84f,
CUBIC_TO, 255.39f, 204.32f, 255.72f, 198.69f, 255.87f, 193.11f,
CUBIC_TO, 255.94f, 190.55f, 255.97f, 187.98f, 255.98f, 185.42f,
CUBIC_TO, 256, 182.38f, 256, 179.33f, 256, 176.29f,
CUBIC_TO, 256, 176.29f, 256, 141.98f, 256, 141.36f,
V_LINE_TO, 114.64f,
CUBIC_TO, 256, 114.19f, 256, 79.73f, 256, 79.73f,
FILL_RULE_NONZERO,
PATH_COLOR_ARGB, 0xFF, 0x56, 0x69, 0xBD,
MOVE_TO, 84.93f, 0,
R_H_LINE_TO, 86.14f,
R_CUBIC_TO, 29.53f, 0, 40.24f, 3.07f, 51.04f, 8.85f,
R_ARC_TO, 60.2f, 60.2f, 0, 0, 1, 25.04f, 25.04f,
R_CUBIC_TO, 5.78f, 10.8f, 8.85f, 21.5f, 8.85f, 51.04f,
R_V_LINE_TO, 86.14f,
R_CUBIC_TO, 0, 29.53f, -3.07f, 40.24f, -8.85f, 51.04f,
R_ARC_TO, 60.2f, 60.2f, 0, 0, 1, -25.04f, 25.04f,
R_CUBIC_TO, -10.8f, 5.78f, -21.5f, 8.85f, -51.04f, 8.85f,
H_LINE_TO, 84.93f,
R_CUBIC_TO, -29.53f, 0, -40.24f, -3.07f, -51.04f, -8.85f,
R_ARC_TO, 60.2f, 60.2f, 0, 0, 1, -25.04f, -25.04f,
CUBIC_TO, 3.07f, 211.3f, 0, 200.6f, 0, 171.07f,
V_LINE_TO, 84.93f,
CUBIC_TO, 0, 55.4f, 3.07f, 44.69f, 8.85f, 33.89f,
ARC_TO, 60.2f, 60.2f, 0, 0, 1, 33.89f, 8.85f,
CUBIC_TO, 44.7f, 3.07f, 55.4f, 0, 84.93f, 0,
CLOSE,
NEW_PATH,
FILL_RULE_NONZERO,
MOVE_TO, 122.49f, 51.43f,
CUBIC_TO, 122.49f, 48.6f, 124.79f, 46.31f, 127.62f, 46.31f,
CUBIC_TO, 130.44f, 46.31f, 132.74f, 48.6f, 132.74f, 51.43f,
V_LINE_TO, 203.8f,
CUBIC_TO, 132.74f, 206.63f, 130.44f, 208.92f, 127.62f, 208.92f,
CUBIC_TO, 124.79f, 208.92f, 122.49f, 206.63f, 122.49f, 203.8f,
V_LINE_TO, 51.43f,
PATH_COLOR_ARGB, 0xFF, 0xFF, 0xFF, 0xFF,
MOVE_TO, 133.38f, 47.5f,
R_ARC_TO, 5.5f, 5.5f, 0, 1, 0, -11.01f, 0,
R_V_LINE_TO, 160.24f,
R_ARC_TO, 5.5f, 5.5f, 0, 1, 0, 11.01f, 0,
V_LINE_TO, 47.51f,
CLOSE,
NEW_PATH,
FILL_RULE_NONZERO,
MOVE_TO, 56.17f, 63.34f,
CUBIC_TO, 54.17f, 61.34f, 54.17f, 58.1f, 56.17f, 56.1f,
CUBIC_TO, 58.17f, 54.1f, 61.41f, 54.1f, 63.41f, 56.1f,
LINE_TO, 199.9f, 192.58f,
CUBIC_TO, 201.9f, 194.58f, 201.9f, 197.83f, 199.9f, 199.83f,
CUBIC_TO, 197.9f, 201.83f, 194.66f, 201.83f, 192.66f, 199.83f,
LINE_TO, 56.17f, 63.34f,
PATH_COLOR_ARGB, 0xFF, 0xFF, 0xFF, 0xFF,
MOVE_TO, 213.5f, 127.88f,
R_ARC_TO, 5.5f, 5.5f, 0, 0, 1, -5.5f, 5.5f,
H_LINE_TO, 48.25f,
R_ARC_TO, 5.5f, 5.5f, 0, 1, 1, 0, -11.01f,
R_H_LINE_TO, 159.73f,
R_ARC_TO, 5.5f, 5.5f, 0, 0, 1, 5.51f, 5.5f,
CLOSE,
NEW_PATH,
FILL_RULE_NONZERO,
MOVE_TO, 192.66f, 56.1f,
CUBIC_TO, 194.66f, 54.1f, 197.9f, 54.1f, 199.9f, 56.1f,
CUBIC_TO, 201.9f, 58.1f, 201.9f, 61.34f, 199.9f, 63.34f,
LINE_TO, 63.41f, 199.83f,
CUBIC_TO, 61.41f, 201.83f, 58.17f, 201.83f, 56.17f, 199.83f,
CUBIC_TO, 54.17f, 197.82f, 54.17f, 194.58f, 56.17f, 192.58f,
LINE_TO, 192.66f, 56.1f,
PATH_COLOR_ARGB, 0xFF, 0xFF, 0xFF, 0xFF,
MOVE_TO, 52.45f, 52.07f,
R_CUBIC_TO, 2.1f, -2.1f, 5.5f, -2.1f, 7.6f, 0,
R_LINE_TO, 143.32f, 143.74f,
R_ARC_TO, 5.4f, 5.4f, 0, 0, 1, 0, 7.63f,
R_ARC_TO, 5.37f, 5.37f, 0, 0, 1, -7.59f, 0.01f,
R_LINE_TO, -0.01f, -0.01f,
LINE_TO, 52.45f, 59.7f,
R_ARC_TO, 5.4f, 5.4f, 0, 0, 1, 0, -7.63f,
CLOSE,
NEW_PATH,
FILL_RULE_NONZERO,
MOVE_TO, 204.18f, 122.88f,
CUBIC_TO, 207.01f, 122.88f, 209.3f, 125.17f, 209.3f, 128,
CUBIC_TO, 209.3f, 130.83f, 207.01f, 133.12f, 204.18f, 133.12f,
H_LINE_TO, 51.82f,
CUBIC_TO, 48.99f, 133.12f, 46.7f, 130.83f, 46.7f, 128,
CUBIC_TO, 46.7f, 125.17f, 48.99f, 122.88f, 51.82f, 122.88f,
H_LINE_TO, 204.18f,
CLOSE
PATH_COLOR_ARGB, 0xFF, 0xFF, 0xFF, 0xFF,
MOVE_TO, 203.38f, 52.07f,
R_ARC_TO, 5.4f, 5.4f, 0, 0, 1, 0, 7.63f,
LINE_TO, 60.06f, 203.44f,
R_ARC_TO, 5.37f, 5.37f, 0, 0, 1, -7.6f, 0,
R_ARC_TO, 5.4f, 5.4f, 0, 0, 1, 0, -7.63f,
LINE_TO, 195.76f, 52.07f,
R_CUBIC_TO, 2.1f, -2.1f, 5.5f, -2.1f, 7.6f, 0,
CLOSE,
NEW_PATH
+8
View File
@@ -0,0 +1,8 @@
# input size output
branding/app_icon/raw.png 256 generated/product_icon/256x256.png
branding/app_icon/raw.png 128 generated/product_icon/128x128.png
branding/app_icon/raw.png 64 generated/product_icon/64x64.png
branding/app_icon/raw.png 48 generated/product_icon/48x48.png
branding/app_icon/raw.png 32 generated/product_icon/32x32.png
branding/app_icon/raw.png 24 generated/product_icon/24x24.png
branding/app_icon/raw.png 16 generated/product_icon/16x16.png
+23 -22
View File
@@ -32,31 +32,32 @@ branding/product_logo_white_200.png components/resources/default_200_percent/chr
branding/product_logo_22_mono.png chrome/app/theme/chromium/product_logo_22_mono.png
branding/product_icon/16x16.png chrome/app/theme/chromium/product_logo_16.png
branding/product_icon/24x24.png chrome/app/theme/chromium/product_logo_24.png
branding/product_icon/48x48.png chrome/app/theme/chromium/product_logo_48.png
branding/product_icon/64x64.png chrome/app/theme/chromium/product_logo_64.png
branding/product_icon/128x128.png chrome/app/theme/chromium/product_logo_128.png
branding/product_icon/256x256.png chrome/app/theme/chromium/product_logo_256.png
branding/product_icon/16x16.png chrome/app/theme/default_100_percent/chromium/product_logo_16.png
branding/product_icon/32x32.png chrome/app/theme/default_100_percent/chromium/product_logo_32.png
branding/product_icon/32x32.png chrome/app/theme/default_200_percent/chromium/product_logo_16.png
branding/product_icon/64x64.png chrome/app/theme/default_200_percent/chromium/product_logo_32.png
branding/product_icon/24x24.png chrome/app/theme/chromium/linux/product_logo_24.png
branding/product_icon/48x48.png chrome/app/theme/chromium/linux/product_logo_48.png
branding/product_icon/64x64.png chrome/app/theme/chromium/linux/product_logo_64.png
branding/product_icon/128x128.png chrome/app/theme/chromium/linux/product_logo_128.png
branding/product_icon/256x256.png chrome/app/theme/chromium/linux/product_logo_256.png
branding/product_icon/16x16.png chrome/app/theme/default_100_percent/chromium/linux/product_logo_16.png
branding/product_icon/32x32.png chrome/app/theme/default_100_percent/chromium/linux/product_logo_32.png
branding/product_logo.svg chrome/app/theme/chromium/product_logo.svg
branding/product_logo.icon chrome/app/vector_icons/browser_logo.icon
branding/product_logo.icon components/omnibox/browser/vector_icons/product_chrome_refresh.icon
branding/product_logo.icon components/vector_icons/chromium/product.icon
branding/product_logo_color.icon components/vector_icons/chromium/product_refresh.icon
# generated resources
generated/product_icon/16x16.png chrome/app/theme/chromium/product_logo_16.png
generated/product_icon/24x24.png chrome/app/theme/chromium/product_logo_24.png
generated/product_icon/48x48.png chrome/app/theme/chromium/product_logo_48.png
generated/product_icon/64x64.png chrome/app/theme/chromium/product_logo_64.png
generated/product_icon/128x128.png chrome/app/theme/chromium/product_logo_128.png
generated/product_icon/256x256.png chrome/app/theme/chromium/product_logo_256.png
generated/product_icon/16x16.png chrome/app/theme/default_100_percent/chromium/product_logo_16.png
generated/product_icon/32x32.png chrome/app/theme/default_100_percent/chromium/product_logo_32.png
generated/product_icon/32x32.png chrome/app/theme/default_200_percent/chromium/product_logo_16.png
generated/product_icon/64x64.png chrome/app/theme/default_200_percent/chromium/product_logo_32.png
generated/product_icon/24x24.png chrome/app/theme/chromium/linux/product_logo_24.png
generated/product_icon/48x48.png chrome/app/theme/chromium/linux/product_logo_48.png
generated/product_icon/64x64.png chrome/app/theme/chromium/linux/product_logo_64.png
generated/product_icon/128x128.png chrome/app/theme/chromium/linux/product_logo_128.png
generated/product_icon/256x256.png chrome/app/theme/chromium/linux/product_logo_256.png
generated/product_icon/16x16.png chrome/app/theme/default_100_percent/chromium/linux/product_logo_16.png
generated/product_icon/32x32.png chrome/app/theme/default_100_percent/chromium/linux/product_logo_32.png
+1 -1
View File
@@ -1 +1 @@
10
15
+1 -1
View File
@@ -96,7 +96,7 @@ def _extract_tar_with_7z(binary, archive_path, output_dir, relative_to):
output_dir / relative_to)
raise FileExistsError()
cmd1 = (binary, 'x', str(archive_path), '-so')
cmd2 = (binary, 'x', '-si', '-aoa', '-ttar', f'-o{str(output_dir)}')
cmd2 = (binary, 'x', '-si', '-snld', '-aoa', '-ttar', f'-o{str(output_dir)}')
get_logger().debug('7z command line: %s | %s', ' '.join(cmd1), ' '.join(cmd2))
proc1 = subprocess.Popen(cmd1, stdout=subprocess.PIPE) #pylint: disable=consider-using-with
-1
View File
@@ -8,7 +8,6 @@
# Copyright (c) 2019 The ungoogled-chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE.ungoogled_chromium file.
"""
Substitute domain names in the source tree with blockable strings.
"""
+66
View File
@@ -0,0 +1,66 @@
# 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.
"""
Generates scaled resources for Helium branding
"""
import os
import sys
from PIL import Image
def scale_image(input_file, size, output_path):
"""
Scales the square image to provided size and saves it
"""
img = Image.open(input_file)
img.thumbnail((size, size))
# make sure output path exists
os.makedirs(os.path.dirname(output_path), exist_ok=True)
img.save(output_path, optimize=True)
def generate_resources(resource_list, resource_dir):
"""
Parses the resource list and generates resources
for each valid line
"""
with open(resource_list, 'r', encoding='utf-8') as file:
for line_number, line in enumerate(file, start=1):
line = line.strip()
if not line or line.startswith('#'):
continue
line_parts = line.split()
if len(line_parts) != 3:
raise ValueError(f"Line {line_number} in the resource file is invalid.")
input_file = os.path.join(resource_dir, line_parts[0])
size = int(line_parts[1])
output_file = os.path.join(resource_dir, line_parts[2])
scale_image(input_file, size, output_file)
print(f"Created {line_parts[2]}")
def main():
"""CLI entrypoint"""
if len(sys.argv) != 3:
print(
"Usage: python3 generate_resources.py " \
"<generate_resources.txt> <resources_dir>"
)
sys.exit(1)
resource_list = sys.argv[1]
resource_dir = sys.argv[2]
generate_resources(resource_list, resource_dir)
if __name__ == "__main__":
main()
+33 -7
View File
@@ -1,21 +1,42 @@
#!/usr/bin/env python3
# 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.
"""
Script to generate Helium version numbers
and inject them into the Chromium build tree.
"""
import argparse
from pathlib import Path
CHROME_VERSION_BASE = 136
def get_version_part(path):
with open(path, "r") as file:
"""
Gets the (first) digit representing a part of
the version from a particular file.
"""
with open(path, "r", encoding="utf-8") as file:
return int(file.readline().split(".")[0].strip())
def append_version(file, name, version):
"""Appends a version part to the chromium VERSION file"""
file.write(f"{name}={version}\n")
def check_existing_version(path):
with open(path, "r") as f:
if "HELIUM" in f.read():
raise Exception("file already contains helium versioning")
"""Verifies that the version has not yet been added to the build tree"""
with open(path, "r", encoding="utf-8") as file:
if "HELIUM" in file.read():
raise ValueError("file already contains helium versioning")
def parse_args():
"""Argument parsing"""
parser = argparse.ArgumentParser()
parser.add_argument("--tree", type=Path, required=True)
parser.add_argument("--platform-tree", type=Path, required=True)
@@ -24,21 +45,25 @@ def parse_args():
args = parser.parse_args()
return (args.tree, args.platform_tree, args.chromium_tree, args.print)
def get_version_parts(tree, platform_tree):
"""Compiles all the version parts into the full version"""
version_paths = {
"HELIUM_MAJOR": tree / "version.txt",
"HELIUM_MINOR": tree / "chromium_version.txt",
"HELIUM_PATCH": tree / "revision.txt",
"HELIUM_PLATFORM": platform_tree / "revision.txt",
}
version_parts = {}
for name, path in version_paths.items():
delta = 0 if name != "HELIUM_MINOR" else -CHROME_VERSION_BASE
version_parts[name] = get_version_part(path) + delta
return version_parts
def main():
"""CLI entrypoint"""
tree, platform_tree, chromium_tree, should_print = parse_args()
version_parts = get_version_parts(tree, platform_tree)
@@ -48,9 +73,10 @@ def main():
else:
chrome_version_path = chromium_tree / "chrome/VERSION"
check_existing_version(chrome_version_path)
with open(chrome_version_path, "a") as f:
with open(chrome_version_path, "a", encoding="utf-8") as file:
for name, version in version_parts.items():
append_version(f, name, version)
append_version(file, name, version)
if __name__ == "__main__":
main()
+53 -33
View File
@@ -1,7 +1,9 @@
#!/usr/bin/env python3
# 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.
"""Script to replace instances of Chrome/Chromium with Helium"""
from pathlib import Path
import argparse
@@ -12,8 +14,8 @@ import re
REPLACEMENT_REGEXES_STR = [
# stuff we don't want to replace
(r'(\w+) Root Program', r'\1_unreplace Root Program'),
(r'(\w+) Web( S|s)tore', r'\1_unreplace Web Store'),
(r'(\w+) Root Program', r'\1_unreplace Root Program'),
(r'(\w+) Web( S|s)tore', r'\1_unreplace Web Store'),
(r'(\w+) Remote Desktop', r'\1_unreplace Remote Desktop'),
(r'("BEGIN_LINK_CHROMIUM")(.*?Chromium)(.*?<ph name="END_LINK_CHROMIUM")', r'\1\2_unreplace\3'),
@@ -25,19 +27,19 @@ REPLACEMENT_REGEXES_STR = [
(r'_unreplace', r'')
]
REPLACEMENT_REGEXES = list(
map(
lambda line: (re.compile(line[0]), line[1]),
REPLACEMENT_REGEXES_STR
)
)
REPLACEMENT_REGEXES = list(map(lambda line: (re.compile(line[0]), line[1]),
REPLACEMENT_REGEXES_STR))
def replace(str):
def replace(text):
"""Replaces instances of Chrom(e | ium) with Helium, where desired"""
for regex, replacement in REPLACEMENT_REGEXES:
str = re.sub(regex, replacement, str)
return str
text = re.sub(regex, replacement, text)
return text
def replacement_sanity():
"""Sanity check to ensure replacement regexes are working as intended"""
before_after = [
('Chrome Root Program', 'Chrome Root Program'),
('Chrome Web Store', 'Chrome Web Store'),
@@ -49,10 +51,12 @@ def replacement_sanity():
('Chromium', 'Helium'),
]
for a, b in before_after:
assert(replace(a) == b)
for source, expected in before_after:
assert replace(source) == expected
def parse_args():
"""CLI argument parsing logic"""
parser = argparse.ArgumentParser()
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument('--sub', action='store_true')
@@ -63,11 +67,24 @@ def parse_args():
args = parser.parse_args()
if args.unsub and not args.backup_path:
raise Exception("backup_path is missing, but unsub was specified")
raise ValueError("backup_path is missing, but unsub was specified")
return args
def is_substitutable(filename):
"""Determines whether a file should be name-substituted"""
if filename.startswith('.'):
return False
return filename.split('.')[-1].lower() in ['xtb', 'grd', 'grdp']
def get_substitutable_files(tree):
"""
Finds all candidates for substitution, which are source
string files (.grd*), or localization files (.xtb).
"""
out = tree / 'out'
for root, _, files in os.walk(tree):
@@ -75,54 +92,57 @@ def get_substitutable_files(tree):
if out in root.parents:
continue
yield from map(
lambda filename: root / filename,
filter(
lambda filename: not filename.startswith('.') and (
filename.endswith('.xtb') or filename.endswith('.grd') or filename.endswith('.grdp')
),
files
)
)
yield from map(lambda filename, root=root: root / filename, filter(is_substitutable, files))
async def substitute_file(tree, path, tarball = None):
async def substitute_file(tree, path, tarball=None):
"""
Replaces strings in a particular file,
if there is anything to replace.
"""
arcname = str(path.relative_to(tree))
text = None
with open(path, 'r', encoding='utf-8') as f:
text = f.read()
with open(path, 'r', encoding='utf-8') as file:
text = file.read()
replaced = replace(text)
if text != replaced:
print(f"Replaced strings in {arcname}")
if tarball:
tarball.add(path, arcname=arcname, recursive=False)
with open(path, 'w', encoding='utf-8') as f:
f.write(replaced)
with open(path, 'w', encoding='utf-8') as file:
file.write(replaced)
def do_unsubstitution(tree, tarpath):
"""Reverts name substitutions from the backup tarball"""
with tarfile.open(str(tarpath), 'r:gz') as tar:
tar.extractall(path=tree, filter='fully_trusted')
tarpath.unlink()
async def do_substitution(tree, tarpath):
with tarfile.open(str(tarpath), 'w:gz') if tarpath else open(os.devnull, 'w') as cache_tar:
"""Performs name substitutions on all candidate files"""
with tarfile.open(str(tarpath), 'w:gz') if tarpath else open(os.devnull, 'w',
encoding="utf-8") as cache_tar:
pending_substitutions = map(
lambda path: substitute_file(tree, path, cache_tar if tarpath else None),
get_substitutable_files(tree)
)
get_substitutable_files(tree))
await asyncio.gather(*pending_substitutions)
async def main():
"""CLI entrypoint"""
replacement_sanity()
args = parse_args()
if not (args.t / "OWNERS").exists():
raise Exception("wrong src directory")
raise ValueError("wrong src directory")
if args.sub:
if args.backup_path is not None and args.backup_path.exists():
raise Exception("unsub tarball already exists, aborting")
raise FileExistsError("unsub tarball already exists, aborting")
await do_substitution(args.t, args.backup_path)
elif args.unsub and args.backup_path:
do_unsubstitution(args.t, args.backup_path)
+18 -25
View File
@@ -1,23 +1,21 @@
# 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.
"""
Replaces resources (such as icons) with Helium branding.
"""
import os
import shutil
import sys
def copy_resources(resource_list, resource_dir, chromium_dir):
if not os.path.isfile(resource_list):
print(f"Resource list '{resource_list}' does not exist, skipping")
return
if not os.path.isdir(resource_dir):
print(f"Resource dir '{resource_dir}' does not exist.")
sys.exit(1)
if not os.path.isdir(chromium_dir):
print(f"Chromium dir '{chromium_dir}' does not exist.")
sys.exit(1)
with open(resource_list, 'r') as file:
def copy_resources(resource_list, resource_dir, chromium_dir):
"""
Handles copying resources from the source tree into the build
tree based on a resources list.
"""
with open(resource_list, 'r', encoding='utf-8') as file:
for line_number, line in enumerate(file, start=1):
line = line.strip()
if not line or line.startswith('#'):
@@ -26,28 +24,22 @@ def copy_resources(resource_list, resource_dir, chromium_dir):
line_parts = line.split()
if len(line_parts) != 2:
print(f"Line {line_number} is invalid. Skipping.")
continue
raise ValueError(f"Line {line_number} in the resource file is invalid.")
source = os.path.join(resource_dir, line_parts[0])
dest = os.path.join(chromium_dir, line_parts[1])
if not os.path.exists(source):
print(f"Source file '{source}' does not exist. Skipping copy.")
continue
if not os.path.exists(dest):
print(f"Destination file '{dest}' does not exist. Skipping copy.")
continue
shutil.copyfile(source, dest)
print(f"Copied {line_parts[0]} to {line_parts[1]}")
try:
shutil.copyfile(source, dest)
print(f"Copied {line_parts[0]} to {line_parts[1]}")
except Exception as e:
print(f"Error copying '{source}' to '{dest}': {e}")
def main():
"""CLI entrypoint"""
if len(sys.argv) != 4:
print("Usage: python3 replace_resources.py <helium_resources.txt> <resources_dir> <chromium_src_dir>")
print(
"Usage: python3 replace_resources.py <helium_resources.txt> " \
"<resources_dir> <chromium_src_dir>"
)
sys.exit(1)
resource_list = sys.argv[1]
@@ -56,5 +48,6 @@ def main():
copy_resources(resource_list, resource_dir, chromium_dir)
if __name__ == "__main__":
main()