Commit Graph
385 Commits
Author SHA1 Message Date
Brian R. Bondy fe1a9add88 Add enable_playlist buildflag gated on is_brave_origin_branded (#35732)
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.
2026-04-23 08:23:26 -04:00
Anton Paymyshev ae9c1a1949 Completely remove kNativeBraveWalletFeature (#35261) 2026-04-08 22:09:45 +07:00
Max Karolinskiy fe009849a2 [cr147] Disables upstream features flagged by security/privacy. 2026-03-26 19:55:48 -04:00
Max Karolinskiy 398b132520 [cr147] WillDestroyServiceWorkerContextOnWorkerThread sig changed.
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/39a3c857cf68cd462f911d6f251f05d1996a485e

commit 39a3c857cf68cd462f911d6f251f05d1996a485e
Author: Andrea Orru <andreaorru@chromium.org>
Date:   Wed Mar 4 12:56:29 2026 -0800

    [Extensions] Track service worker lifecycle more precisely

    This change resolves multiple issues with extensions service workers.

    - Adds `RendererState::kInitialized` to `ServiceWorkerState` to track
    when an extension service worker has initialized but has not yet
    finished executing its top-level JavaScript.

    - Previously, `OnStoppingSync` and `OnStoppedSync` calls were discarded
    if they occurred before the worker finished starting. Now,
    `ServiceWorkerTaskQueue::OnWorkerStop` is executed for service workers
    that stopped during their start process, allowing `ProcessManager` to
    successfully clean up stale workers from its tracking set.

    - Plumbs `blink::ServiceWorkerToken` through service worker lifecycle
    IPCs to uniquely identify specific worker instances. This enables
    `ServiceWorkerState` to verify if incoming IPC messages belong to a live
    worker instance via the new `IsLiveServiceWorkerWithToken` method.

    Bug: 40936639
2026-03-26 19:55:36 -04:00
Claudio DeSouza bdc2826eaf [cr147] kPermissionElement deleted and made default
Privacy team says it's a privacy concern any more and is ok with this
feature being enabled.

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/418a56df178e5b23da11a7b87d1fd57ad9807f37

commit 418a56df178e5b23da11a7b87d1fd57ad9807f37
Author: Thomas Nguyen <tungnh@chromium.org>
Date:   Fri Feb 13 14:35:47 2026 -0800

    [PEPC] Remove generic <permission> element

    This CL removes the implementation of the generic <permission> element and the PermissionElement runtime feature. The specific elements <geolocation>, <usermedia>, and <install> are now supported by HTMLCapabilityElementBase and their respective subclasses.

    Bug: 448593977
    Change-Id: I7407b93e80b4ee8f7e21b45d3a8ecd1c83556714
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7404142
    Reviewed-by: Joey Arhar <jarhar@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1584922}
2026-03-26 19:25:00 -04:00
Serg a537c15708 [Android] Implement Origin subscription linking after purchase (#34719)
Add support for linking Brave Origin subscriptions after purchase on
Android, following the same link-order flow used by Leo (AI Chat).

- Add OriginIAPSubscription Mojo interface and C++ implementation to
  read purchase token/order ID from prefs and persist link status
- Handle product=origin in SubscriptionRenderFrameObserver: inject
  braveOrigin.receipt and braveOrigin.orderId into localStorage on
  the initial landing page, and linkResult.setStatus() callback on
  the /order-link/ result page
- Register OriginIAPSubscription Mojo binding in
  BraveContentBrowserClient
- Update LinkSubscriptionUtils to use link-order intent for Origin
- Hide Purchase section in Origin preferences when already linked
- Move subscription_render_frame_observer.h include out of
  ENABLE_BRAVE_VPN guard so it is available for all Android
  subscription products
- Generalize Leo-specific constants (kIntentParamValueLeo,
  kResultLandingPagePathLeo) since they are now shared with Origin
- Add Origin test cases to browser tests

Resolves: https://github.com/brave/brave-browser/issues/53613
2026-03-24 12:59:55 -04:00
Jay Harris 7069730e49 [AI Rewriter]: Remove feature as it is unused and not maintained (#34635) 2026-03-12 03:09:51 +00:00
Christian Mazakas 2a18724d18 [Wallet] add ofac checking for account-based coins (#33537)
Resolves brave/brave-browser#52043

Update each account-based keyring to accept a unary predicate that can be used
to match public account keys against the OFAC sanctions list.
2026-03-10 11:04:56 -07:00
Claudio DeSouza c164d6759c [cr145] IWYU for callback_helpers.h
This change does IWYU additions for all cases where `base::DoNothing` is
used. Furthermore, this change removes some of the uses of
`base::DoNothing` as an argument default value in a header, removing the
need to add `callback_helpers.h` to those headers.

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/e8436cccafc34d6e4d9c060f682345060579d208
https://chromium.googlesource.com/chromium/src/+/227f058d9b9e27370a64b34046d71b9f23106409

commit e8436cccafc34d6e4d9c060f682345060579d208
Author: Lei Zhang <thestig@chromium.org>
Date:   Fri Dec 12 15:16:22 2025 -0800

    Forward declare base::ScopedClosureRunner in some Blink headers

    Avoid including base/functional/callback_helpers.h when not needed. Also
    use base/functional/callback_forward.h since callback_helpers.h was
    providing callback.h. For scrollable_area.h, make this possible by
    getting rid the default arguments to PerformSnapping(),
    SnapAtCurrentPosition(), and SnapForEndPosition(). These methods have
    very few callers, so just pass in all the arguments. Then do IWYU to fix
    the build.

    Change-Id: I5cfd017bd6f392b0d97e99c41d4885fac7140a4c
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7254408
    Commit-Queue: Philip Rogers <pdr@chromium.org>
    Auto-Submit: Lei Zhang <thestig@chromium.org>
    Reviewed-by: Philip Rogers <pdr@chromium.org>
    Reviewed-by: Christoph Schwering <schwering@google.com>
    Reviewed-by: Robert Flack <flackr@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1558318}

commit 227f058d9b9e27370a64b34046d71b9f23106409
Author: Lei Zhang <thestig@chromium.org>
Date:   Thu Dec 11 21:30:12 2025 -0800

    Do IWYU for callback_helpers.h in async_dom_storage_database.cc

    Add callback_helpers.h for base::DoNothing() usage. The transitive
    include that makes this work as-is will be deleted in the near future.

    Change-Id: Id5ba6db705434734a854874923b7bb196392ca6c
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7253640
    Commit-Queue: Mingyu Lei <leimy@chromium.org>
    Auto-Submit: Lei Zhang <thestig@chromium.org>
    Reviewed-by: Mingyu Lei <leimy@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1557849}
2026-01-29 13:40:34 -05:00
Claudio DeSouza 388c2c36c4 [cr145] Redundant GetTabCount() deleted
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/e73feeeeaf41f84dc4a78336d2d10079e3b31919

commit e73feeeeaf41f84dc4a78336d2d10079e3b31919
Author: Kunal Daftari <kunaldaftari@google.com>
Date:   Fri Dec 5 11:05:38 2025 -0800

    Remove GetTabCount()

    Removing duplicate function. Can use count() instead.

    Bug: 417291958
    Change-Id: I46b72cc18d9a7f6ea99613b447f1952ee6a5b68f
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7229515
    Reviewed-by: Darryl James <dljames@chromium.org>
    Reviewed-by: David Pennington <dpenning@chromium.org>
    Commit-Queue: Kunal Daftari <kunaldaftari@google.com>
    Cr-Commit-Position: refs/heads/main@{#1554797}
2026-01-29 13:40:22 -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
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
Brian R. Bondy 5c186f889d Forward Brave Origin env to gn and build fixups (#32069)
* Forward Brave Origin env to gn

* Fix test should not run when no speedreader

* Fix Android build deps for Brave Origin
2025-10-31 14:49:38 -04:00
Kyle Hickinson 0fea2d5f95 [CodeHealth] Remove enable_playlist gn arg (#31715)
This arg was now always true so there is no need for it anymore
2025-10-25 13:17:37 -04:00
Anton Paymyshev 6c791c35e0 Fixed flaky JSEthereumProviderBrowserTest.AttachOnReload 2025-10-15 20:31:29 -04:00
Kyle Hickinson b049fa48f7 [Playlist] Convert to a layered component (#31639)
- 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`
2025-10-06 19:14:46 +01: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
Claudio DeSouza a4d2a1b56e [cr141] Use process_state::IsIncognitoProcess
This function used to be in the global namespace.

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/7ce73baa09400dc405a9cf925bbce1908457387e

commit 7ce73baa09400dc405a9cf925bbce1908457387e
Author: Wangsong Jin <wangsongjin@microsoft.com>
Date:   Thu Aug 14 10:02:58 2025 -0700

    Improve third-party NTPs creation performance by using spare renderer

    The current implementation of the third-party NTPs in the browser does
    not make use of the spare renderer. As a result, third-party search
    engine NTPs that depend on the current architecture experience delays
    because they have to create a new process rather than reusing an
    existing spare renderer.

    This change primarily updates three parts. First, we have to late-bind
    the instant process flag. Currently, the flag is passed as a
    command-line switch when the process is created, which prevents spare
    renderers from attaching the instant process flag as spare renderers
    doesn't know if it's instant process at that moment. To address this
    issue, we introduce a new method, SetConfigurationOnProcessLockUpdate(),
    in the existing RendererConfiguration mojom interface. This method is
    called in NotifyRendererOfLockedStateUpdate() to late bind the instant
    process flag when process lock is updated. Additionally, we reuse
    process_state.cc to store and expose the instant process setting.

    The 2nd part of the change aims to enable the instant process to utilize
    the spare renderer. We introduced a feature flag,
    kInstantUsesSpareRenderer, to serve as the experimental control flag.
    Additionally, we updated ChromeContentBrowserClient::IsSuitableHost() to
    bypass the check if the spare renderer is taken by the instant process.
    We made this change because InstantService::AddInstantProcess is called
    after RenderProcessHostImpl::MayReuseAndIsSuitable() check in
    RenderProcessHostImpl::GetProcessHostForSiteInstance(), which could hit
    the "Unsuitable process reused for site" NOTREACHED.

    The third part is to ensure that the renderer security settings are
    passed to the process in time, before the renderer thread is created.
    However, the order of mojo calls is not guaranteed on non-associated
    interfaces in service worker cases. Therefore, we add
    WaitForProcessReady() to make the service worker creation thread wait
    until the renderer configuration (instant flag) and other
    security-related settings are set before attempting to create the
    worker.

    Bug: 398159675
    Change-Id: Ib7c3a7ca1bedae9174cd415e313ef43cfaf06b7a
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6373046
    Commit-Queue: Wangsong Jin <wangsongjin@microsoft.com>
    Reviewed-by: Marc Treib <treib@chromium.org>
    Reviewed-by: Shunya Shishido <sisidovski@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1501448}
2025-09-22 14:59:41 -04:00
Emerick Rogul f69efeb8d7 Disable kPermissionElement feature flag (#30938) 2025-09-03 15:33:07 -04:00
Brian R. Bondy dbab29c929 Fix intermittent failure JsSkusBrowserTest.AttachSkus (#30791)
Fix for the render frame observer which is created on the stack in the
test file, but its `OnDestruct` calls `delete this;`

https://github.com/brave/brave-core/commit/9d896aaa5d0b0873434bee37a92f89e78e8661fe#diff-9b6f35d6bb55585416f5c5b7f[…]531e094f6039534e46870f267e84R68
Added the `delete this;`

And then a later commit added the test which created it on the stack:
https://github.com/brave/brave-core/commit/0a03ac5defcc619296085cdd8e4654521efe6ec5#diff-10e48a4b1e39427a1c98f8882[…]4d712ff32b2affd45df70ee319e2R35

i
2025-08-25 14:14:52 -04:00
Claudio DeSouza 323469a7f5 [cr140] EvalJsResult::error private
This field has been made private and matchers have been provided to
support the cases where the check if for the error condition.

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

commit c28317921afe79d71fdc07444288b8d07b990aea
Author: Chris Fredrickson <cfredric@chromium.org>
Date:   Sun Jul 27 14:18:43 2025 -0700

    Make EvalJsResult::error private

    Making this field private will allow us to more easily change its name,
    and/or change the internal representation of the class (e.g. use a
    std::variant instead of holding *both* the success and error values),
    and define move ctor/assignment ops without allowing callers to violate
    the invariants of the class.

    Bug: 431787497
    Change-Id: I91d856c6df9442e896a21268eee80a455e755063
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6788313
    Reviewed-by: Avi Drissman <avi@chromium.org>
    Auto-Submit: Chris Fredrickson <cfredric@chromium.org>
    Commit-Queue: Chris Fredrickson <cfredric@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1492549}
2025-08-19 19:54:30 +01:00
Claudio DeSouza 588979f50c [cr140] EvalJsResult interface dropped value()
This type's interface has been further simplified, and it does not offer
a separate value member anymore. This change corrects many places in our
codebase where this had to be corrected.

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/94e8c33dee33477ef4c13a2573d0c32d727be1e8

commit 94e8c33dee33477ef4c13a2573d0c32d727be1e8
Author: Chris Fredrickson <cfredric@chromium.org>
Date:   Mon Jul 14 18:57:33 2025 -0700

    Convert EvalJsResult to class and make value_ private

    This makes it harder to accidentally use EvalJsResult incorrectly (e.g.
    accessing `value` without checking for errors first). It also allows
    EvalJsResult to enforce its invariant (that `value.is_none()` if
    `!error.empty()`) without requiring `value` to be const.

    Change-Id: Idc90f48e3f2d4880e82023b48c42e3f3b9794f7c
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6732142
    Commit-Queue: Chris Fredrickson <cfredric@chromium.org>
    Reviewed-by: Xiaoqian Dai <xdai@chromium.org>
    Auto-Submit: Chris Fredrickson <cfredric@chromium.org>
    Reviewed-by: Avi Drissman <avi@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1486687}
2025-08-19 19:54:24 +01:00
cdesouza-chromium 468ce215b7 [CodeHealth] IWYU for absl::StrFormat (#30441)
This PR runs a mechanical change to do IWYU on all files using the new
abseil functions, while also removing the old header inclusions for
`base::StringPrintf`.

A presubmit `BanRule` is also being added for the `base::` functions.

Resolves https://github.com/brave/brave-browser/issues/48143
2025-08-05 18:20:12 +01: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
cdesouza-chromium c100289833 [CodeHealth] Remove uses of base::StringPrintf pt.4 (#30395)
This PR has additional replacements for base::StringPrintf with the
underlying abseil implementation absl::StrFormat.

This is mostly a mechanical change.

Resolves https://github.com/brave/brave-browser/issues/48076
2025-08-01 12:06:49 +01:00
cypt4 6381e7d43e [Cardano] Add Cardano dApp setting (#30004)
* [Cardano] Add Cardano dApp setting
Resolves https://github.com/brave/brave-browser/issues/46374
2025-07-18 20:32:13 +07:00
cdesouza-chromium 34c2028c47 [IWYU] Fix includes for utf conversion functions (#29709)
This PR does IWYU for the following files:

 - base/strings/utf_string_conversions.h
 - base/i18n/number_formatting.h

This is a mechanical change, and for more details, check the issue
description.

Resolves https://github.com/brave/brave-browser/issues/47060
2025-06-23 22:44:37 +01:00
cypt4 3169c61e13 [Cardano] Add window.cardano.brave js object (#29255)
* [Cardano] Add window.cardano.brave js object
Resolves https://github.com/brave/brave-core/pull/29101
2025-06-16 19:11:17 +07:00
cdesouza-chromium 821274796b [IWYU] Fixing logging inclusions pt.11 (#29531)
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-12 13:48:07 +01:00
cdesouza-chromium c3899b612c [CodeHealth] Avoid inefficient std::string(other_string.c_str()) (#29386)
This PR fixes a few places where the use of `c_str()` is not required,
and in fact leads to an extra `strlen`-like call.

Resolves https://github.com/brave/brave-browser/issues/46570
2025-06-04 19:53:44 +01:00
cdesouza-chromium 8df5afaa2f [iwyu] Fixing inclusions for string_util.h pt.1 (#29376)
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-04 16:15:27 +01:00
Brian R. Bondy 1174a90b46 Remove Ethereum Remote Client (Crypto Wallets) (#29135)
There was a flag from long ago that allowed you to select Crypto Wallets as your wallet. However if you did this, it no longer works.  There is no one that can feasibly still be using this wallet because it hasn't worked for many versions

Addressed review comments

Remove references to 21070F3D60711361C1210B870439BE49B5D995F4
21070F3D60711361C1210B870439BE49B5D995F4 is for Ethereum Remote Client which is removed

Remove unused ReinstallAsNonComponent

Remove unused comment IsInstallationExplicitlyAllowed

Remove _permission_features.json because it's an override that only
exists because of CW extension.

Remove unused string braveWalletImportFromLegacy

Use constexpr for kMetamaskExtensionId

Remove need subscription to kDefaultEthereumWallet and OnWalletTypeChanged handler

Remove DISABLED_ImportLegacyWallet

Add Migration for people with CryptoWallets pref

Deprecate and keep CryptoWallets prefs

1
2025-05-23 16:56:41 -04:00
Claudio DeSouza 7d1b69f961 [cr137] AddExtension now through ExtensionRegistrar
This is one of many changes moving methods to the registrar.

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/69d2b7fcffcda024f1c4f22a79c6dab0ff2107ef

commit 69d2b7fcffcda024f1c4f22a79c6dab0ff2107ef
Author: David Bertoni <dbertoni@chromium.org>
Date:   Thu Apr 24 02:12:34 2025 -0700

    [Extensions] Remove ExtensionsService::AddExtension.

    This is part of the ExtensionService break up effort.

    This member function is just a call to ExtensionRegistrar::AddExtension,
    so no behavioral change is expected.

    Bug: 405411622
    Change-Id: If758d6adf49af2045bf333ded7635752345b4cd9
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6476246
    Reviewed-by: Hidehiko Abe <hidehiko@chromium.org>
    Commit-Queue: Hidehiko Abe <hidehiko@chromium.org>
    Auto-Submit: David Bertoni <dbertoni@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1451012}
2025-05-13 15:53:20 -04:00
Max Karolinskiy 4408e257f6 [cr137] Adjust skus browser test.
Removed Reload from the test because it no longer works correctly after
the below upstream change. Chromium team might fix the Reload
functionality at a later time. See
https://chromium-review.googlesource.com/c/chromium/src/+/6406554/comments/4e04615d_9a21db9d

Chromium change:

https://source.chromium.org/chromium/chromium/src/+/ae845bfbaace3a356b66de078d6d70c84192c7f7

commit ae845bfbaace3a356b66de078d6d70c84192c7f7
Author: Diana Qu <xiaqu@microsoft.com>
Date:   Thu Apr 3 13:12:37 2025 -0700

    Remove "UseBrowserCalculatedOrigin" feature flag.

    Remove released feature flag. Always set commit origin.

    Bug: 402272788
2025-05-13 15:53:11 -04:00
cdesouza-chromium b55418f7a3 Deleting all base::ranges uses (#27446)
All range implementations are now deleted in chromium and the std
implementation is to be used in its place.

This is a mechanical change.

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

function remove_header {
  echo "Removing header $1"
  git diff --name-only \
    | xargs ../tools/add_header.py --header "$1" --remove
  git grep -l "$1" \
    | xargs ../tools/add_header.py --header "$1" --remove
}
```

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

commit 3b811ffd3cef9d11cda6812ac4d22dcfdbad7d0f
Author: Peter Kasting <pkasting@chromium.org>
Date:   Wed Jan 29 14:20:16 2025 -0800

    Remove base/ranges/.

    Bug: 386918226

Resolves https://github.com/brave/brave-browser/issues/43664
2025-02-01 16:05:11 +00:00
cdesouza-chromium bafe60e75f Migrate std::range migration breakages - Pt.1 (#27384)
Upstream has abandoned its in-house implementation of `base::ranges`,
and all cases now merely alias back to the upstream implementation. This
has caused some build failures, as in certain cases the implementation
in `base` didn't quite match what was being done in `std`.

Chromium change:
https://chromium.googlesource.com/chromium/src/+/7be06d9af3db3b022636d5f597353d9d89207427

commit 7be06d9af3db3b022636d5f597353d9d89207427
Author: Peter Kasting <pkasting@chromium.org>
Date:   Thu Jan 23 12:33:52 2025 -0800

    Make base::ranges equivalent to std::ranges.

    This prevents backsliding while rewriting the codebase to explicitly
    spell the latter.

    Bug: 386918226

Resolves https://github.com/brave/brave-browser/issues/43566
2025-01-31 17:01:11 +00:00
Max Karolinskiy 4fb13f2b37 [cr133 follow up] Fixes partial disabing of kPrivateStateTokens.
In cr133 the kPrivateStateTokens/kFledgePst deleted flags were deleted
so we added an override RenderFrameHostImpl::BindTrustTokenQueryAnswerer
to just error out.

What was missing is also disabling the runtime feature in blink.

cr133 change:
https://github.com/brave/brave-core/pull/26537/commits/a951a2a69218c3e666de26f8319769ef3e6b68bb

Chromium change:
https://chromium.googlesource.com/chromium/src/+/943e6a6cd3187bcaf2d487135c12e484765d1436

commit 943e6a6cd3187bcaf2d487135c12e484765d1436
Author: Muyao Xu <muyaoxu@google.com>
Date:   Mon Dec 16 18:51:32 2024 -0800

    [Code Health]Remove Feature::kPrivateStateTokens and Feature::kFledgePst

    Both features has been enabled by default since M117.

    Change-Id: I446e2faaf938ba878d668bfbdc0aaafdb12d5369
    Bug: 356624913
2025-01-31 09:27:38 -05:00
Darnell Andries 71bda54430 Add Web Discovery content scraper, payload generator and privacy guard 2025-01-27 18:36:15 -08:00
Brian Johnson afd4e0239d fix overly permissive DEPS (#27193)
Fix overly permissive deps
2025-01-12 21:43:04 -07:00
Jay Harris 9d3cf801ea [Overrides]: Move interface registration to brave_content_renderer_client (#26929) 2024-12-10 03:37:58 +01:00
Anton Paymyshev e4de839e68 Fix NOTREACHED_IN_MIGRATION for wallet (#26380) 2024-11-15 11:57:30 +07:00
Jocelyn Liu efcb1df7c6 Remove enable_ai_chat buildflag 2024-10-31 20:15:18 -07:00
cdesouza-chromium 4e7fcd376f [CodeHealth] Use std::string::[starts|ends]_with (#26306)
For cases where the comparison is case sensitive, we should use the
methods provided by the common std string types provided since cxx20.
2024-10-31 13:44:30 +00:00
Claudio DeSouza 0af60d06f6 chrome:: removed from process_state.h
Chromium change:
https://chromium.googlesource.com/chromium/src/+/60d3dc8a6a9edf2caca8f2a98180cc1b0ef424b4

commit 60d3dc8a6a9edf2caca8f2a98180cc1b0ef424b4
Author: Hyungwook Lee <hyungwook.lee@navercorp.com>
Date:   Thu Sep 26 12:05:12 2024 +0000

    Remove some chrome:: namespace from chrome/renderer/process_state.*

    Bug: 41050580
2024-10-24 12:14:29 +01:00
Brian Johnson 3313ad628b remove include rules that no longer apply (#25911)
remove include rules that no longer apply and fix existing include rules
2024-10-10 16:19:48 -07:00
cdesouza-chromium e1f8a28431 [CodeHealth] Use constexpr strings (#25810)
Use `constexpr` strings

This PR changes moves away from uses of `const char` with two
approaches. For `.cc` files, these types are turned into constexpr ones,
which gives the compiler more leeway for optimisations.

For the constants on header files, we are converting these instances to
`inline constexpr`, in order to also reduce string duplication across
the binary.

This change was generated with a tool.
2024-10-04 10:01:05 -07:00
Claudio DeSouza e407adfbfe Use chrome::IsIncognitoProcess()
`ChromeRenderThreadObserver` doesn't have `is_incognito_process()`
anymore, and the state should be returned from
`chrome::IsIncognitoProcess()`.

Chromium change:
https://chromium.googlesource.com/chromium/src/+/22e259a86b120391897efb3034d2b7a508ff608b

commit 22e259a86b120391897efb3034d2b7a508ff608b
Author: Devlin Cronin <rdevlin.cronin@chromium.org>
Date:   Thu Aug 29 00:46:11 2024 +0000

    Add a separate "process_state" file and target in //chrome/renderer

    Currently, whether a process is incognito is stored on the
    ChromeRenderThreadObserver. This is not ideal since,
    1) It has nothing to do with observing the render thread, and
    2) Anything that needs to check whether a process is incognito then
       needs to depend on ChromeRenderThreadObserver, which can make
       cyclical dependencies when trying to extract out pieces from
       the monolithic //chrome/renderer BUILD file.

    Fix this by pulling the tracking for is_incognito_process into a new
    file, process_state.h, which is in its own source set,
    //chrome/renderer:process_state.

    This CL should have no effective behavior change.

    Bug: None
2024-10-03 17:06:21 +01:00
Brian Johnson 3b60bf0154 remove check_includes = false for brave/browser/profiles (#24737)
Remove check_includes = false from brave/browser/profiles
2024-09-24 08:23:18 -07:00
mkarolin 5654b8f426 Fixes blink configuration warnings due to disabled features. 2024-09-18 17:54:45 -04:00