Update l10n for 1.85.x (Chromium 143). (#32503)
* Fixes replacement map.
Some languages use non-breaking whitespace intead of regular space in
XTB files, so our map wasn't matching. Replaced spaces to \s in the map
patterns.
* Fixes error printing.
* Adjust ICU strings validation pattern.
* Fixes <br> -> <br/> tags.
* Updated l10n for 1.85.x release.
Will now display Premium labels for Premium models in the Regenerate Answer menu for non-premium users.
Will now show the Premium Suggestion alert if a non-premium user click on a Premium model in the Regenerate Answer menu
* Rename BraveSidePanel to SidePanel.
We fully replace upstream's SidePanel class with our own. To avoid
adding chromium_src redefinitions in multiple places we can just use the
upstream name for our class.
* Rename brave_side_panel.h/cc -> side_panel.h/cc
* Rename brave_side_panel_resize_widget.h/cc -> side_panel_resize_widget.h/cc
* Add Ollama integration to Leo Assistant settings
- Add OllamaService mojo interface bindings in settings UI
- Include ollama.mojom in settings build configuration
- Add Ollama model discovery UI in model list section
- Update content security policy for Ollama endpoints
- Add localized strings for Ollama integration
- Wire up Ollama service through settings browser proxy
DecentralizedDnsNavigationThrottleBrowserTest.ClickjackingProtectionPreventsEarlyClicks
Directly control the proceedClicksEnabled JS variable instead of racing against the 500ms timer.
The test was flaky because the timer starts at DOMContentLoaded but the test waits for
document.readyState=='complete', which can take >500ms on slow CI machines, causing the protection to
expire before the test runs.
[ RUN ] DecentralizedDnsNavigationThrottleBrowserTest.ClickjackingProtectionPreventsEarlyClicks
[19651:1178558:1117/200021.772078:INFO:brave/components/brave_referrals/browser/brave_referrals_service.cc:84] Could not get promo code from /Users/jenkins/jenkins/workspace/brave-browser-build-macos-arm64-nightly/src/out/Release_arm64. The extended attribute com.brave.refcode was not found.
[19651:1178493:1117/200021.848031:ERROR:chrome/browser/ui/views/user_education/impl/browser_user_education_interface_impl.cc:154] Attempting to show IPH IPH_DiscardRing before browser initialization complete; IPH will not be shown.
../../brave/browser/decentralized_dns/test/decentralized_dns_navigation_throttle_browsertest.cc:327: Failure
Expected equality of these values:
static_cast<int>(ResolveMethodTypes::ASK)
Which is: 0
local_state()->GetInteger(kENSResolveMethod)
Which is: 3
Stack trace:
0 brave_browser_tests 0x00000001028ed558 cxxbridge1$string$len + 847592
1 brave_browser_tests 0x000000010d10375c secp256k1_ecdsa_recover + 2729628
4 brave_browser_tests 0x000000010515cdd0 _v8_internal_Node_Print(void*) + 7890684
10 brave_browser_tests 0x000000010d102bc8 secp256k1_ecdsa_recover + 2726664
* Force context menu on Shift + Right Click on elements in pages
This PR introduces a feature that allows users to open the context menu
even if `event.preventDefault()` is called on the `contextmenu` event
when the Shift key is pressed.
This is particularly useful for users who want to access the context
menu on web pages that disable it through JavaScript.
This is achieved by bypassing the `preventDefault` check for
`contextmenu` events when the Shift key is detected as being pressed in
the "EventDispatcher" so that Node's `DefaultEventHandler` is called.
* Exclude rewrite from license checks
Fix patch file path generation with PurePath.as_posix()
On Windows path delimiter is `\` and on other platforms `/`. We should normalize the path.
WIth this patch, two particular errors are fixed
```
[11:25:08] Applying plaster file: c:\Users\sangwoo\brave\src\brave\rewrite\chrome\app\BUILD.gn.toml plaster.py:333
Traceback (most recent call last):
File "c:\Users\sangwoo\brave\src\brave\tools\cr\plaster.py", line 429, in <module>
sys.exit(main())
^^^^^^
File "c:\Users\sangwoo\brave\src\brave\tools\cr\plaster.py", line 424, in main
args.func(args)
File "c:\Users\sangwoo\brave\src\brave\tools\cr\plaster.py", line 404, in <lambda>
apply_parser.set_defaults(func=lambda args: apply())
^^^^^^^
File "c:\Users\sangwoo\brave\src\brave\tools\cr\plaster.py", line 334, in apply
plaster_file.apply()
File "c:\Users\sangwoo\brave\src\brave\tools\cr\plaster.py", line 257, in apply
contents = repository.chromium.read_file(info.source)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\sangwoo\brave\src\brave\tools\cr\repository.py", line 150, in read_file
return self.run_git('show',
^^^^^^^^^^^^^^^^^^^^
File "c:\Users\sangwoo\brave\src\brave\tools\cr\repository.py", line 79, in run_git
return terminal.run_git('-C', self.from_brave(), *cmd, no_trim=no_trim)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\sangwoo\brave\src\brave\tools\cr\terminal.py", line 183, in run_git
return self.run(cmd).stdout
^^^^^^^^^^^^^
File "c:\Users\sangwoo\brave\src\brave\tools\cr\terminal.py", line 160, in run
raise e
File "c:\Users\sangwoo\brave\src\brave\tools\cr\terminal.py", line 151, in run
result = subprocess.run(cmd,
^^^^^^^^^^^^^^^^^^^
File "C:\depot_tools\bootstrap-2@3_11_8_chromium_35_bin\python3\bin\Lib\subprocess.py", line 571, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['git', '-C', '..', 'show', 'HEAD:chrome\\app\\BUILD.gn']' returned non-zero exit status 128.
```
[11:24:08] Applying plaster file: c:\Users\sangwoo\brave\src\brave\rewrite\chrome\app\BUILD.gn.toml plaster.py:333
Traceback (most recent call last):
File "c:\Users\sangwoo\brave\src\brave\tools\cr\plaster.py", line 429, in <module>
sys.exit(main())
^^^^^^
File "c:\Users\sangwoo\brave\src\brave\tools\cr\plaster.py", line 424, in main
args.func(args)
File "c:\Users\sangwoo\brave\src\brave\tools\cr\plaster.py", line 404, in <lambda>
apply_parser.set_defaults(func=lambda args: apply())
^^^^^^^
File "c:\Users\sangwoo\brave\src\brave\tools\cr\plaster.py", line 334, in apply
plaster_file.apply()
File "c:\Users\sangwoo\brave\src\brave\tools\cr\plaster.py", line 310, in apply
has_changed = info.save_patch_if_changed(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\sangwoo\brave\src\brave\tools\cr\plaster.py", line 210, in save_patch_if_changed
return self.patch.save_if_changed(new_content=content, dry_run=dry_run)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\sangwoo\brave\src\brave\tools\cr\plaster.py", line 79, in save_if_changed
self.path.write_text(new_content, encoding='utf-8')
File "C:\depot_tools\bootstrap-2@3_11_8_chromium_35_bin\python3\bin\Lib\pathlib.py", line 1078, in write_text
with self.open(mode='w', encoding=encoding, errors=errors, newline=newline) as f:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\depot_tools\bootstrap-2@3_11_8_chromium_35_bin\python3\bin\Lib\pathlib.py", line 1044, in open
return io.open(self, mode, buffering, encoding, errors, newline)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'patches\\chrome\\app\\BUILD.gn.patch'
```****
```
* Add enable_brave_wallet GN variable and build flag
This adds a new GN build flag 'enable_brave_wallet' that can be set to
false to exclude Brave Wallet from the build. The flag is true by default
to maintain current behavior.
Changes include:
- Add enable_brave_wallet declare_args in build/config/BUILDCONFIG.gn
- Create brave_wallet/common/buildflags with ENABLE_BRAVE_WALLET flag
- Update all BUILD.gn and sources.gni files to use the new flag
- Add wallet buildflags dependencies via minimal one-line imports
* Add patches for wallet buildflags in Chromium BUILD files
Adds minimal one-line patches to import wallet buildflags dependencies
in Chromium source files. This allows Chromium code to conditionally
depend on wallet headers.
Patches:
- chrome/browser/ui/hid/BUILD.gn
- net/BUILD.gn
- third_party/blink/common/BUILD.gn
- third_party/blink/public/common/BUILD.gn
- third_party/blink/renderer/modules/permissions/BUILD.gn
* Guard wallet code in Chromium source overrides
Updates chromium_src overrides to conditionally compile wallet-related
code based on enable_brave_wallet flag. This includes:
- Adding DEPS files to allow buildflags dependencies
- Guarding wallet permission handling with #if BUILDFLAG(ENABLE_BRAVE_WALLET)
- Keeping wallet permission enum values unconditionally to maintain profile
interchangeability between wallet-enabled and wallet-disabled builds
- Updating component registration and preference handling
Key changes:
- Permission enums remain stable across build configs for UMA and persistence
- Wallet permission handling code only compiled when wallet enabled
- DEPS files updated to allow buildflags includes
* Guard wallet UI code in front-end TypeScript and Mojom
Conditionally compiles wallet-related UI code in TypeScript and Mojom
interfaces based on enable_brave_wallet preprocessor flag.
Changes:
- Settings menu: Use lastInserted pattern for menu item ordering
- Page visibility: Guard wallet page visibility checks
- Browser commands: Guard wallet command handling
- Routes: Conditionally include wallet routes
- Add non-null assertions for DOM insertions in TypeScript
- Update Mojom interfaces to conditionally include wallet enums
Front-end code uses <if expr="enable_brave_wallet"> preprocessor
directives to exclude wallet UI when the feature is disabled.
* Guard wallet usage in non-wallet Brave code
Conditionally compiles wallet-related code in non-wallet Brave files
based on enable_brave_wallet build flag.
Changes include:
- browser/: Guard wallet service factories, preferences, and helpers
- components/: Guard wallet dependencies in rewards, sidebar, and DNS
- renderer/: Conditionally register wallet content settings
- utility/: Guard wallet component registration
- ios/: Add optional chaining for wallet feature flags
- test/: Guard wallet-related test code
Key files:
- brave_stats_updater.cc: Guard wallet pref registration with #if
- brave_profile_prefs.cc: Conditionally register wallet preferences
- sidebar_service.cc: Guard wallet panel items
- iOS WalletConstants.swift: Use optional chaining for feature checks
This allows building Brave without wallet while maintaining profile
compatibility between wallet-enabled and wallet-disabled builds.
* Add static_assert for ENABLE_BRAVE_WALLET in wallet headers
Adds compile-time assertions to wallet headers to ensure they are only
included when wallet is enabled. This prevents accidental usage of wallet
APIs when enable_brave_wallet=false.
Added static_assert(BUILDFLAG(ENABLE_BRAVE_WALLET)) to:
browser/brave_wallet/ (11 files):
- asset_ratio_service_factory.h
- brave_wallet_context_utils.h
- brave_wallet_ipfs_service_factory.h
- brave_wallet_provider_delegate_impl.h
- brave_wallet_service_factory.h
- brave_wallet_tab_helper.h
- meld_integration_service_factory.h
- wallet_notification_service_factory.h
- simulation_service_factory.h
- swap_service_factory.h
- wallet_data_files_installer_delegate_impl.h
components/brave_wallet/browser/ (15 files):
- brave_wallet_p3a_private.h
- brave_wallet_prefs.h
- brave_wallet_service.h
- brave_wallet_utils.h
- ens_resolver_task.h
- json_rpc_service_test_utils.h
- json_rpc_service.h
- keyring_service_observer_base.h
- keyring_service.h
- network_manager.h
- permission_utils.h
- pref_names.h
- test_utils.h
- tx_service.h
- wallet_data_files_installer.h
components/brave_wallet/common/ (6 files):
- brave_wallet_types.h
- common_utils.h
- eth_abi_utils.h
- features.h
- hex_utils.h
- pref_names.h
Also includes minor wallet code updates to use buildflags and
guard zcash-specific test code.
* Follow up fixes after Parts 1-7
To avoid copy/pasting of the same code in `BraveLocationBarQRDialogFragment` and `BraveSyncScreensPreference`, the common code related to qr code reading was moved to `QRCodeCameraManager` class.