Adds a privacy setting for controlling how long browsing history is kept, including options to disable history saving or keep history indefinitely. Updates the history expiration backend when the setting changes and shows a notice on the history page when saving is disabled.
Co-authored-by: InjectorExe <68108452+InjectorExe@users.noreply.github.com>
* Add optional horizontal tab strip scroll buttons
Introduce a profile preference (Appearance → Tabs) to show leading and
trailing scroll controls when the horizontal unpinned tab area overflows.
Expose the pref through settings WebUI, extension settings_private, and the
incognito allowlist where appropriate.
BraveHorizontalTabStripRegionView inserts TabStripControlButton instances
with flex-friendly child ordering and visibility tied to overflow. Scroll
offset changes are observed via BraveTabContainer’s
RegisterHorizontalScrollOffsetChangedCallback subscription.
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.
* Horizontal scrollable tab strip is enabled by default
* Remove the min inactive width check for scrollable tab strip
as we have minimum width control via preference
* Remove redundant check and make comment
* Update scrollable tab strip setting label
* Add test for scroll direction when scrollable horizontal pref is disabled
* Remove unnecessary browser object access
* Simplify method
* 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>
We provide a way to adjust the minimum width of the tab.
There're 5 options:
- default: currently the minimal
- minimum: current behavior,
- medium: 76px
- large: half of the standard width
- full: the standard width
* Add pref and backend support for tab organization model key
Introduce kBraveAIChatTabOrganizationModelKey pref (default:
"chat-automatic") to allow users to choose which model is used
for tab organization. Update CreateTabOrganizationEngineIfNeeded
to read from this pref with fallback to "chat-automatic". Add
unit test for the invalid key fallback path.
* Add tab organization model selector in settings UI
Extract shared LeoModelSelector Lit component from personalization
page. Add tab organization model dropdown that appears when the tab
organization feature flag and pref are both enabled. Gate the tab
organization toggle behind the feature flag. Add localized string
for the model selector label.
* Improve tab focus prompts
When testing local model, found gemma tends to reply topics like
"['📰 News', '💻 Web Development', ... ]" which is failed to be parsed
because of the usage of single quotes on strings.
Improve tab focus prompts to mention valid JSON array and examples for
model to follow.
These classes were hoisted and renamed. This has been replaced in
Chromium as well. This is a mechanical change for Brave, done with the
following script.
```
git grep -lw 'Value::List' | xargs sed -i 's/\bValue::List\b/ListValue/g'
git grep -lw 'Value::Dict' | xargs sed -i 's/\bValue::Dict\b/DictValue/g'
git cl format
```
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/6bc468d481835992696083e99e556516fb7f5f80
```
commit 6bc468d481835992696083e99e556516fb7f5f80
Author: Avi Drissman <avi@chromium.org>
Date: Thu Jan 29 22:14:50 2026 -0800
Remove aliases for base::DictValue and base::ListValue
This removes a few last stragglers as well.
Fixed: 478100525
Cq-Include-Trybots: luci.chromium.try:win-official,mac-official,linux-official,android-official,android-desktop-x64-official
Change-Id: If92142b8ab0562a82c609b71c6b2a7665cea6ec6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7513889
Auto-Submit: Avi Drissman <avi@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1577038}
```
Issue: https://github.com/brave/brave-browser/issues/52435
This commit adds a new user preference that allows users to disable the
middle-click-to-close tab functionality, addressing user feedback that
accidental middle-clicks can cause unwanted tab closures.
Changes include:
**Browser Preferences:**
- Add kTabsCloseOnMiddleClick pref (default: true) in brave_tab_prefs.h
- Register preference in brave_prefs_util.cc for settings UI exposure
**UI Implementation:**
- Extend TabSlotController interface with CanCloseTabViaMiddleButtonClick()
- Implement pref checking in BraveTabStrip via base class override
- Override TabSlotController methods in tab_strip.h/cc to respect preference
- Add chromium_src overrides for FakeTabSlotController and FakeBaseTabStripController
to support testing infrastructure
**Tab Click Handling:**
- Patch tab.cc to check controller preference before handling middle clicks
- Use plaster.toml rewrite for cleaner code transformation
- Maintain existing behavior when preference is enabled (default)
**Settings UI:**
- Add "Close tabs on middle click" toggle to Appearance > Tabs settings
- Include localized strings in brave_settings_strings.grdp
* 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 PR does some IWYU for `base/memory/scoped_refptr.h` under
`//brave/browser`. This uses the standard script with the following
dataset:
```
HEADER_FUNCTION_SETS = [
(
'"base/memory/scoped_refptr.h"',
(
"scoped_refptr",
),
),
]
```
Bug: https://github.com/brave/brave-browser/issues/42212
* Add pref to always hide tab close button
Some users prefer a cleaner tab appearance without close buttons, as
they close tabs using other methods (e.g., middle-click, shortcuts).
So close button could be no more than a visual distraction or accidental
click.
This commit introduces a new preference that allows users to always hide
the tab close button.
* Introduce ControllableCloseButtonState
This is a sort of decorator class that wraps bool showing_close_button_
so that we can consider additional factors when determining whether to show
the close button, such as whether the mouse is hovering over the tab,
or whether the controller wants to always hide the close button.
Resolvesbrave/brave-browser#40863
With this PR, we use chromium's browser theme instead of ours.
Removed all our dark mode handling code.
Only left dark mode value in local state for migration.
BraveCustomzieColorSchemeModeHandler was introduced to set user's theme choice
to our local state prefs instead of chromium's profile color scheme. Removed.
All our changes to NativeTheme are removed.
Migrated current dark theme mode to per-profile browser color scheme.
ThemeService migrates only once.
After it's migrated, browser will have per-profile theme mode like chromium does.
TEST=BraveThemeServiceTest.BraveDarkModeMigrationTest
Remove Super Referrals web UI. The feature is no longer supported or
used, and this cleanup helps reduce unused code and simplify the overall
system as part of https://github.com/brave/brave-browser/issues/44403.
Add OllamaService connection check with factory and preferences
This change introduces a dedicated OllamaService for managing
communication with local Ollama instances:
- Add OllamaService with IsConnected() method to check Ollama
availability at localhost:11434
- Add OllamaServiceFactory as ProfileKeyedServiceFactory for
proper lifecycle management
- Add ollama.mojom interface defining kOllamaBaseUrl constant
and OllamaService mojo interface
- Add comprehensive unit tests for connection scenarios
- Add kBraveAIChatOllamaFetchEnabled preference for user control
- Register OllamaServiceFactory in browser context initialization
- Add preference to settings_private allowlist for WebUI access
- Add browser/ai_chat/ollama directory with factory implementation
- Wire up OllamaService dependency in content/browser layer
The service performs lightweight connection checks (1KB max) to
verify Ollama availability before enabling fetch functionality.
Issue: brave/brave-browser#40863
This is the effort to reduce the size of #31939
and only removes already deprecated codes that refers brave dark theme api.
- 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.
* Ad block only mode settings UI
The PR adds “Adblock only mode” alert box and a
“Adblock only mode” toggle to Brave Shields
Settings page.
---------
Co-authored-by: Terry Mancey <terry.mancey@icloud.com>
Co-authored-by: Jay Harris <jay.harris@outlook.co.nz>
This change adds `[[clang::no_destroy]]` to all places where
`-Wexit-time-destructors` has caused an error. This is a mechanical
change, and the individual cases must be fixed separately.
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/62849b7b1a562b823e34e64ec54b9724dc88cbfd
commit 62849b7b1a562b823e34e64ec54b9724dc88cbfd
Author: Claudio DeSouza <cdesouza@chromium.org>
Date: Mon Aug 25 07:58:19 2025 -0700
Reland "[exit-time-destructors] Enable by default"
This reverts commit cfbf29170f0b3e73e580d291085c188f8aa8cfa0.
The cause for the revert was breakage elsewhere that needed exclusions,
which are being handdled in https://crrev.com/c/6863758
Bug: 40031409, 430332953
Original change's description:
> Revert "[exit-time-destructors] Enable by default"
>
> This reverts commit 180c32cb5158bb4039235288b38813697b757e1a.
>
> Reason for revert: Broke the build on some bots:
> https://ci.chromium.org/ui/p/chromium/builders/ci/chromeos-arm-generic-rel/148963/overview
>
> Bug: 40031409, 430332953
> Original change's description:
> > [exit-time-destructors] Enable by default
> >
> > This CL enables `-Wexit-time-destructors` as a default warning in
> > Chromium. As the value of `is_wexit_time_destructors_default` is being
> > flipped, it is expected that the old config, `wexit_time_destructors`,
> > which was a opt-in, will become no-op, while the newly introduced
> > opt-out config will have its effect in places with pending issues.
> >
> > There are exclusions being added to `warning_suppression.txt` for
> > certain paths under `//third_party/`. These entries attempt to be the
> > narrowest possible. Work is under way to eliminate completely the need
> > for these, but this is in general slow (although fixes have been merged
> > into dawn, v8, and pdfium).
> >
> > Bug: 40031409, 430332953
> > Change-Id: I0c01c1e4ef8dfdcc319538cbda7991f364a6f22c
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6826535
> > Reviewed-by: Devon Loehr <dloehr@google.com>
> > Commit-Queue: Claudio DeSouza <cdesouza@chromium.org>
> > Cr-Commit-Position: refs/heads/main@{#1502919}
>
> Bug: 40031409, 430332953
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Change-Id: Icefe8b2206147767f0c074362e995af2030a1fd6
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6860282
> Auto-Submit: Thomas Guilbert <tguilbert@chromium.org>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Reviewed-by: Devon Loehr <dloehr@google.com>
> Cr-Commit-Position: refs/heads/main@{#1502936}
Bug: 40031409, 430332953
Change-Id: Ib556482a0b31814107eafe3620af13e0d272cd76
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6859042
Reviewed-by: William Liu <liuwilliam@chromium.org>
Reviewed-by: Devon Loehr <dloehr@google.com>
Commit-Queue: Claudio DeSouza <cdesouza@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1505863}
* Add pref to control "Hide vertical tabs completely when collapsed" feature
This PR adds a new preference to control the "Hide vertical tabs
completely when minimized" feature.
The list was not updated nor maintained, and even had invalid entries.
On device which uses a local ML model was tied to this preference for some reason too, so that keeps the preference around and has a checkbox for just that now.
For Android, it doesn't support on device suggestions because the ML
models aren't available there, so no checkbox was added there.
* 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>
- 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`)
* Remove wallet exstension APIs and replace with WebUI handlers
* Remove typescript definitions which are unused
* Remove the reset of the brave_wallet extension API
* Add test for webui handler changes
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
feat(Leo): Support user customization and memory
- Add new preferences for user customization (a dict with name, job, tone,
other) and memory (a list of user memories)
- Add UserMemory event and the function to create it in conversation
API engine consumer using values from added preferences
- Settings UI to manage these prefs
- Unit tests and l10n strings
The memory feature allows Leo to retain user-specific information
across sessions, enhancing personalization and creating more relevant
interactions.
1. User Customization Storage: Users can provide their name, job,
preferred tone, and additional preferences through the settings UI.
These are stored as user preferences and persist across browser
sessions.
2. Memory Collection: Users can add, edit, and delete specific memories
through the memory management interface. These memories are stored
as a list in user preferences.
3. Conversation Integration: A UserMemory event consists of data from
user customization and memory preferences would be added into Leo
conversation requests if user customization or user memory feature
preference is enabled with non-empty customization data or memories.
4. Personalized Responses: The AI engine receives this memory context
and can tailor responses based on:
- How the user prefers to be addressed (name)
- Their professional context (job)
- Their preferred communication style (tone)
- Specific memories and preferences they've shared
5. Memory Management: Users have full control over their memories
through the settings UI, including:
- Adding new memories with custom text
- Editing existing memories
- Deleting individual memories
- Clearing all memories at once
- Enabling/disabling the memory feature entirely
6. Privacy and Control:
- All memory data is stored locally in user preferences
- Users can disable memory features at any time via Settings UI
- Memories can be individually deleted or completely cleared
* Move Brave Shields utility functions
- Move utility functions that are not using `//content/` from `/components/brave_shields/content/` to `/components/brave_shields/core/` so it can be also be accessed by iOS.
* Update tests
- Update tests after moving functions from `/components/brave_shields/content/` to `/components/brave_shields/core/`.
* Fix UNSAFE_TODO
- Update brave_shields_p3a.cc to address unsafe buffer warnings.