Brave Origin builds compile out Brave Rewards
(enable_brave_rewards = !is_brave_origin_branded), but the
BraveRewardsDisabled policy was still registered unconditionally, so
brave://policy listed it on Brave Origin builds even though the feature
isn't present.
Wrap the BraveRewardsDisabled entry in kBraveSimplePolicyMap and the
matching kBraveOriginProfileMetadata entry in #if
BUILDFLAG(ENABLE_BRAVE_REWARDS), mirroring how Wallet, Talk, AI Chat,
etc. are gated. The unit test assertions and BUILD.gn rewards deps move
under the same buildflag.
Fixesbrave/brave-browser#55558
Introduces enable_playlist (defaults to !is_brave_origin_branded),
following the same pattern as enable_brave_wallet and enable_ai_chat,
to gate all Playlist code from compilation on origin-branded desktop
builds. enable_playlist_webui now chains through enable_playlist.
Changes are scoped to desktop: iOS and Android don't support
is_brave_origin_branded=true (enforced by asserts in
//brave/components/brave_origin/buildflags/buildflags.gni), so they
have no guards.
* Add Web Discovery build flag
* Remove obsolete kDontAskEnableWebDiscovery pref
This legacy pref was only being registered and immediately cleared
during migration. Remove it entirely.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* 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
This change allows to set BRAVE_HTTPS_UPGRADE
content setting via managed preference
basing on policy.
---------
Co-authored-by: Shivan <shivankaulsahib@gmail.com>
* Add AI Chat build flag to components/ai_chat
* Add AI Chat build flag to browser/ui
* Add AI Chat build flag to browser/resources
* Add AI Chat build flag to chromium overrides
* Add AI Chat build flag to other components
* Add AI Chat build flag to core browser files
* Add AI Chat build flag to app and renderer
* Add AI Chat build flag to remaining files
* Set enable_ai_chat to !is_brave_origin_branded
* Review comments
Including gn_check errors in chromium_src
* Exclude ai_chat Jest tests when not enabled
- Everything in `browser` moves to `content/browser`
- Everything in `renderer` moves to `content/renderer`
- Everything in `common` moves to `core/common`
- `pref_names.h` moved into `core/common`
- Fixed copyright notice in `playlistSelect.tsx`
Rename pref/features to try to make them more clear. `Enable` means that the site will open in Speedreader automatically. `Allow` means it may open in Speedreader depending on whether it's a site specific override or allow for all readable urls is true and the url looks readable.
- BraveSpeedReaderDisabled is now called BraveSpeedReaderEnabled
- Replace kSpeedreaderDisabledByPolicy with kSpeedreaderPrefFeatureEnabled which already existed
- Invert Disabled policy name to Enabled to match the pref that already existed.
- Invert logic at various places to be for enabled checks instead of disabled.
- Update tests and policy definitions accordingly.
- We now show opt-ins for Recommended policy enforcement (things set via `defaults write` on macOS, it should show an indicator if you match the recommended setting or not)
- We now hide opt-ins for Mandatory enforcements (things set via `sudo /usr/libexec/PlistBuddy`)
- BraveWaybackMachineDisabled is now called BraveWaybackMachineEnabled
- Replace kBraveWaybackMachineDisabledByPolicy with kBraveWaybackMachineEnabled which already existed
- Invert Disabled policy name to Enabled to match the pref that already existed.
- Invert logic at various places to be for enabled checks instead of disabled.
- Update tests and policy definitions accordingly.
- We now hide opt-ins for Recommended policy enforcement (things set via `defaults write` on macOS) but hide for mandatory enforcements (things set via `sudo /usr/libexec/PlistBuddy`)
Add admin policy for Web Discovery (#30023)
* Fix Web Discovery API to account for policy, add Web Discovery test
* Move IsWebDiscoveryEnabled/pref_names to components/web_discovery/common
* Check Web Discovery Native feature before loading extension background page
* Use PrefService ref in IsWebDiscoveryEnabled
* Mark WDP policy as pending development for Android
* Move Web Discovery enabled/disabled via policy prefs to //brave/components/constants
I can't find documentation about Android administration and the build
fails with sync url set. We need to find the Android equivalent of
`chromium_src/components/policy/tools/generate_policy_source.py`
Upstream has implemented the menu options for New Profile/Open Profile
existing in brave.
This change removes our own implementation for those menu entries,
using the upstream implementation directly.
Chromium change:
https://chromium.googlesource.com/chromium/src/+/f0116569d73045cde67f8d9553bddc841a742ebe
commit f0116569d73045cde67f8d9553bddc841a742ebe
Author: David Yeung <dayeung@chromium.org>
Date: Thu Jun 15 05:18:23 2023 +0000
[CR2023] Added section 4 & 5 to Profile submenu
This CL adds the Other chrome profile section and the managing profile section to the profile submenu.
This does the following:
- Adds strings to the profiles submenu view.
- Adds the 2 aforementioned sections to the profile submenu.
- One of the sections will increase the number of possible dynamic menu items in the app menu. This is because the "Other Chrome Profiles" can change depending on the number of profiles available in the browser.
- Cleaned up some UI code in app_menu to be shared across profile menu items. This is bespoke to the profile section for now and will potentially be removed in the future due to UI changes.
- Tests for coverage.
Figma mocks:
https://www.figma.com/file/NLMJNd5s2g9DEDZCbIngJV/ChroMenu---Desktop-Scalability?type=design&node-id=2560-291355&t=PlIopfjOa2CcJCBY-0
Screenshot:
https://screenshot.googleplex.com/BB9ccDaHEwaXPgZ
Bug: 1427667