Commit Graph
466 Commits
Author SHA1 Message Date
Shisir Basel 9bb7c2d196 Update data-test-id to data-testid (#35317)
modified:   browser/brave_rewards/test/util/rewards_browsertest_context_util.cc
2026-04-13 11:00:39 -04:00
Pavel Beloborodov 0c285e3920 Fixed possible html injection in speedreader. (#34778)
* Using AppendText instead of raw strings manipulation.
2026-03-25 11:39:34 +07:00
Mikhail 6176482289 Remove cppgc persistent to fix memory leak (#33933)
The PR fixes a memory leak for every reload (and for same-origin navigations) by removing unnecessary `cppgc::Persistent`.
2026-02-15 17:28:02 +04:00
Mikhail 367be052ab Fix some eslint js issues (#33856)
The PR fixes eslint issues in *.js files and removes the related rules from the backlist.
2026-02-14 22:10:28 +04:00
cdesouza-chromium 68a84b8637 [IWYU] Dropping several superfluous std inclusions (#32830)
This PR removes several superfluous inclusions for <map>, <vector>,
and <string>. This is a mechanical change.

```
git ls-files components | grep '\.cc$' | xargs grep -l '<vector>$' | \
  xargs grep -L std::vector | \
  xargs ../tools/add_header.py --remove --header '<vector>'

git ls-files components | grep '\.cc$' | xargs grep -l '<string>$' | \
  xargs grep -L std::wstring | xargs grep -L std::string | xargs grep -L std::u16string | xargs grep -L std::npos | \
  xargs ../tools/add_header.py --remove --header '<string>'

git ls-files components | grep '\.cc$' | xargs grep -l '<map>$' | \
  xargs grep -L std::map | xargs grep -L std::multimap | \
  xargs ../tools/add_header.py --remove --header '<map>'
```

Bug: https://github.com/brave/brave-browser/issues/42212
2025-12-16 14:01:06 +00:00
Claudio DeSouza 13a2651e70 [cr143] GURL::*_piece() removed
All the main methods now return a string_piece, which made the `_piece`
functions redundant.

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/566074ac1aee3a91cbec0d2eac3120b7dd71860b

commit 566074ac1aee3a91cbec0d2eac3120b7dd71860b
Author: Charlie Harrison <csharrison@chromium.org>
Date:   Mon Oct 6 19:18:05 2025 -0700

    Remove GURL::*_piece() method

    There are no more users of this deprecated and misnamed API.
    This completes phase 1.5 of crbug.com/448174617.

    Bug: 448174617
    Change-Id: I82918ec4ec10b68729c31cb36487c7cb02ad0b56
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7008912
    Reviewed-by: Daniel Cheng <dcheng@chromium.org>
    Commit-Queue: Daniel Cheng <dcheng@chromium.org>
    Owners-Override: Charlie Harrison <csharrison@chromium.org>
    Owners-Override: Daniel Cheng <dcheng@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1525986}
2025-11-18 11:18:46 -05:00
Claudio DeSouza 51604f40d0 [cr143] Several GURL methods returning string_view
This migration has been effected in upstream, but several places in our
codebase got broken by this transition. This change makes several parts
of our codebase more friendly to passing `string_view`.

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/0e1784e3cf990560b173f40338e582f50aba0e85

commit 0e1784e3cf990560b173f40338e582f50aba0e85
Author: Charlie Harrison <csharrison@chromium.org>
Date:   Fri Oct 3 11:04:26 2025 -0700

    RELAND: Migrate GURL::path() and friends to return string_view

    This relands crrev.com/c/7003625. Missing cases were found by staring
    at the output of `git grep` for the whole codebase.

    Origin description:
    Also migrates some last remaining callers of the std::string APIs.
    This completes phase 1 of crbug.com/448174617.

    Bug: 448174617
    Change-Id: I7f24f81d1fbf129d8b0dd94f4cf948626deab933
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7007010
    Reviewed-by: Daniel Cheng <dcheng@chromium.org>
    Commit-Queue: Charlie Harrison <csharrison@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1524878}
2025-11-18 11:18:41 -05:00
Brian R. Bondy 72cadbd0c6 AIChat build flag and gn var (#31988)
* 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
2025-11-11 11:20:34 -05:00
Gaetano Checinski ade2e98361 detect what affected tests for webpacked projects - adds ts folders as data (#31254)
extends the transpile_web_ui.py to assert that the source roots provided via imports_from are complete.
The purpose of this is to improve the gn analyze functionality to be able to infer which tests need to run based on filechanges alone.
2025-10-28 07:34:11 +00:00
Aleksei Khoroshilov 67b86db746 Enable rustfmt. (#31974) 2025-10-24 16:34:57 +07:00
Brian R. Bondy b82e6c86d9 is_brave_origin_branded should disable various gn variables (#31812)
* Gate VPN on !brave_origin_only_mode

* Gate Tor on !brave_origin_only_mode

* Gate speedreader on !brave_origin_only_mode

* Gate Wayback machine on !brave_origin_only_mode
2025-10-19 18:29:05 -04:00
Brian R. Bondy caea64fda6 Fix enable_speedreader=false build (#31811) 2025-10-17 11:11:12 -04:00
Jay Harris 40dcee8e6f [webpack]: Default output_module=true for new WebUIs (#31700) 2025-10-10 05:36:22 +01:00
Brian Johnson ef02348235 [speedreader] return early in tab helper if the pref is disabled (#31413)
A recent crash https://github.com/brave/brave-browser/issues/49606 happened even when speedreader was disabled. We should return early to minimize the amount of speedreader code that runs when disabled.
2025-10-07 06:34:40 -07:00
Brian Johnson 7989acf16f [Speedreader] Cleanup pref/feature/method naming (#31415)
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.
2025-09-30 08:07:18 -07:00
Brian Johnson 1f27a328c6 [Speedreader] Remove speedreader on android (#31418)
Remove buggy speedreader implementation on android
2025-09-29 11:52:46 +09:00
Brian Johnson ed94a24fea [speedreader] BRAVE_SPEEDREADER content settings default value (#31409)
Change BRAVE_SPEEDREADER default from CONTENT_SETTINGS_DEFAULT to CONTENT_SETTINGS_ASK
2025-09-24 16:45:15 -07:00
sangwoo ko 848f875cd5 [cr141] Refactor SplitView to use BraveContentsContainerView
This commit migrates the SplitView implementation from using individual
views for secondary content management to utilizing the centralized
BraveContentsContainerView. This change eliminates code duplication and
improves maintainability by leveraging existing infrastructure.

**Key Changes:**

** SplitView Architecture Refactoring:**
- Replace direct management of secondary_contents_web_view_,
  secondary_devtools_web_view_, secondary_reader_mode_toolbar_,
  secondary_lens_overlay_view_, and secondary_contents_scrim_view_
- Migrate to using a single BraveContentsContainerView instance that
  encapsulates all secondary content management

** View Hierarchy Simplification:**
- secondary_contents_container_ (raw View) → secondary_contents_container_view_
  (BraveContentsContainerView)
- All secondary view access now goes through the container view's accessors
- Unified layout management through BraveContentsContainerView

**Benefits:**
- Reduces code duplication between primary and secondary content management
- Leverages existing ContentsContainerView infrastructure for DevTools,
  scrim views, lens overlay, and reader mode toolbar
- Simplifies view hierarchy and improves maintainability
- Better separation of concerns with centralized content management
2025-09-22 14:59:52 -04:00
Pavel Beloborodov 644dfbecbf Speedreader GN structure. (#30702)
* Inroduced BUILD.gn for //brave/browser/speedreader.
2025-09-01 20:10:34 +07:00
Jay Harris f4b2fa6f19 [Nala]: Dynamic theming of WebUIs (#30567) 2025-08-28 09:02:34 +12:00
Anthony Tseng 566706bac9 Make sure SkusJSHandler has correct construtor order to prevent incorrect GC info index (#30859)
* Make sure SkusJSHandler has correct construtor order to prevent
incorrect GC info index.
Also cppgc::Persistent to prevent immature freeing from GC

* Adding self-referencing to other gin::Wrappable
2025-08-27 11:20:42 +09:00
Claudio DeSouza d3a7f9ea83 [cr140] Migrate SpeedreaderJSHandler to gin::Wrappable
This class was still using the deprecated version that is set to be
deleted. This change migrates this class to use Oilpan GC for memory
management.

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/61e491610dac67129273aa96549603483c59759f

commit 61e491610dac67129273aa96549603483c59759f
Author: Andreas Haas <ahaas@chromium.org>
Date:   Wed Jul 30 03:35:32 2025 -0700

    [gin] Delete DeprecatedWrappable

    This CL deletes gin::DeprecatedWrappable, and classes and data
    structures related to gin::DeprecatedWrappable. Additionally it removes
    internal fields of JS wrapper objects that were only used by
    gin::DeprecatedWrappable, but are not needed anymore with the new
    gin::Wrappable.

    Bug: 345640553
    Change-Id: Ideb4424048e62fec6c6a7ee5fd60a4635f6ef1e8
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6799157
    Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
    Reviewed-by: Camille Lamy <clamy@chromium.org>
    Commit-Queue: Andreas Haas <ahaas@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1494071}
2025-08-19 19:54:32 +01:00
Claudio DeSouza f51aa8c8bd [cr140] TtsUtterance::SetEventDelegate takes ownership now
This change to the ownership model for the delegate passed into
`SetEventDelegate` requires us to separate the controller from the
delegate, and have them share a weak relationship.

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/50d43c7bcf04f5fac7cdc7ad26732f3d94b5bd43

commit 50d43c7bcf04f5fac7cdc7ad26732f3d94b5bd43
Author: Di Wu <diwux@google.com>
Date:   Sun Jul 27 20:29:49 2025 -0700

    Refactor TtsUtterance to always own its event delegate

    This change refactors the ownership model for UtteranceEventDelegate to
    establish a single, clear model where TtsUtterance always takes
    ownership of its delegate via std::unique_ptr. This simplifies the code,
    addresses code review feedback, and fixes underlying memory management
    issues that caused test failures.

    Problem:

    The previous memory management for UtteranceEventDelegate was fragile.
    Some delegates used a "delete this" pattern, which is error-prone and
    led to memory leaks in browser tests.

    An initial refactoring moved to a std::unique_ptr model but introduced a
    NonOwnedUtteranceEventDelegate wrapper to handle cases where the
    delegate's lifetime was managed externally (e.g., TtsSpeakFunction,
    SettingsWithTtsPreviewHandler). Code reviewers pointed out that this
    wrapper complicated the ownership model and that a single, consistent
    ownership pattern would be preferable.

    Solution:

    This commit fully adopts the single-ownership model and removes the
    NonOwnedUtteranceEventDelegate wrapper.

    1. TtsUtterance always owns its delegate: TtsUtterance::SetEventDelegate
    now exclusively takes a std::unique_ptr<UtteranceEventDelegate>,
    ensuring the delegate is automatically destroyed with the utterance.

    2. Refactored externally-managed delegates: The two cases that
    previously required a non-owned wrapper have been refactored to use
    dedicated, owned delegate classes:

    2.1 TtsSpeakFunction: Now uses a new, private TtsExtensionEventHandler
    class that implements UtteranceEventDelegate. This handler is owned by
    the TtsUtterance and holds the `extension_id` to dispatch events. This
    removes the need for a reference back to the `TtsSpeakFunction`,
    simplifying lifetime management.

    2.2 SettingsWithTtsPreviewHandler: Now uses a new
    TtsPreviewEventDelegate class. This handler is owned by the TtsUtterance
    and holds a base::WeakPtr to the SettingsWithTtsPreviewHandler to safely
    make callbacks.

    3. Simplified delegate cleanup: With the removal of the non-owned
    wrapper, the GetType() virtual method on UtteranceEventDelegate and the
    corresponding logic in TtsControllerImpl are no longer needed and have
    been removed.

    This refactoring makes the TTS delegate ownership model clear,
    consistent, and safe, resolving memory leaks and directly addressing
    code review feedback for a simpler design.

    Bug: b:281717553, b:251732518, 431531726, 432151731
    Test: Run and symbolize the affected two tests with asan and lsan enabled. Then run with MiraclePtr check on the SelectToSpeakTest.FullscreenMagnifierFollowsTextBoundsWhenPrefOn test.
    Change-Id: Ia7524c0a859ee2f7c1f208412215c6e6b1b4e512
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6733896
    Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
    Commit-Queue: Di Wu <diwux@google.com>
    Reviewed-by: Avi Drissman <avi@chromium.org>
    Reviewed-by: Mitsuru Oshima <oshima@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1492580}
2025-08-19 19:54:30 +01:00
Claudio DeSouza b4dd3a37f7 [cr140] gin::Wrappable deprecated
This class is now called `gin::DeprecatedWrappable`. There seems to be
some work to introduce a new class, but for now it is reverted.

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/3c15226886207c98dffc33a20b6a3dfd7df7a21c

commit 3c15226886207c98dffc33a20b6a3dfd7df7a21c
Author: Andreas Haas <ahaas@chromium.org>
Date:   Wed Jul 2 05:57:48 2025 -0700

    [gin] Rename gin::Wrappable to gin::DeprecatedWrappable

    This is the first CL of a sequence of CLs to refactor gin::Wrappable
    such that it is based on cppgc. In a follow-up CL we will re-introduce
    `gin::Wrappable` again, and then port all uses from
    `gin::DeprecatedWrappable` to `gin::Wrappable`.

    BYPASS_LARGE_CHANGE_WARNING

    Bug: 345640553
    Change-Id: Iad028a1cec93aa8ade3b35c8099f8de5081f88fe
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6513641
    Commit-Queue: Andreas Haas <ahaas@chromium.org>
    Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
    Owners-Override: Rick Byers <rbyers@chromium.org>
    Reviewed-by: Rick Byers <rbyers@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1481539}

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

commit f99163fe2d3428680834db3f141a6d83590561f0
Author: Nina Satragno <nsatragno@chromium.org>
Date:   Wed Jul 2 08:36:22 2025 -0700

    Revert "[gin] Introduce gin::Wrappable based on cppgc"

    This reverts commit dfbe3b4a57ddbfbfc74ab261b51db2ed87f754c2.

    Reason for revert: WrappableTest.WrapAndUnwrap failing on Linux
    UBSan tests

    https://ci.chromium.org/ui/p/chromium/builders/ci/Linux%20UBSan%20Tests/7971/overview

    Bug: 345640553
    Original change's description:
    > [gin] Introduce gin::Wrappable based on cppgc
    >
    > This CL implements the new `gin::Wrappable` based on cppgc, and ports
    > the tests in `wrappable_unittest` from `gin::DeprecatedWrappable` to
    > `gin::Wrappable`.
    >
    > The new implementation of `gin::Wrappable` has sightly different
    > semantics than the old one. In the old one it was possible to call
    > `Converter<WrappableSubClass>::FromV8()` with any JSObject, and the
    > JSObject would either get unwrapped if it wrapped an object of type
    > `WrappableSubClass`, or it would return nullptr. The new implementation
    > would either return nullptr or crash in a DCHECK if the JSObject wrapped
    > an object which is not of type `WrappableSubClass`.
    >
    > Bug: 345640553
    > Change-Id: Ia32e2d82f0383afb56382e9fe78fd94677b00fe8
    > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6519611
    > Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
    > Commit-Queue: Andreas Haas <ahaas@chromium.org>
    > Cr-Commit-Position: refs/heads/main@{#1481565}

    Bug: 345640553
    No-Presubmit: true
    No-Tree-Checks: true
    No-Try: true
    Change-Id: I6499b57f278ce600d03e2d3bbeaee1df04ba3512
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6701047
    Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
    Auto-Submit: Nina Satragno <nsatragno@chromium.org>
    Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
    Owners-Override: Nina Satragno <nsatragno@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1481635}
2025-08-19 19:54:18 +01:00
Brian R. Bondy de38c2bc73 Cleanup Speedreader group policy (#30680)
- 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`)
2025-08-18 13:27:37 -04:00
Brian R. BondyandSerg 7240ef2e2e Add top level toggle to enable/disable Speedreader (#30600)
* 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>
2025-08-13 11:14:10 -04:00
Brian Johnson 9b6d5118e4 Components should not use brave_paths.h because it depends on //chrome/common
Components should not use brave_paths.h because it depends on //chrome/common. they should use base::DIR_SRC_TEST_DATA_ROOT instead
2025-08-06 16:59:18 -07:00
cdesouza-chromium 5eb666f034 [CodeHealth] Run gn format on all files (#30448)
This PR is the run of `gn format` on all `gn` files. This is a
mechanical change done with:

```sh
git ls-files -- "*.gn" | xargs gn format
git ls-files -- "*.gni" | xargs gn format
```

This change has been motivated primarily by an improvement to the
formatters privided by `gn` correcting cases of redundant target naming,
i.e cases where `//foo:foo` is used, and should just be `//foo`.

For this particular `gn` change, see:
https://chromium.googlesource.com/chromium/src/+/c822490a82cdb6ad479159683a92858f7c6f0a58

Resolves https://github.com/brave/brave-browser/issues/48161
2025-08-05 18:08:10 +01:00
Brian R. Bondy df908077f0 Add Speedreader admin policy (#30017) 2025-07-16 02:20:43 +02:00
Anton Paymyshev 5f00c94751 Fix implicit deps on components/user_prefs (#29772) 2025-06-27 11:28:47 +07:00
Anton Paymyshev f763b343ab Fix implicit deps on components/keyed_service (#29664) 2025-06-20 21:38:00 +07:00
Anton Paymyshev bcf34bb280 Fix implicit deps on components/sync_preferences (#29626) 2025-06-19 13:26:31 +07:00
Anton Paymyshev a9cbf75ae4 Fix implicit deps on components/grit (#29611) 2025-06-18 14:07:01 +07:00
cdesouza-chromium 3998467be9 [IWYU] Fixing logging inclusions //components (#29511)
This change is one of many fixing inclusion for the following files:

    - `base/notimplemented.h`
    - `base/notreached.h`
    - `base/check.h`
    - `base/dcheck_is_on.h`
    - `base/check_deref.h`
    - `base/check_op.h`
    - `base/logging/log_severity.h`
    - `base/logging.h`

This change is a mechanical change done with the following script:
https://github.com/brave/brave-browser/issues/46707#issuecomment-2960116515

Resolves https://github.com/brave/brave-browser/issues/46707
2025-06-11 16:03:11 +01:00
cdesouza-chromium d05979d19c [iwyu] Fixing inclusions for string_util.h pt.2 (#29378)
Files that use functions from `string_util.h` should include that header
directly instead of relying on transient inclusions.

This is a mechanical change using this script:

```sh
remove_header_if_unused() {
    files=$(git grep -l "base/strings/string_util.h")
    for file in $files; do
        if ! git grep -qE "base::MakeStringPiece|base::MakeWStringView|base::ToLowerASCII|base::ToUpperASCII|base::CompareCaseInsensitiveASCII|base::EqualsCaseInsensitiveASCII|base::EmptyString|base::RemoveChars|base::ReplaceChars|base::TrimPositions|base::TrimString|base::TruncateUTF8ToByteSize|base::TrimWhitespace|base::CollapseWhitespace|base::ContainsOnlyChars|base::IsStringUTF8|base::IsStringASCII|base::EqualsASCII|base::CompareCase|base::StartsWith|base::EndsWith|base::RemovePrefix|base::RemoveSuffix|base::IsAscii|base::IsUnicodeControl|base::IsHexDigit|base::IsUnicodeWhitespace|base::FormatBytesUnlocalized|base::ReplaceFirstSubstringAfterOffset|base::ReplaceSubstringsAfterOffset|base::WriteInto|base::JoinString|base::ReplaceStringPlaceholders|base::MakeStringViewWithNulChars" "$file"; then
            sed -i '/base\/strings\/string_util.h/d' "$file"
            echo "Removed 'base/strings/string_util.h' from $file"
        fi
    done
}

add_header_if_needed() {
    files=$(git grep -lE "base::MakeStringPiece|base::MakeWStringView|base::ToLowerASCII|base::ToUpperASCII|base::CompareCaseInsensitiveASCII|base::EqualsCaseInsensitiveASCII|base::EmptyString|base::RemoveChars|base::ReplaceChars|base::TrimPositions|base::TrimString|base::TruncateUTF8ToByteSize|base::TrimWhitespace|base::CollapseWhitespace|base::ContainsOnlyChars|base::IsStringUTF8|base::IsStringASCII|base::EqualsASCII|base::CompareCase|base::StartsWith|base::EndsWith|base::RemovePrefix|base::RemoveSuffix|base::IsAscii|base::IsUnicodeControl|base::IsHexDigit|base::IsUnicodeWhitespace|base::FormatBytesUnlocalized|base::ReplaceFirstSubstringAfterOffset|base::ReplaceSubstringsAfterOffset|base::WriteInto|base::JoinString|base::ReplaceStringPlaceholders|base::MakeStringViewWithNulChars")
    for file in $files; do
        ../tools/add_header.py --header '"base/strings/string_util.h"' "$file"
    done
}

remove_header_if_unused
add_header_if_needed

```

Resolves https://github.com/brave/brave-browser/issues/46559
2025-06-05 12:15:02 +01:00
cdesouza-chromium 385cbdcd8d [iwyu] Remove superfluous gurl.h inclusions (#29242)
Removing some of this unnecessary inclusions can help with build times.
This is a mechanical change, with the following script:

```sh
remove_header_if_unused() {
    files=$(git grep -l "url/gurl.h")
    for file in $files; do
        if ! git grep -qE "\bGURL\b" "$file"; then
            sed -i '/url\/gurl.h/d' "$file"
            echo "Removed 'url/gurl.h' from $file"
        fi
    done
}

remove_header_if_unused

```
2025-05-27 21:10:52 +01:00
cdesouza-chromium 5042174ae6 Reland "Fix includes for base::StringPrintf" (#29191)
* Fix includes for `base::StringPrintf`

Upstream is doing a couple of IWYU fixes for `base::StringPrintf`, and
this will have an effect on our own uses of this function. This change
corrects all the includes we have.

This is a mechanical change, done with the following script.

```sh

remove_header_if_unused() {
    files=$(git grep -l "base/strings/stringprintf.h")
    for file in $files; do
        if ! git grep -qE "base::StringPrintf|base::StringAppend" "$file"; then
            sed -i '/base\/strings\/stringprintf.h/d' "$file"
            echo "Removed 'base/strings/stringprintf.h' from $file"
        fi
    done
}

add_header_if_needed() {
    files=$(git grep -lE "base::StringPrintf|base::StringAppend")
    for file in $files; do
        ../tools/add_header.py --header '"base/strings/stringprintf.h"' "$file"
    done
}

remove_header_if_unused
add_header_if_needed
```

* IWYU fix for `ostream` operators

This header was being pulled transiently. This caused build failures
once https://github.com/brave/brave-core/pull/29156 was merged.
2025-05-23 15:05:58 +01:00
cdesouza-chromium 0c198d3195 Revert "Fix includes for base::StringPrintf" (#29184)
This reverts commit 26dc9b27d5265d1e2e97ea8f5014a73234bda0fa.
2025-05-22 12:21:36 -07:00
cdesouza-chromium e08d71522a Fix includes for base::StringPrintf (#29156)
Upstream is doing a couple of IWYU fixes for `base::StringPrintf`, and
this will have an effect on our own uses of this function. This change
corrects all the includes we have.

This is a mechanical change, done with the following script.

```sh

remove_header_if_unused() {
    files=$(git grep -l "base/strings/stringprintf.h")
    for file in $files; do
        if ! git grep -qE "base::StringPrintf|base::StringAppend" "$file"; then
            sed -i '/base\/strings\/stringprintf.h/d' "$file"
            echo "Removed 'base/strings/stringprintf.h' from $file"
        fi
    done
}

add_header_if_needed() {
    files=$(git grep -lE "base::StringPrintf|base::StringAppend")
    for file in $files; do
        ../tools/add_header.py --header '"base/strings/stringprintf.h"' "$file"
    done
}

remove_header_if_unused
add_header_if_needed
```
2025-05-22 14:17:08 +01:00
Claudio DeSouza 81087f4eb6 [cr136][rust] Several crates dropped from the main tree
There's no need to patch off the crate `test_only` value anymore as the
crate is now gone from the upstream tree.

Chromium change:
https://chromium.googlesource.com/chromium/src/+/3eac73aa297e57a1d6e17bec25973848d16e91a4

commit 3eac73aa297e57a1d6e17bec25973848d16e91a4
Author: Lukasz Anforowicz <lukasza@chromium.org>
Date:   Mon Mar 24 15:12:42 2025 -0700

    [rust] Remove unneeded, grandparented-in, direct Rust crate deps.

    This CL removes dependencies from
    `third_party/rust/chromium_crates_io/Cargo.toml` that have been
    grand-parented-in in https://crrev.com/c/5019147, but that do not seem
    to have any direct dependencies from Chromium targets.

    The CL has been created by:

    * Manually editing `third_party/rust/chromium_crates_io/Cargo.toml`
      and `third_party/rust/chromium_crates_io/gnrt_config.toml`
    * Running:
        - `tools/crates/run_gnrt.py vendor`
        - `tools/crates/run_gnrt.py gen`

    Bug: 405468274
2025-04-16 09:30:30 +01:00
Claudio DeSouza 2eac5b3989 [cr136] Migrate absl::variant to std::variant
Chromium is now migrating to `std::variant`, and this change does the
same in Brave.

This change was done with a script:

```sh

function delete_line_with {
  echo "Deleting lines with $1"
  git grep -l "$1" \
    | grep -E "\.(h|cc|mm|py)$" \
    | sort \
    | uniq \
    | xargs sed -e "/$(echo "$1" | sed -e 's/[\/&]/\\&/g')/d"
}

function add_header {
  echo "Adding header $1"
  git diff --name-only \
    | xargs ../tools/add_header.py --header "$1"
  git grep -l "std::variant" \
    | xargs ../tools/add_header.py --header "$1"
}

delete_line_with "\"third_party/abseil-cpp/absl/types/variant.h\""
add_header "<variant>"
git cl format
```

Chromium change:
https://chromium.googlesource.com/chromium/src/+/c01ae649582b75bce39769132a5a41bec8e2d3e4

commit c01ae649582b75bce39769132a5a41bec8e2d3e4
Author: Victor Hugo Vianna Silva <victorvianna@google.com>
Date:   Mon Mar 10 19:15:52 2025 -0700

    Make absl::variant a typedef for std::variant

    This is a re-upload of https://crrev.com/c/5469234, see original
    description below. Differences from the original CL:
    - Windows symbol definition files were regenerated with
      generate_def_files.py.
    - New build fixes in password_store_consumer.h,
      plus_address_jit_allocator_unittest.cc and mojo_proxy_test.cc.
    - Revert change in enclave_protocol_utils.cc, it doesn't seem needed
      anymore.

    We estimate that ~75% of the regression shown by the
    android-binary-size bot will recover after PGO profiles are updated.
    See comments 34 to 42 in the linked bug for some numbers.

    Original CL description:
    "
    Discussion thread: https://groups.google.com/u/1/a/chromium.org/g/cxx/c/0EhbuwD-Dpw/m/lbGjN1sxAgAJ

    This commit is an updated/tuned version of
    David Benjamin's patches (5313884, 5314107).
    This only changes the types around. It doesn't rewrite the existing
    uses, which we can do incrementally.
    "

    Binary-Size: See commit description.
    Bug: 40242126
2025-04-16 09:30:24 +01:00
Brian Johnson aae0c4712b bump adblock 0.9.6-brave-core -> 0.9.6 (#28276) 2025-03-24 11:26:29 -07:00
Brian Johnson 7f12f370ce fix rust deps/includes/directories (#28249)
* move rust code inside process directories just like cpp code
2025-03-23 09:39:30 -07:00
Brian Johnson 3bae86bc78 remove last modified date display from speedreader template (#28146) 2025-03-14 20:27:32 +01:00
Darnell Andries c804ef1c45 Add Speedreader metrics 2025-03-13 16:47:57 -07:00
Darnell Andries e17d3036ba Update adblock, kuchikiki, lol_html 2025-02-25 15:57:48 -08:00
Darnell Andries 20ec1ca7d8 Update html5ever/markup5ever for speedreader/kuchikiki 2025-02-25 15:37:44 -08:00
Brian Johnson 0614a2fe8f [CodeHealth][rust] lol_html 0.3.0 => 2.1.0 (#27735) 2025-02-20 05:12:35 -07:00
Emerick Rogul 93bf4fc43d Fix enable_speedreader buildflag to be !is_ios instead of true 2024-12-17 12:52:05 -05:00
Pavel Beloborodov e937963c71 Disable cosmetic filtering on Speedreader pages (#25692)
* Disabled cosmetic filters on speedreader pages.
2024-12-06 11:55:00 +07:00