This change moves the Brave Rewards code in "content" and "engine"
behind the ENABLE_BRAVE_REWARDS buildflag. In order to simplify
dependencies, it also moves the buildflags defined in "engine" to
"core/buildflags".
The PR does the following:
* Adds buildflag static asserts to Brave Ads public
facing headers
* Moves remaining Brave Ads code for Desktop
builds under a build flag
* Sets Brave Ads build flag to false for
Brave Origin build
* 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
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.
The upstream change was causing a crash in
BraveSpeedFeatureProcessorBrowserTest.Default browser test due to CHECK
for early creation of IdentityManager.
To avoid the check split --enable-brave-features-for-perf-testing switch
handler into two parts:
1. Changes prefs
2. Instantiates services (rewards service that causes creation of
IdentityManager) and components.
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/21435fb93f29b1ece473baf8d62d36b978fcb1a8
commit 21435fb93f29b1ece473baf8d62d36b978fcb1a8
Author: Mihai Sardarescu <msarda@chromium.org>
Date: Tue Aug 5 03:09:57 2025 -0700
Check that IdentityManager is not created too early
This CL adds an explicit CHECK in the profile initialization to ensure
that the IdentityManager is not created before the profile keyed
services are created.
This ensures that the IdentityManager can be properly overrides with
a mock/fake in unit and browser tests.
Note: This check is currently if-deffed out on Android as on this
platform the IdentityManager is created by mistake when initializing
the storage partition. This will be fixed in a follow-up CL.
Bug: 436208345
* Add top level toggle to enable/disable Speedreader
This migrates away an old bad named feature for automatically using
speedreader for all sites. The pref was wrongly named `enabled`.
This also adds a new preference for actually enabling/disabling the
feature.
* Fixes Android presubmit
---------
Co-authored-by: Serg <serg.zhukovsky@gmail.com>
These change are being done to make use of `absl::StrFormat` in the
future, and also to get some better codegen with these constants.
There's also some harderning on upstream code to avoid unnecessary
conversions involving constants, which can only be enforced in a
`constexpr` constext.
* Enable some Brave features for pref testing
* Fix working with kComponentUpdater switch
* Fix format after rebasing
* check enable_speedreated flag
* Add speedreader buildflags.h
* Fix gn check
* Fix review issues
* Add the test to brave/android/android_browser_tests.gni