Commit Graph
55 Commits
Author SHA1 Message Date
Claudio DeSouza d38d733dde [cr149] PageActionPerActionMetricsRecorder renamed
This PR fixes the plaster for `PageActionPerActionMetricsRecorder`,
which has to use the new `PageActionMetricsRecorder`. This PR also
improves the plaster to disable any `Record` functions in this class, so
we can notified when new ones are added.

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/42d106dd97f5729ff8ccf50171f3dc87798d76d8

commit 42d106dd97f5729ff8ccf50171f3dc87798d76d8
Author: Kaan Alsan <alsan@chromium.org>
Date:   Fri Apr 24 14:29:50 2026 -0700

    Consolidate PageAction Metrics Recording using ScopedMultiSourceObservation

    This CL transitions the PageAction metrics recording system from
    multiple ScopedObservation-based recorders to a single
    PageActionMetricsRecorder using ScopedMultiSourceObservation.

    Previously, we had count(page actions) * count(tabs) metrics recorder
    objects, which duplicated GURLs and created many individual scoped
    observations. This CL improves efficiency by sharing navigation state
    across all actions in a tab and reducing the total number of
    observations. With local profiling (with debug parameters on), this
    saves ~100KB per tab, with 31 page actions enabled.

    Key changes:
    - Merged per-action and page-level metrics logic into a unified
      PageActionMetricsRecorder.
    - Updated PageActionModelInterface to include GetActionId() for
      identification in the consolidated recorder.
    - Refactored PageActionControllerImpl to manage the unified recorder.
    - Deleted the redundant PageActionPageMetricsRecorder.
    - Updated unit tests and test support classes to align with the new
      architecture.

    Bug: 384074251
    Change-Id: I1aeb2205b4d36de3af68d70404ce459babf1dbef
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7790756
    Commit-Queue: Kaan Alsan <alsan@chromium.org>
    Reviewed-by: Foromo Daniel Soromou <koretadaniel@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1620471}
2026-05-22 16:25:14 -04:00
Claudio DeSouza abbf8cc947 [cr149] IsWebContentsVisible cannot be override through Browser
Browser doesn't inherit from `ChromeWebModalDialogManagerDelegate`
anymore. This change fixes our code by directly patching
`ChromeWebModalDialogManagerDelegate` to have an override for this
method.

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/083c2a8b08fff93b74aac4f4acd89c5d1fb206ea

commit 083c2a8b08fff93b74aac4f4acd89c5d1fb206ea
Author: Qikai <qikaizhong@microsoft.com>
Date:   Tue Apr 21 22:53:26 2026 -0700

    [bedrock] Move ChromeWebModalDialogManagerDelegate to BrowserWindowFeatures

    Extract ChromeWebModalDialogManagerDelegate from Browser into a new
    BrowserWindowModalDialogDelegate owned by BrowserWindowFeatures. The
    new class manages per-tab WebContentsModalDialogManager delegate
    registration via TabStripModelObserver and handles tab blocking,
    fullscreen exit, and dialog host lookup.

    Browser retains a thin SetWebContentsBlocked() override for
    DesktopBrowserWindowCapabilitiesDelegate, forwarding to the feature.
    DevTools scrim visibility uses a callback pattern subscribed by
    BrowserView.

    Bug: 496674143
    Change-Id: Ia8aea00b733e113c5ca9e9e79d28a37061eb8ced
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7738543
    Reviewed-by: Thomas Lukaszewicz <tluk@chromium.org>
    Commit-Queue: Qikai Zhong <qikaizhong@microsoft.com>
    Cr-Commit-Position: refs/heads/main@{#1618668}
2026-05-22 16:25:09 -04:00
Claudio DeSouza 824695407f [cr149] Fixing kLearnMoreLink override and others
This change fixes the replacement of this constant, which would require
a patch from now on, so now it is managed by a plaster.

`AskBeforeHttpDialogController::HasOpenDialogWidget` also got renamed.

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/b09b2ab7d59f05f8ec5342a75c830731e31fcdf1

commit b09b2ab7d59f05f8ec5342a75c830731e31fcdf1
Author: Chris Thompson <cthomp@chromium.org>
Date:   Mon Apr 20 13:07:57 2026 -0700

    [ABH] Port Ask-before-HTTP dialog to Android

    This ports the Ask-before-HTTP warning dialog to Android and adds
    Android UI test coverage in AskBeforeHttpDialogTest.

    ModalDialogWrapper is updated to plumb the dismissal cause back to the
    native side so the dialog controller can differentiate between a user
    explicitly dismissing the dialog (e.g., via the back button) versus the
    tab disappearing for other reasons (e.g., tab switching). The
    AskBeforeHttpDialogController is also updated to observe WebContents
    visibility to handle dialog restoration after tab switching on Android
    (to match the Desktop behavior where the tab modal is "sticky" to the
    tab even when it goes to the background).

    NO_IFTTT=intentional renaming inside blocks

    Bug: 351990829
    Change-Id: Ia95068e5c69762eae26ab9cc137b1f06e05d6a48
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7753961
    Reviewed-by: Mustafa Emre Acer <meacer@chromium.org>
    Reviewed-by: Calder Kitagawa <ckitagawa@chromium.org>
    Reviewed-by: Jack Thiesen <jthiesen@chromium.org>
    Commit-Queue: Chris Thompson <cthomp@chromium.org>
    Reviewed-by: Alison Gale <agale@chromium.org>
    Auto-Submit: Chris Thompson <cthomp@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1617725}
2026-05-22 16:25:05 -04:00
Claudio DeSouza ee21a68e88 [cr149] Correcting how PageActionPassKey is passed around
This follows the upstream change to change the type alias.

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/2e10893b38937e012a704bcfc3fe0d31e2a5e6a6

commit 2e10893b38937e012a704bcfc3fe0d31e2a5e6a6
Author: Kaan Alsan <alsan@chromium.org>
Date:   Fri Apr 17 08:39:41 2026 -0700

    Refactor PageActionController to decouple from PageActionView

    Change-Id: Ibbe900b983c980e7af502e89eda530082015dd4c
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7755799
    Commit-Queue: Kaan Alsan <alsan@chromium.org>
    Reviewed-by: Muhammad Salmaan <musalmaan@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1616595}
2026-05-22 16:25:04 -04:00
Claudio DeSouza a14306c238 [cr149] Fixing kPageActionProperties patching formating
Recent changes in upstream have changed the tabulation. Although this
has not caused any conflict when applying patches, this change updates
the plaster to better reflect the current desired patching.

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/39f1fc11de89a81d446d6ee520973294a4023254

commit 39f1fc11de89a81d446d6ee520973294a4023254
Author: Ian Wells <iwells@chromium.org>
Date:   Tue Apr 7 09:48:58 2026 -0700

    Add contextual cueing v2 page action

    Contextual cueing v2 will show cues for a few different features, so
    while the page action is registered with the other browser actions, its
    icon, anchored message details and click handler aren't set until it's
    time to show a cue for a specific feature.

    Bug: 497231692
    Change-Id: I641e13d43661806a64759018a837f6fe316bfaac
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7732046
    Reviewed-by: Charlie Harrison <csharrison@chromium.org>
    Reviewed-by: Sophie Chang <sophiechang@chromium.org>
    Commit-Queue: Ian Wells <iwells@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1610829}
2026-05-22 16:18:04 -04:00
Michael Herrmann 2ce8e7206e Add more Omaha 4 macOS update failure logging (#36607) 2026-05-21 16:30:12 +01:00
cdesouza-chromium 764f28a940 [plaster][android] Migrate AUTOPLAY patches (#36290)
[cr150][plaster][android] Migrate `AUTOPLAY` patches

This PR migrates several java patches for `AUTOPLAY` to plaster. It uses
the same previous techniques, where we match the enum block and add at
the end.

The only innovation in this PR as an approach for plaster is the
replacement of the value `NUM_ENTRIES` with `+1` for whatever keys we
are inserting, while at the same time using the previous value of
`NUM_ENTRIES` as the starting value for the first key.

Resolved https://github.com/brave/brave-browser/issues/55385
2026-05-19 22:44:45 +01:00
cdesouza-chromium 7128c2ea48 [CodeHealth][plaster] Keep in chromium_src non-macro code (#36502)
This PR moves to `chromium_src` code that can live in there, and does
with no need for `#define` macro uses. This keeps plaster files shorter,
which reduces the noise in them, and it also permits C++ code to live
in C++ sources, that can benefit from code formatting, and DEPS
validation.
2026-05-18 23:51:45 +01:00
Michael Herrmann 191feef9f9 Add code to debug Omaha 4 update failures on macOS (#36480) 2026-05-18 14:20:46 +01:00
cdesouza-chromium 6148d17fe6 [brockit][sync] Avoiding bool in DeviceInfo (#36409)
The use of `bool` for `DeviceInfo` fields has led to bugs in the past.
This has been correct with plaster, however we should also convert the
field to an enum to make sure we follow the upstream practice of using
enums in this type.

Resolves https://github.com/brave/brave-browser/issues/55018
2026-05-14 13:26:01 +01:00
cdesouza-chromium 5668c5c158 [plaster] Make RequestType insertions more generic (#36289)
This PR changes the way we are patching `RequestType` to not have to
rely on any particular key, but just introduce our keys at the end of
the enum value. This technique allows for the replacemnt of `kMaxValue
to use the new value we provide.
2026-05-13 12:00:39 +01:00
cdesouza-chromium 3f27daa4ff [plaster] Remove count = 1 lines (#36310)
Removing these lines so we can introduce `count` value checks to steer
users towards fixed counts only when needed, and away from `count=0`. At
the moment removing these as they are redundant.
2026-05-12 18:34:53 +01:00
Michael Herrmann f3d9860706 Fix a cause of Omaha 4 update failures on macOS (#36347) 2026-05-12 15:44:33 +02:00
Sangwoo KoandClaudio DeSouza 87ce902114 Try to minimize plaster related to PageActionController/Model (#36267)
Minimize plaster related to PageActionController/Model

In order to make patching strategy more robust agains upstream chagnes,
we should prefer `chromium_src override without #define macro' to
'complex plaster'.

Co-authored-by: Claudio DeSouza <cdesouza@brave.com>
2026-05-11 12:31:27 +09:00
cdesouza-chromium 35f807c9ab [plaster][cr149] ECDSA_SHA384 🩹🩹🩹🩹 (#36118)
This change migrates all `ECDSA_SHA384` code additions to plaster. These
additions started causing build breakages in M149 due to unwanted
replacements in a proto generated header, which broke nearly all of
them.

These plasters are smart enough to match with the contents of the block
they are aimed at.

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/70cb8d8433679502ede773d828bf31cb0a1bce16

commit 70cb8d8433679502ede773d828bf31cb0a1bce16
Author: hamda mare <hmare@google.com>
Date:   Tue Apr 28 12:53:24 2026 -0700

    Add proto and type definitions for certificate collection

    This CL adds the necessary proto messages and C++ types to support certificate collection in signal reports.

    Bug: 502634772
    Change-Id: I2136d39ac83c293856690a8acef12d6d2babdeec
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7795711
    Reviewed-by: Igor Ruvinov <igorruvinov@chromium.org>
    Reviewed-by: Zonghan Xu <xzonghan@chromium.org>
    Commit-Queue: Hamda Mare <hmare@google.com>
    Cr-Commit-Position: refs/heads/main@{#1621979}

Resolves https://github.com/brave/brave-browser/issues/55193
2026-05-08 23:25:10 +01:00
Brian R. Bondy 4e3862b0eb Fix Brave Origin branding on Windows alt+tab (title and icon) (#36257)
The window title format and captive portal title strings in
brave_origin_strings.grd were still showing "Brave" instead of
"Brave Origin", and the chrome.dll icon resources (used for the
per-window HICON via WM_SETICON) were hardcoded to the brave/
theme path with no IS_BRAVE_ORIGIN_BRANDED gating. The chrome.exe
icons (brave_exe.rc) were already correctly gated, which is why
shortcut/taskbar icons were correct but alt+tab was not.

- Add IDS_BROWSER_WINDOW_TITLE_FORMAT and
  IDS_CAPTIVE_PORTAL_BROWSER_WINDOW_TITLE_FORMAT to
  ORIGIN_BRANDED_MESSAGES in chromium-rebase-l10n.py so the
  branding rewrite picks them up on every rebase.
- Update the currently-checked-in brave_origin_strings.grd to
  apply the same branding now.
- Gate chrome/app/chrome_dll.rc icon resources on
  IS_BRAVE_ORIGIN_BRANDED, mirroring brave/app/brave_exe.rc.
- Define IS_BRAVE_ORIGIN_BRANDED for the chrome_dll_resources
  source_set when is_brave_origin_branded=true.
2026-05-08 16:11:27 -04:00
Anthony Tseng 8eb36cae9a [History Embeddings] Hide omnibox thumbs up/down and fix disclaimer trailing space (#36112)
Follow-up to #35813 / brave-browser#54798. The previous PR removed the
WebUI feedback buttons on chrome://history and the side panel, but the
native Views omnibox still surfaced thumbs up/down on HISTORY_EMBEDDINGS
matches when the user typed `@history`
(brave-browser#55178).

- Plaster `OmniboxPopupSelection::IsControlPresentOnMatch` to inject a
  short-circuit `if ((true)) return false;` immediately after the
  FOCUSED_BUTTON_THUMBS_UP / FOCUSED_BUTTON_THUMBS_DOWN case labels.
  Matching only the case labels (not the existing return expression)
  keeps the plaster resilient if Chromium tweaks the body. With these
  selections never available, OmniboxResultView::
  UpdateFeedbackButtonsVisibility keeps the buttons hidden, keyboard
  traversal skips them, and the feedback page is unreachable from the
  omnibox.

- Combine the existing featured_search_provider.cc IDS swap with a
  drop of the upstream `+ u" "` separator in a single substitution.
  With the link text already swapped to IDS_BRAVE_EMPTY_STRING in
  #35813, that separator left match.contents with a trailing space
  that tripped the AutocompleteMatch::SanitizeString DCHECK in
  AutocompleteResult::AppendMatches.
2026-05-05 23:54:15 +01:00
Michael Herrmann b0ba9a6ac9 Fix Omaha 4 updates for non-std .app dir on macOS (#36042) 2026-05-05 18:47:07 +01:00
cdesouza-chromium 4df5363858 [plaster] Migrate DeviceInfo override (#35958)
This PR rewrites our overrides relating to `DeviceInfo` specifically
into plaster. This involves dropping `BraveDeviceInfo` and implementing
the functionality in terms of extending `DeviceInfo`

Resolves https://github.com/brave/brave-browser/issues/55018
2026-05-02 00:52:35 +01:00
cdesouza-chromium aa5bd05238 [plaster] Migrating CookieMonster (#35518)
This PR migrates `CookieMonster` from macro replacements to be handled
by `plaster`. This is going to be specially useful in `cr149` where a
recent landed changed (https://crrev.com/c/7727488) would force the
introduction of patch files, and become very disruptive for how these
replacement macros work right now in general.

This PR attemps a novel approach to replicate the common pattern where
in Brave we want to replace a Chromium class with a derived Brave class:
the Chromium class is moved into a nested namespace called
`chromium_impl`, and the brave implementation is declared in its place
in a shadow file.

This has required additional plaster for types that absolutely have to
refer to the chromium implementation, but the outcome is much simpler
than the previous invisible replacements.

This change leaves no `#define` uses for replacement in the shadow
files.

Resolve https://github.com/brave/brave-browser/issues/54496
2026-05-01 14:09:50 +01:00
cdesouza-chromium 3bb82b9e52 [plaster] PermissionContextBase migration (#35907)
[plaster] `PermissionContextBase` migration

The introduction of plasters for `PermissionContextBase` gets rid of a
lot of replacement cruft that was really difficult to make sense of.
This change also tweaks the interface for
`BraveCanBypassEmbeddingOriginCheck`, so it can make the plaster simpler
for this substitution too.

The core of this change is to move `PermissionContextBase` in upstream
into `chromium_impl::`, and derive our own implementatiom from that,
which simplifies a lot of the issues with naming replacement everywhere.

Resolves https://github.com/brave/brave-browser/issues/54952
2026-04-28 23:43:52 +01:00
cdesouza-chromium 6d4290917d [plaster] Migration and fixes for request type customisations (#35903)
This PR migrates all macros in `components/permissions/request_type.cc`
to plaster. The use of macros here particularly hid the fact that we
failed to override the correct functions, in particular the way we were
treating brave keys for `RequestTypeToContentSettingsType` and
`IsRequestablePermissionType` was incorrect as both these functions are
callers of `ContentSettingsTypeToRequestTypeIfExists`, and this fucntion
has been slipping through all this time.

Resolves https://github.com/brave/brave-browser/issues/54949
2026-04-28 03:29:56 +01:00
AlexeyBarabash b4a2a3a144 [cr148][Android] Removed moveTabsToWindowByIdChecked from MultiInstanceManagerApi31.ctor
Used MultiInstanceOrchestratorImpl override.

Chromium change:
https://source.chromium.org/chromium/chromium/src/+/1eff3e2dfcb821e6a6fbccae543632bb5ebbce98

commit 1eff3e2dfcb821e6a6fbccae543632bb5ebbce98
Author: Aishwarya Rajesh <aishwaryarj@google.com>
Date:   Wed Mar 18 15:32:23 2026 -0700

    [MIR] Create MultiInstanceOrchestrator as a singleton to hold business
    logic that is not scoped to a specific ChromeTabbedActivity

    This CL attempts to simplify accessing multi-instance business logic
    from callers that do not have access to a MultiInstanceManager instance
    (for example, CCT context based feature implementations), by introducing
    a MultiInstanceOrchestrator singleton implementation.

    The CL only moves method moveTabsToWindowByIdChecked() as an initial
    example for usage of this class. Other MultiInstanceManager API methods
    that can be extracted into the singleton will be moved in followup CLs.

    Bug: 491893859
    Change-Id: I459a5ed79b058b548f42fd3c85f0b9382e756803
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7659642
    Reviewed-by: Calder Kitagawa <ckitagawa@chromium.org>
    Commit-Queue: Aishwarya Rajesh <aishwaryarj@google.com>
    Cr-Commit-Position: refs/heads/main@{#1601584}
2026-04-27 12:00:50 +01:00
AlexeyBarabash db772bc88c [cr148] kSyncAutofillLoyaltyCard deleted and made default
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/ba1bc87f5b13d8446edbd4d30013806bd4ce2d41

commit ba1bc87f5b13d8446edbd4d30013806bd4ce2d41
Author: Norge Vizcay <vizcay@google.com>
Date:   Wed Mar 11 00:42:18 2026 -0700

    Remove kSyncAutofillLoyaltyCard feature flag

    The kSyncAutofillLoyaltyCard feature has been launched. This CL removes
    the feature flag and its associated conditional logic, making the
    syncing of loyalty cards from Google Wallet enabled by default.

    Bug: b:393119606
    Test: components_unittests --gtest_filter=ValuablesDataManagerTest.*
    Test: sync_integration_tests --gtest_filter=SingleClientValuablesSyncTest.*
    Test: unit_tests --gtest_filter=SyncServiceFactoryTest.*
    Change-Id: I63f09797a9cab0c28edb0f0439c7d1ef130e4fbb
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7654135
    Commit-Queue: Norge Vizcay <vizcay@google.com>
    Reviewed-by: Marc Treib <treib@chromium.org>
    Reviewed-by: Etienne Bergeron <etienneb@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1597558}
2026-04-27 12:00:44 +01:00
AlexeyBarabash 2a0d8de9ef Android settings containment (#35636)
* [Android] Fixed containment at settings

Resolves https://github.com/brave/brave-browser/issues/54164

* Fixed containment for the Homepage settings screen
* Fixed containment for WebRTC policy screen
* Fixed containment at Languages settings; modified SettingsUtils.getVisiblePreferences
* Fixed  privacy item
* Fixed containment for NFT discovery learn more preference
Replaced TextMessagePreference (BackgroundStyle.NONE, transparent) with
ChromeBasePreference so the NFT description groups with the Enable NFT
discovery toggle in one card. Follows the same camera OS-warning pattern:
ForegroundColorSpan for the link color, setOnPreferenceClickListener for
the tap action, matching Chromium upstream conventions.
* Moved NFT discovery block before Reset wallet preference
Enable NFT discovery toggle and its description now appear above
"Reset and clear wallet data", matching the intended UX order.
* Fixed containment for Brave Firewall + VPN settings
Set initial visibility of server_change_location in onCreatePreferences
to avoid animated removal artifact. Call notifyPreferencesUpdated() after
dynamic visibility changes in updateSummaries so containment styles stay
in sync with adapter positions.
* Fixed containment for New Tab Page settings learn more
Replaced ClickableSpansTextMessagePreference with ChromeBasePreference
for the sponsored images learn more link so it groups into the
Background Images card with the toggles above it.
* Removed On/Off captions from New Tab Page switch prefs
2026-04-25 18:49:09 +03:00
AlexeyBarabash 349f355b2d [Android][CodeHealth] Convert SearchIndexProviderRegistry.java.patch into a plaster (#35739)
* [Android][CodeHealth] Convert SearchIndexProviderRegistry.java.patch into a plaster

Resolves https://github.com/brave/brave-browser/issues/54807
2026-04-25 18:46:41 +03:00
Anthony Tseng bb1a0b8fab [History Embeddings] Clarify zero data collection for history semantic search (#35813)
* [History Embeddings] Hide UI entry points that imply a cloud round-trip

Strip the pieces that either ask the user for feedback we don't send
anywhere or link to a settings page we don't expose:

  - cr-feedback-buttons (thumbs up/down) in the history embeddings
    results card — no telemetry for an on-device feature.
  - "Learn more" link in the chrome://history disclaimer and in the
    history side panel — both pointed at historyEmbeddingsSettingsUrl.
  - "Manage your history search setting" link in the IPH promo.
  - "Learn more" link in the omnibox history embeddings disclaimer
    IPH row — pass empty link_text/GURL() so the disclaimer still
    renders without a link.

Part of https://github.com/brave/brave-browser/issues/54798

* [History Embeddings] Reword disclaimer and hide chrome://settings/ai

Brave's history semantic search runs entirely on-device (see
brave/browser/history_embeddings/README.md), so:

  - IDS_HISTORY_EMBEDDINGS_DISCLAIMER{,_LOGGING_OFF} and
    IDS_OMNIBOX_HISTORY_EMBEDDINGS_DISCLAIMER_IPH text about data being
    sent to Brave and seen by human reviewers is inaccurate. Add
    IDS_BRAVE_HISTORY_EMBEDDINGS_DISCLAIMER (in brave_generated_resources)
    and IDS_BRAVE_OMNIBOX_HISTORY_EMBEDDINGS_DISCLAIMER_IPH (in
    brave_components_strings) and swap the IDS in the chromium_src
    overrides for history_embeddings_utils.cc and
    featured_search_provider.cc. Owning the strings outright is resilient
    to upstream wording tweaks. Neither override requires a new GN dep:
    brave/grit/brave_generated_resources.h is reachable via the existing
    //chrome/app:generated_resources transitive dep, and
    components/grit/brave_components_strings.h via the existing
    brave_components_omnibox_browser_deps injection.
  - Force IsHistoryEmbeddingsSettingVisible() to false so the
    chrome://settings/ai/historySearch entry — and, transitively, the
    whole AI settings page and menu entry — drops out. Brave has no
    user-facing toggle for this feature.

Part of https://github.com/brave/brave-browser/issues/54798
2026-04-24 04:04:28 +01:00
cdesouza-chromium eb5ca4eaa0 [plaster] DownloadToolbarUIController migration (#35750)
This class has a few customisations that were awkward with macro
replacements and therefore the derived function. With plaster though, we
can just add a `ChromiumImpl` variant of a function, and then only
replace the declartion in the translation unit, which makes a lot of the
complexity present go away.

This change drops the derived class for `DownloadToolbarUIController`,
and just adds a call to our custom function at the end of the relevant
function updating the icon appearance.

This particular class was running into problems in M149
(https://crrev.com/c/7766617).

Resolves https://github.com/brave/brave-browser/issues/54814
2026-04-24 01:24:13 +01:00
Sangwoo Ko 7d3fc7cf97 [Containers] Activate PageActionIconView for Partitioned Storage on right click (#35194)
Activate PageActionIconView for Partitioned Storage on right click

As requested by the design team, we activate the PageActionIconView for the
Partitioned Storage on right click.
2026-04-03 03:13:52 +02:00
Max Karolinskiy 8fa484220b [cr147] page_actions::kActionIds declaration changed.
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/c9b45eb2b1609b62a2146b618f57aee136c7745e

commit c9b45eb2b1609b62a2146b618f57aee136c7745e
Author: Baran Erfani <baranerf@google.com>
Date:   Wed Feb 18 13:55:51 2026 -0800

    Add a new page action for Indigo

    This change introduces a UI entry point for Indigo by adding a new page
    action and its corresponding controller. The main changes are:
    - Introduce `kActionIndigo` chrome action along with the necessary set-up to add it as a page action following the instruction in  chrome/browser/ui/views/page_action/README.md.
    - Add `IndigoPageActionController` to handle and encapsulate all the logic related to showing/hiding the entry points.
    - Add `kIndigo` feature flag disabled by default.

    http://screencast/cast/NTkxMTQ2NTkwNjE0MzIzMnw2MWUwZDVlNy1kNA

    Bug: b:483103108
2026-03-26 19:55:29 -04:00
Max Karolinskiy bed8ec7aed [cr147] Updates plaster regex to fix greedy pattern.
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/533d98e429a8235e8ea5ab820a25d21e8f12389d

commit 533d98e429a8235e8ea5ab820a25d21e8f12389d
Author: Marwan Tammam <quarz@chromium.org>
Date:   Fri Feb 27 18:11:12 2026 -0800

    Prevent collapsed tab groups from expanding during drag.

    Fixed: 484039750
2026-03-26 19:25:27 -04:00
Max Karolinskiy 4f99b7a6ae [cr147] PageActionModel::NotifyChange signature changed.
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/2b7ab5aadfb26be57df25485c776474b16f16fce

commit 2b7ab5aadfb26be57df25485c776474b16f16fce
Author: Helmut Januschka <helmut@januschka.com>
Date:   Wed Feb 25 12:46:26 2026 -0800

    [PageActions] Defer reentrant model notifications in PageActionModel

    Replace the CHECK in NotifyChange with a deferred-notification loop so
    that reentrant calls are coalesced instead of crashing.

    Bug: 486080128
2026-03-26 19:25:26 -04:00
Sangwoo Ko 8dab9ab437 [Containers] Customize page action view for Partitioned storage (#34856)
* Customize page action view for Partitioned storage

* Set fixed height for partitioned storage page action view.
* Center the view in the container when the height is set.
* Ensure the label is always shown when the height is set.

* Use gfx::TruncateString to truncate the name of the partitioned storage page action
2026-03-24 15:35:50 +09:00
AlexeyBarabash a5a4c92555 [Android] Change back the number of tiles on NTP to 11 (#34845)
Resolves https://github.com/brave/brave-browser/issues/53813

This is cr146 regression

Chromium change:
https://source.chromium.org/chromium/chromium/src/+/aa3361c165e11f04d6cfbbadb6986d502a7f0e28

commit aa3361c165e11f04d6cfbbadb6986d502a7f0e28
Author: Samuel Huang <huangs@chromium.org>
Date:   Wed Jan 21 11:41:57 2026 -0800

    [Android NTP] Limit the number of MVT tiles to 8.

    Previously, the Android MVT could show up to 12 tiles in total. Custom
    Tiles (CT) had priority (up to 8), and Top Sites Tiles (TST) would fill
    the remaining slots up to the total limit of 12.

    Per UI guideline, this CL reduces the total limit from 12 to 8. Note
    that CTs continue to have priority, so if a user has 8 CTs then they
    don't see TSTs any more.

    This is an opportunity for backend optimization:
    * If 8 CTs exist then we can simply skip TST computation -- but this
      would be an abrupt transition
    * If 1-7 CTs exist then we can partially skip TST computation -- but
      this requires more refactoring.

    However, for simplicity, we skip these for now.

    Bug: 477017208
    Change-Id: Ie2251764b36d76c453985fbf22d101cb1354d637
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7495331
    Commit-Queue: Samuel Huang <huangs@chromium.org>
    Reviewed-by: Calder Kitagawa <ckitagawa@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1572479}
2026-03-20 16:31:30 +02:00
Brian Johnson b9811f29a7 Only use brave:// scheme for display (#34610)
brave:// should be converted to chrome:// as early as possible so all internal checks for chrome:// are valid. You can still open brave:// urls and they should display as brave:// urls, but internally both the actual url and virtual url should be chrome://
2026-03-20 00:49:16 +01:00
Jay Harris 955bab7106 [AI Chat]: Allow Leo to be added to home screen (#34586) 2026-03-13 09:07:34 +13:00
Aleksei Khoroshilov ce76e01a49 Support contained tabs session restore and sync. (#33313)
* Support contained tabs session restore and sync.

* Review fixes.

* Use struct as a return value instead of optional with out args.

* Add a unit test for view-source: scheme.

* Move TabRestore helper to components.

* Add containers-specific SerializedNavigationBuilder* tests.

* Guard PageState.top.url_string use.

* Add plaster files for few patches.

* Replace browser_tabrestore.cc #define patch with plaster rewrite.

* Replace content_serialized_navigation_builder.cc change with rewrite.

* Fix gn check.

* Add prefix_length check.

* Improve rewrite rules.

* Guard PageState changes with buildflag.

* Rename StoragePartitionKeyToUrlPrefix.

* Add buildflag check into SerializedNavigationEntry.

* Fix build issues with containers buildflag disabled.

* Fix iOS build.
2026-03-10 19:20:50 +07:00
AlexeyBarabash aca1146bb6 [cr146][Android] Fixed Toolbar's context menu on NTP (#34461)
* [cr146][Android] Fixed Toolbar's context menu on NTP

Resolves https://github.com/brave/brave-browser/issues/53325

Chromium change:
https://source.chromium.org/chromium/chromium/src/+/fffa16ba8f6c9a31287ebbda7168b73f804764f7

commit fffa16ba8f6c9a31287ebbda7168b73f804764f7
Author: Xi Han <hanxi@google.com>
Date:   Thu Feb 12 14:06:30 2026 -0800

    [M146] [Theme] Disable Toolbar's context menu on NTP.

    Original change's description:
    > [Theme] Disable Toolbar's context menu on NTP.
    >
    > After: http://shortn/_0VTka1eFkv.
    >
    > Bug: 483728699
    > Change-Id: I891d41df7efb3543aa5b5d6c0b2bea8b764a75db
    > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7568842
    > Reviewed-by: Patrick Noland <pnoland@chromium.org>
    > Commit-Queue: Xi Han <hanxi@chromium.org>
    > Cr-Commit-Position: refs/heads/main@{#1583457}

    (cherry picked from commit 04a91c870ed19c6f4efa64b443a2ddc48785c435)

    Bug: 483988249,483728699
    Change-Id: I891d41df7efb3543aa5b5d6c0b2bea8b764a75db
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7573413
    Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
    Auto-Submit: Chrome Cherry Picker <chrome-cherry-picker@chops-service-accounts.iam.gserviceaccount.com>
    Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
    Cr-Commit-Position: refs/branch-heads/7680@{#166}
    Cr-Branched-From: 76b7d80e5cda23fe6537eed26d68c92e995c7f39-refs/heads/main@{#1582197}
2026-03-06 19:26:40 +02:00
Sangwoo Ko 263959fa7f [Containers] Show PageActionView for partitioned storage tab in location bar (#34248)
* Show PageActionView for partitioned storage tab in location bar

When the current tab uses a Brave container (partitioned storage), show the
page action in the location bar with the container's icon, name, and
background color from ContainerModel.

- Register kPartitionedStorageActionIconType and enable it in the location
    bar only when ENABLE_CONTAINERS and the Containers feature are on.
- Add PartitionedStoragePageActionController that resolves the tab's
    container via GetContainerIdForWebContents and ContainerModel, and drives
    the generic PageActionView (Show/Hide, OverrideImage/Text, etc.); the
    action is hidden when the tab has no container.
2026-03-04 06:49:08 +09:00
Sangwoo Ko 80e1d21334 [Containers] Extend PageAction framework to support partitioned storage tab in location bar (#34176)
* Extend PageAction framework to support partitioned storage tab in location bar

This commit extends the PageAction framework to support:
* Override chip colors
* Always show label
2026-02-27 05:09:14 +00:00
Claudio DeSouza b356babd27 [cr146][cr147] TabStrip ctor taking TabHoverCardController
This change touches in several places where `TabHoverCardController`
is being plumbed into, to make sure we are passing a
`BraveTabStripRegionView`.

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/37fc5709e3536bdccf1ec86f7e358e08d7e3aeb7

commit 37fc5709e3536bdccf1ec86f7e358e08d7e3aeb7
Author: Dominic Austria <dominicaustria@google.com>
Date:   Tue Feb 10 14:54:11 2026 -0800

    [Reland][Vertical Tabs] Render Vertical Tab Hovercards

    Basic rendering of hovercards on vertical tabs. Screencast link:
    https://screencast.googleplex.com/cast/NTA3OTUwMDEzOTI2NjA0OHxkYmQ1Y2M4Ny03MA

    Bug: 465159270
    Change-Id: I7fb43ddd6ee312d709de24e3170b7ffca593eb64
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7556332
    Reviewed-by: Eshwar Stalin <estalin@chromium.org>
    Commit-Queue: Dominic Austria <dominicaustria@google.com>
    Cr-Commit-Position: refs/heads/main@{#1582838}
2026-02-26 14:14:56 +00:00
AlexeyBarabash cf98a0909f [cr146][Android] Fixed url bar on NTP
Had to use direct patch because there are two `isInSingleUrlBarMode`
methods at `NewTabPage` class. Bytecode patch caused java.lang.VerifyError
crash.

This change is intended to make `ToolbarPhone` always use
`mLocationBarBackground` instead of `mNtpFakeboxBackground.
Otherwise url bar on NTP has orange color and too rounded corners.

Chromium change:
https://source.chromium.org/chromium/chromium/src/+/d23864706c014549e1f1333face1ece0046c52bd

	[ParityV2] Clean up OmniboxMobileParityUpdateV2 on Android (Part 1).

	Clean up feature flag OMNIBOX_MOBILE_PARITY_UPDATE_V2 and feature
	param "retrieve_builtin_favicon" on Android.

	Bug: 426594110
	Change-Id: I705823eb0dbd34b0e1187dfde3b20f12c4b78fa7
	Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7523327
2026-02-26 14:14:55 +00:00
Sangwoo Ko c1efd77f68 Don't push toolbar aside when Brave vertical tabs are enabled
We don't need to push the toolbar aside when Brave vertical tabs are
enabled. This is because Brave shows the window captions atop of the
toolbar or, overlays the caption on the toolbar. In order to do this,
mark needs_exclusion as false when Brave vertical tabs are enabled.
And then exclude tab strip height when calculating the non client
frame height.

This commit also includes a patch to correctly calculate the client area
on Mac when Brave vertical tabs are enabled and should show window title
2026-02-26 14:14:55 +00:00
Sangwoo Ko b87d740e04 [Tree Tabs] Add level and height calculation for TreeTabNode (#33874)
* Add level and height calculation for TreeTabNode

TreeTabNode now maintains level and height for the tree-tabs hierarchy,
so UI and layout can use depth and subtree size without traversing.

- Level: depth in the tree. Root is 0; each child has parent level + 1.
- Height: depth of the subtree rooted at this node. A leaf has height 0.
  Non–tree-node children (e.g. TabGroup, SplitTabCollection) count as 1;
  tree-node children contribute (child height + 1). Node height is the
  max over all children.
- GetTreeHeight(): returns the root’s height (total tree depth), by
  walking up to the top-level ancestor.

Recalculation is done:
- On reparent: the moved node (and its subtree) recalculates level and
  height via CalculateLevelAndHeightRecursively in OnReparented.
- When a tree-node child’s height changes: the parent’s height is
  updated via OnChildHeightChanged (only tree-node children trigger
  this; adding/removing non–tree-node children does not).
2026-02-19 04:11:00 +00:00
Sangwoo Ko 0892438ed7 Address follow up items for #33603 (#33694)
* Change lin ending of tab_strip.cc.toml LF

* Force line ending to LF for toml files in .gitattributes

* Fix comment
2026-02-06 08:57:09 +09:00
Sangwoo Ko 1db2a2b2fd Fix vertical tab strip drag-and-drop by using BraveTabDragController (#33603)
* Always set dragged tabs as visible in vertical tabs mode

We don't have to hide them

* Fix vertical tab strip drag-and-drop by using BraveTabDragController

TabStrip was instantiating Chromium's TabDragController instead of
Brave's BraveTabDragController. That bypassed Brave-specific drag logic
and broke vertical tab strip drag-and-drop (insertion index, bounds,
detach/attach, etc.).

In tabstrip.cc, std::make_unique<TabDragController>() was replaced with
std::make_unique<TabDragControllerChromium>(), so Brave-sepcific logic
was bypassed.

This change restores the intended controller hierarchy and makes
overriding straightforward:

- TabStripController (Chromium) remains the base; Brave extends it as
  BraveTabStripController.
- TabStrip's drag context now creates BraveTabDragController instead of
  TabDragController explicitly

Implementation approach:

- Prefer patching over complex overrides: TabDragController::Init()
  was not virtualized, why we chose to renaming TabDragController to
  TabDragControllerChromium and name ours TabDragController. But this
  made it difficult to find which implementation is actually used.

- In tab_strip.cc patch: use BraveTabDragController for drag_controller_
  to instantiate BraveTabDragController instead of TabDragController.
2026-02-04 15:22:02 -05:00
Brian Johnson fbb94a1138 Add BraveGlobalFeatures subclass for upstream GlobalFeatures (#33555)
Create Brave subclass for GlobalFeatures
See https://chromium.googlesource.com/chromium/src/+/main/docs/chrome_browser_design_principles.md#architecture
2026-02-04 01:39:32 +00:00
Sangwoo Ko ce01d6f0eb Fix memory leak in TabStyle::Get() (#33382)
We should not create a new instance of BraveTabStyle every time
TabStyle::Get() is called.

In order to fix this, we use plaster patch to replace new TabStyle()
with new BraveTabStyle().
2026-01-26 20:01:46 +09: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
Sangwoo Ko 8d0433253d [cr144] Rework vertical tab strip
The core infrastructure for vertical tabs has been removed from upstream
* Split tab - CompoundTabContainer which contains pinned contrainer and
  unpinned container separately is removed.
* Scrollable tab strip support was removed - TabStripScrollContainer was
  removed.

This PR temporarily make Brave buildable and disables vertical tab strip
support

As CompoundTabContainer is gone, rework BraveTabContainer to handle both
pinned and unpinned tabs.

Previously, we had CompoundTabContainer which contains two TabContainers
, one for pinned tabs and the other for unpinned tabs. And TabContainer
for unpinned tabs had a ScrollView to allow scrolling when there are
many unpinned tabs.

But now, as CompoundTabContainer is removed, we need to handle both pinned
and unpinned tabs in BraveTabContainer. Plus, we should support scrolling
feature for unpinned tabs.

But adding scroll view to BraveTabContainer causes various issues as
it manipulates view hierarachy, which upstream code is not aware of.
As a result, it'd require many changes from our side to make it work.

So instead of adding scroll view, we directly handle scrolling logic
inside BraveTabContainer. BraveTabContainer calculates visable area
for unpinned tabs and sets clip rect accordingly. It also handles scroll
events and update unpinned tabs position based on the offset.
2025-12-21 17:13:04 -05:00