24 Commits
Author SHA1 Message Date
Sangwoo Ko 21ca687cb4 Add optional horizontal tab strip scroll buttons (#35473)
* 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.
2026-04-24 10:12:33 -04:00
Sangwoo Ko 9c3ff661b3 Enable horizontal scrollable tab strip flag and make preference (#35448)
* 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
2026-04-16 08:00:06 +09:00
Sangwoo Ko d140628bb7 Make options for minimum tab width (#35071)
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
2026-04-01 14:00:18 -04:00
Sangwoo Ko 2e2024b511 Add setting to control middle-click-to-close tab behavior (#32926)
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
2026-01-08 12:52:45 +09:00
Brian R. Bondy f0656b06f9 Consolidate pref_names.h files (common -> browser) (#32603)
Consolidate pref_names duplicates (common -> browser)
2025-11-29 22:15:10 -05:00
Brian R. Bondy a4d9248fcb Add enable_brave_wallet gn var and build flag (#32484)
* 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
2025-11-28 15:54:27 -05:00
Sangwoo Ko b0ca080ece [Tabs] Add pref to always hide tab close button (#32189)
* 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.
2025-11-18 00:36:27 +09:00
Sangwoo Ko 9414565fa1 [Tree Tabs] Implement BuildTreeTabs() and FlattenTreeTabs() (#30447)
* Implement BuildTreeTabs() and FlattenTreeTabs()

TreeTabNodes are specialized TabCollections that wrap individual tabs,
allowing for hierarchical nesting and advanced tab relationships.

- `BuildTreeTabs()`: Converts tab structure to tree hierarchy
  by wrapping all tabs in TreeTabNodes
- `FlattenTreeTabs()`: Reverses the process, extracting tabs from
  TreeTabNodes back to non-tree-tabs structure while preserving order

- `BraveTabStripModel` exposes BuildTreeTabs/FlattenTreeTabs APIs for testing
- `BraveTabStripModel` will automatically build or flatten tree tabs
  based on user preferences, specifically the `kTreeTabsEnabled` and
  `kVerticalTabsEnabled` preferences.
- Methods are feature-gated behind kBraveTreeTab feature flag

- TreeTabNodes can be added to unpinned collections, split and tab groups
- Support for recursive nesting: TreeTabNode -> Group -> TreeTabNode
- Maintains compatibility with existing tab strip infrastructure
2025-09-16 12:28:38 +09:00
cdesouza-chromium 3b81f266bd [CodeHealth] Avoid NoDestructor where a static array suffices (#26354)
This PR removes some of the uses of `NoDestructor` for cases where
`std::vector` was being used to store static data. This is safe, as the
storage of the data is static.
2024-11-04 18:53:15 +00:00
Jocelyn Liu efcb1df7c6 Remove enable_ai_chat buildflag 2024-10-31 20:15:18 -07:00
sangwoo.ko 2c32328879 Add preference to en/disable Shared pinned tab 2024-05-23 16:31:48 +09:00
Simon Hong 61a8371a66 Fixed wallet button visibility regressions
fix https://github.com/brave/brave-browser/issues/37367
2024-04-08 15:13:25 +09:00
Darnell Andries bd0d3373dc Move sidebar features into //brave/components/sidebar/common 2024-04-02 10:43:57 -07:00
Sangwoo Ko 385ea20413 Add a context menu to hide "All bookmarks button" (#21918)
* Add a context menu to hide "All bookmarks button"
2024-02-08 05:04:41 +09:00
Sangwoo Ko fa0ca835ae Add an option to show/hide scrollbar on vertical tab strip (#21596) 2024-01-19 15:47:51 +09:00
Sangwoo Ko 4490b1dc7f Make option to set vertical tab position (#21480)
* Make option to set vertical tab position

Make it possible to move vertical tabs on the right side of browser window.
2024-01-06 10:07:13 +09:00
Pete Miller b8e2daec67 AI Chat: Suggested questions becomes on-demand instead of automatic
There is no longer a need for the related preference.
2023-11-21 20:39:32 -08:00
Brandon-T 06bc0b8974 Fix #33451: Refactor ai_chat component for iOS (#20425)
Refactor ai_chat_tab_helper to platform generic, so that iOS can use the same core code for its APIs.

With this change, iOS is able to supply a web-page, URL, and all of the things Desktop does.

Fix layering violation.

Fix iOS not compiling due to unit tests that include "content".

Renamed from AIChatDriver to ConversationDriver
2023-11-08 13:02:32 -05:00
taher d48924761f AIChat: show standalone premium prompt after 24h (#20548) 2023-10-19 08:09:21 -07:00
Sangwoo Ko 79c189e975 Support Leo autocomplete suggestion (#20291)
* Support Leo Autocomplete suggestion

When typing search keyword, Leo suggestion should show up from Omnibox popup.
This suggestion will lead to the Leo sidebar panel.
2023-09-29 22:39:40 +09:00
Cepera ccce58f0a6 Option to disable autofill while in private browsing mode (#19585) 2023-08-09 14:52:47 +07:00
Pete Miller 5812381348 AI Chat: introduce question suggestions and fold summarization as an on-demand question suggestion. Allow free-text chat anytime. 2023-06-22 22:12:23 -07:00
Simon Hong 4f2382618a Added resize handle to side panel
fix https://github.com/brave/brave-browser/issues/30808

SidePanelResizeHandle's ResizeArea detects resize event and
BraveSidePanel updates preferred width with resized offset.
2023-06-22 19:40:48 +09:00
Sangwoo Ko ef73587a3d Add Vertical tab related prefs to pref allowlist (#18589)
* Add Vertical tab related prefs to pref whitelist

The list should be preferred to GetOriiginalProfile()
2023-05-25 03:43:22 +02:00