[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
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/62be9fed82911e8e37c4ef6a926590203fef434a
commit 62be9fed82911e8e37c4ef6a926590203fef434a
Author: Antonio Sartori <antoniosartori@chromium.org>
Date: Thu Jan 22 04:53:38 2026 -0800
Reland "[permissions] Plumb PromptOptions through PermissionRequestManager"
This is a reland of commit 7688ee13bc24db46228f4873ecb27f0e9263a315. The cause of the failing test was actually tangential to this CL and is resolved by https://crrev.com/c/7484754.
Original change's description:
> [permissions] Plumb PromptOptions through PermissionRequestManager
>
> This is the last of a series of CLs that remove PromptOptions from
> PermissionRequest and instead plumb it through the code, see
> https://crbug.com/450752868 for more context.
>
> This CL removes prompt_options from the PermissionRequest and instead
> modifies the various methods Accept, AcceptThisTime, Deny, Dismiss and
> Ignore of PermissionRequestManager to get a PromptOptions parameter.
>
> Bug: 450752868, 469397053
> Change-Id: I145fa50b69596c744be4751d1b8d441573db0379
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7415427
> Reviewed-by: Andy Paicu <andypaicu@chromium.org>
> Reviewed-by: Marc Treib <treib@chromium.org>
> Commit-Queue: Antonio Sartori <antoniosartori@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1570263}
Bug: 450752868, 469397053
Change-Id: Ibf876e0dbc2cda765b9ed8237faff441874ce360
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7486896
Reviewed-by: Andy Paicu <andypaicu@chromium.org>
Commit-Queue: Antonio Sartori <antoniosartori@chromium.org>
Reviewed-by: Marc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1572912}
All callers have been corrected to reflect the use of the new interface.
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/adc93e0df02c18e1b312fc66be183f417f5d4e5f
commit adc93e0df02c18e1b312fc66be183f417f5d4e5f
Author: Antonio Sartori <antoniosartori@chromium.org>
Date: Thu Jan 15 01:45:34 2026 -0800
[permissions] Explicitly pass PromptOptions to NotifyPermissionSet
This is the first of a series of CLs that refactors the code to
explicitly pass PromptOptions as function argument through the code
instead of relying on it being attached to the PermissionRequest. This
CL in particular adds the PromptOptions parameter to
PermissionContextBase::NotifyPermissionSet and adapts all its call
sites.
See https://crbug.com/450752868 for context.
Change-Id: I852f93d1ca7bc050e0e4fc6a7390d6c7fbfdd942
Bug: 450752868
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7274677
Reviewed-by: Andy Paicu <andypaicu@chromium.org>
Commit-Queue: Antonio Sartori <antoniosartori@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1569596}
* [CodeHealth] Refactor permissions origin
1) Pass origin to dApp on construction instead of
resolving it from delegate.
2) Pass origin to iOS panel ui from the core side.
These classes were hoisted and renamed. This has been replaced in
Chromium as well. This is a mechanical change for Brave, done with the
following script.
```
git grep -lw 'Value::List' | xargs sed -i 's/\bValue::List\b/ListValue/g'
git grep -lw 'Value::Dict' | xargs sed -i 's/\bValue::Dict\b/DictValue/g'
git cl format
```
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/6bc468d481835992696083e99e556516fb7f5f80
```
commit 6bc468d481835992696083e99e556516fb7f5f80
Author: Avi Drissman <avi@chromium.org>
Date: Thu Jan 29 22:14:50 2026 -0800
Remove aliases for base::DictValue and base::ListValue
This removes a few last stragglers as well.
Fixed: 478100525
Cq-Include-Trybots: luci.chromium.try:win-official,mac-official,linux-official,android-official,android-desktop-x64-official
Change-Id: If92142b8ab0562a82c609b71c6b2a7665cea6ec6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7513889
Auto-Submit: Avi Drissman <avi@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1577038}
```
Issue: https://github.com/brave/brave-browser/issues/52435
[CodeHealth][cr146] `base::Contains` dissallowed when `.contains` suffices it
This is being enforced by the compiler through a concept, and it only
applies for cases where `base::Contains` is used without a projection.
This change also carries out IWYU for `base::Contains`.
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/4a17af8403373b7f7e7546ef61f30dfbe883d617
```
commit 4a17af8403373b7f7e7546ef61f30dfbe883d617
Author: Victor Hugo Vianna Silva <victorvianna@google.com>
Date: Tue Jan 13 07:30:34 2026 -0800
Disallow base::Contains() when contains() or find() methods available
This is a temporary step towards deleting base::Contains().
Trying to call base::Contains(foo, bar) will now cause a static
assertion failure if foo has contains() or find() methods. This
effectively makes base::Contains() an alias to std::ranges::contains().
The result is we can replace instances of 'base::Contains' with
'std::ranges::contains' in upcoming CLs while being sure to not
regress performance.
Bug: 470391351
Change-Id: I8778f435ff8f5b52fb3bf336724f2dfef388907a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7415207
Commit-Queue: Francois Pierre Doray <fdoray@chromium.org>
Reviewed-by: Francois Pierre Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1568392}
```
Bug: https://github.com/brave/brave-browser/issues/42557
* Add enable_brave_wallet GN variable and build flag
This adds a new GN build flag 'enable_brave_wallet' that can be set to
false to exclude Brave Wallet from the build. The flag is true by default
to maintain current behavior.
Changes include:
- Add enable_brave_wallet declare_args in build/config/BUILDCONFIG.gn
- Create brave_wallet/common/buildflags with ENABLE_BRAVE_WALLET flag
- Update all BUILD.gn and sources.gni files to use the new flag
- Add wallet buildflags dependencies via minimal one-line imports
* Add patches for wallet buildflags in Chromium BUILD files
Adds minimal one-line patches to import wallet buildflags dependencies
in Chromium source files. This allows Chromium code to conditionally
depend on wallet headers.
Patches:
- chrome/browser/ui/hid/BUILD.gn
- net/BUILD.gn
- third_party/blink/common/BUILD.gn
- third_party/blink/public/common/BUILD.gn
- third_party/blink/renderer/modules/permissions/BUILD.gn
* Guard wallet code in Chromium source overrides
Updates chromium_src overrides to conditionally compile wallet-related
code based on enable_brave_wallet flag. This includes:
- Adding DEPS files to allow buildflags dependencies
- Guarding wallet permission handling with #if BUILDFLAG(ENABLE_BRAVE_WALLET)
- Keeping wallet permission enum values unconditionally to maintain profile
interchangeability between wallet-enabled and wallet-disabled builds
- Updating component registration and preference handling
Key changes:
- Permission enums remain stable across build configs for UMA and persistence
- Wallet permission handling code only compiled when wallet enabled
- DEPS files updated to allow buildflags includes
* Guard wallet UI code in front-end TypeScript and Mojom
Conditionally compiles wallet-related UI code in TypeScript and Mojom
interfaces based on enable_brave_wallet preprocessor flag.
Changes:
- Settings menu: Use lastInserted pattern for menu item ordering
- Page visibility: Guard wallet page visibility checks
- Browser commands: Guard wallet command handling
- Routes: Conditionally include wallet routes
- Add non-null assertions for DOM insertions in TypeScript
- Update Mojom interfaces to conditionally include wallet enums
Front-end code uses <if expr="enable_brave_wallet"> preprocessor
directives to exclude wallet UI when the feature is disabled.
* Guard wallet usage in non-wallet Brave code
Conditionally compiles wallet-related code in non-wallet Brave files
based on enable_brave_wallet build flag.
Changes include:
- browser/: Guard wallet service factories, preferences, and helpers
- components/: Guard wallet dependencies in rewards, sidebar, and DNS
- renderer/: Conditionally register wallet content settings
- utility/: Guard wallet component registration
- ios/: Add optional chaining for wallet feature flags
- test/: Guard wallet-related test code
Key files:
- brave_stats_updater.cc: Guard wallet pref registration with #if
- brave_profile_prefs.cc: Conditionally register wallet preferences
- sidebar_service.cc: Guard wallet panel items
- iOS WalletConstants.swift: Use optional chaining for feature checks
This allows building Brave without wallet while maintaining profile
compatibility between wallet-enabled and wallet-disabled builds.
* Add static_assert for ENABLE_BRAVE_WALLET in wallet headers
Adds compile-time assertions to wallet headers to ensure they are only
included when wallet is enabled. This prevents accidental usage of wallet
APIs when enable_brave_wallet=false.
Added static_assert(BUILDFLAG(ENABLE_BRAVE_WALLET)) to:
browser/brave_wallet/ (11 files):
- asset_ratio_service_factory.h
- brave_wallet_context_utils.h
- brave_wallet_ipfs_service_factory.h
- brave_wallet_provider_delegate_impl.h
- brave_wallet_service_factory.h
- brave_wallet_tab_helper.h
- meld_integration_service_factory.h
- wallet_notification_service_factory.h
- simulation_service_factory.h
- swap_service_factory.h
- wallet_data_files_installer_delegate_impl.h
components/brave_wallet/browser/ (15 files):
- brave_wallet_p3a_private.h
- brave_wallet_prefs.h
- brave_wallet_service.h
- brave_wallet_utils.h
- ens_resolver_task.h
- json_rpc_service_test_utils.h
- json_rpc_service.h
- keyring_service_observer_base.h
- keyring_service.h
- network_manager.h
- permission_utils.h
- pref_names.h
- test_utils.h
- tx_service.h
- wallet_data_files_installer.h
components/brave_wallet/common/ (6 files):
- brave_wallet_types.h
- common_utils.h
- eth_abi_utils.h
- features.h
- hex_utils.h
- pref_names.h
Also includes minor wallet code updates to use buildflags and
guard zcash-specific test code.
* Follow up fixes after Parts 1-7
This 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}
This value is now deduced by engaging `embedded_permission_request_descriptor`.
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/85e1a085fd59c62f80eeb3dccf70073d95325dcb
commit 85e1a085fd59c62f80eeb3dccf70073d95325dcb
Author: Thomas Nguyen <tungnh@chromium.org>
Date: Thu Sep 11 06:41:03 2025 -0700
[PEPC] Support permission request from geolocation element
This CL enhances the embedded permission request pipeline by providing
more detailed information from the renderer to the browser. We also
added a new structure to encapsulate data specific to requests
originating from embedded elements, such as <geolocation>.
This allows the permission model to gain more context and
differentiate requests from permission, geolocation or future dedicated elements.
Bug: 442362774, 442759380
Change-Id: I4730b46fa3ea5416b53f16684ec531a45e4c4343
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6909529
Commit-Queue: Ravjit Uppal <ravjit@chromium.org>
Reviewed-by: Ravjit Uppal <ravjit@chromium.org>
Reviewed-by: Joey Arhar <jarhar@chromium.org>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1514238}
A few functions are now renamed for this type, and some of them now
return `content::PermissionResult`.
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/342191c07aadd1a8fb9833414c4c9a53ac810bea
commit 342191c07aadd1a8fb9833414c4c9a53ac810bea
Author: Florian Jacky <fjacky@google.com>
Date: Wed Sep 10 07:32:47 2025 -0700
[PermissionOptions] Multi-state permission subscriptions & setting changes
With permissions with options, a subscription will no longer be uniquely defined by a permission type, since a permission option change may or may not impact a status change description (as the status depends on the request). Additionally, permission implementations may need to be notified about permission setting changes that do not affect the permission status. This CL refactors the infrastructure to enable subscribing to PermissionResult changes instead of simply permission status changes. PermissionResults contain the PermissionStatus, a PermissionStatusSource, and an optional PermissionSetting, hence this refactoring not only enables permission implementations to handle PermissionSetting changes that may not be part of the web-facing API, but also avoids them having to query the PermissionSetting after a change notification.
Change-Id: I4e048730417d58e046da0ed2bb920268db155518
Bug: 408965890
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6899206
Reviewed-by: Nate Fischer <ntfschr@chromium.org>
Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Christian Dullweber <dullweber@chromium.org>
Reviewed-by: Elias Klim <elklm@chromium.org>
Commit-Queue: Florian Jacky <fjacky@chromium.org>
Reviewed-by: Shawn Quereshi <shawnq@google.com>
Reviewed-by: Camille Lamy <clamy@chromium.org>
Reviewed-by: Zijie He <zijiehe@google.com>
Cr-Commit-Position: refs/heads/main@{#1513690}
This new type has a field for the `status` value. This change plubms
this type to several places where it is supposed to be used.
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/16f277ba00702c1ce679ccf94291ce51f1a7ab6a
commit 16f277ba00702c1ce679ccf94291ce51f1a7ab6a
Author: Florian Jacky <fjacky@google.com>
Date: Thu Aug 14 12:03:23 2025 -0700
[PermissionOptions] Return PermissionResult in callback for requests
This CL changes the callback type for permission requests to take a PermissionResult instead of a PermissionStatus. PermissionResults contain the PermissionStatus and can optionally contain the stored PermissionSetting, which is something that will need to be accessed by permissions with options, if they want to support permission downgrades (e.g. to detect that only coarse location was granted for a precise location request).
To create a PermissionResult we use the PermissionStatus and set the PermissionStatusSource to UNSPECIFIED. Since the retrieved_permission_data member is an optional, we don't need to set it across the codebase. By default the permission context sets this member when permissions are set, which executes the permission request callback with this information (see PermissionContextBase::NotifyPermissionSet).
Bug: 436773343
Change-Id: Iaf4dfa2f1532db17a069eb6db032350f2a0d2019
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6818254
Reviewed-by: Peter Conn <peconn@chromium.org>
Reviewed-by: Ravjit Uppal <ravjit@chromium.org>
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: David Dorwin <ddorwin@chromium.org>
Commit-Queue: Florian Jacky <fjacky@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1501523}
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
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
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
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/d02023df812170e1e2c00f5a95006fcc40ec1e55
commit d02023df812170e1e2c00f5a95006fcc40ec1e55
Author: Florian Jacky <fjacky@google.com>
Date: Wed Jun 18 13:21:31 2025 -0700
[PermissionOptions] Introduce PermissionDecision
This change removes technical debt by introducing PermissionDecision. This is crucial because ContentSettings are not semantically equivalent to permission decisions and include states that are not valid decisions. This CL refactors the permission infrastructure to use this enum for prompt decisions, moving away from ContentSettings. As an additional cleanup, the BrowserPermissionCallback has been updated to accept a PermissionStatus instead of a ContentSetting.
Bug: 411025625
Change-Id: I16bfa01a5608aaac6824dc4b6ce235d814dc2512
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6624075
Auto-Submit: Florian Jacky <fjacky@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: Florian Jacky <fjacky@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1475821}
`ContentSettingPermissionContextBase` has been broken in two classes
with `PermissionContextBase` serving as the base class.
This change moves some of the existing override to
`PermissionContextBase`, to allow the brave version to have the same
customisation points as before.
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/61cf70f0843c9721888ad04c23431d203469bc4d
commit 61cf70f0843c9721888ad04c23431d203469bc4d
Author: Florian Jacky <fjacky@google.com>
Date: Wed Jun 11 04:39:11 2025 -0700
[PermissionOptions] Prepare PCB to support permissions with options
- Support WebsiteSetting values (i.e. base::Value) in PermissionContextBase
- Create subclass ContentSettingPermissionContextBase of PermissionContextSettingBase to support all existing content setting based permissions
- Add permission_options value to permssion_request_data, which prompts can use to pass back prompt options
- Extend PermissionResult with retrieved_permission_data
Full DD: go/multi-state-permissions-dd
Change-Id: I68d16bb1512cd057363f338941d74bd16c3fe430
Bug: 411025625
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6568536
Reviewed-by: Andy Paicu <andypaicu@chromium.org>
Reviewed-by: David Roger <droger@chromium.org>
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Commit-Queue: Florian Jacky <fjacky@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1472321}
This class is now named `ContentSettingPermissionContextBase`. This
affects several of our overrides.
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/9f8c396a492dffad7b93c7d8adfe0fbdaee0dc45
commit 9f8c396a492dffad7b93c7d8adfe0fbdaee0dc45
Author: Florian Jacky <fjacky@google.com>
Date: Tue Jun 10 02:50:36 2025 -0700
[PermissionOptions] Rename PermissionContextBase to ContentSettingPermissionContextBase
Bug: 411025625
A recent change in Chromium is avoiding passing `PermissionRequestData`
as a unique_ptr around, and actually just as a ref where no mutate is
required.
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/173060c862de19ba0660a29697a1614782cd8c43
commit 173060c862de19ba0660a29697a1614782cd8c43
Author: Chris Fredrickson <cfredric@chromium.org>
Date: Wed May 14 07:23:01 2025 -0700
Avoid references to unique_ptrs in permissions API
A function that takes a reference does not typically care whether or not
the referent is allocated on the heap. So, the use of `const
std::unique_ptr<T>&` in the public API is unnecessary and overly
restrictive. (E.g., GeolocationPermissionContextDelegateAndroid can now
avoid an unnecessary heap allocation.)
Additionally, the const keyword only promises that the unique_ptr itself
is const; the referent might still be mutated. This is usually not the
desired behavior when using references, so this type is somewhat
misleading. (`const std::unique_ptr<const T>` would have to be used
instead, in order to get familiar "immutable argument" semantics.)
For both of those reasons, it is better to use a normal `const
PermissionRequestData&` instead of `const
std::unique_ptr<PermissionRequestData>&` in the public API.
Change-Id: Iae1228a7bf17f9de77a86e2e9c44592e6a418645
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6532217
Commit-Queue: Colin Blundell <blundell@chromium.org>
Reviewed-by: Florian Jacky <fjacky@chromium.org>
Commit-Queue: Chris Fredrickson <cfredric@chromium.org>
Auto-Submit: Chris Fredrickson <cfredric@chromium.org>
Reviewed-by: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1460064}
PermissionRequestData is now used to pass various permission parameters around
and several functions/constructors were modified to accomodate that change.
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/7f3e3ca1b6ceddc2e18a4fe86d2ce3ac936e68ba
commit 7f3e3ca1b6ceddc2e18a4fe86d2ce3ac936e68ba
Author: Florian Jacky <fjacky@google.com>
Date: Mon May 5 09:19:20 2025 -0700
[PermissionOptions] Simplify request path, provide resolvers, pass back request information
This CL is part of a larger change to support permissions with options. A summary of changes in this CL can be found below, the full de>
- Simplify interfaces to rely on PermissionRequestData wrapper and refactor PermissionContextBase and its subclasses accordingly.
- Update PermissionRequestData to rely on permission resolvers.
- Refactor PermissionRequest to rely on unique PermissionRequestData object and pass it to permission decided callbacks. Let Permission>
Full design doc: http://go/multi-state-permissions-dd
Change-Id: I81df3cbcedb9c7ef2340a0d79734adf77f336aae
Bug: 394547183, 393053278
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
This is a case where a header uses `PermissionRequest` as a forward
declaration, and therefore it cannot be inside the substitution for the
chromium implementation.
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/b62b90cc5d1b7184b6220c497028a639f0b2fbfa
commit b62b90cc5d1b7184b6220c497028a639f0b2fbfa
Author: Piotr Bialecki <bialpio@chromium.org>
Date: Fri Apr 18 05:39:58 2025 -0700
Media preview: introduce additional product-specific data in HaTS
This CL introduces additional product-specific data for camera and
microphone permissions HaTS.
Main changes:
- PermissionRequest can now store preview parameters for HaTS.
- UI-related code now will contain weak pointer to PermissionRequest,
which it can then use to store preview parameters. Those parameters
are used in ChromePermissionsClient to populate extra PSD for HaTS.
- Metrics context used in previews UI code now stores information
about whether permissions prompt was combined or not.
- We now compute additional information in AudioStreamCoordinator,
analogous to what VideoPreviewCoordinator does.
Minor changes:
- Untangled some includes and forward references in permissions-related
code so that permissions_request.h could start including the
permission_hats_trigger_helper.h.
Change-Id: I5f7155e2fbd1d11b1bdf7fb3f133e2f9193111c4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6404635
Reviewed-by: Ahmed Moussa <ahmedmoussa@google.com>
Auto-Submit: Piotr Bialecki <bialpio@chromium.org>
Commit-Queue: Piotr Bialecki <bialpio@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1448830}
This time around the use of `PermissionControllerDelegate`.
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/8373f041635205aa34164129a389941c774feccb
commit 8373f041635205aa34164129a389941c774feccb
Author: Florian Jacky <fjacky@google.com>
Date: Wed Apr 16 07:20:53 2025 -0700
Reland "[PermissionOptions] Use PermissionDescriptorPtr in PermissionControllerDelegate"
This reverts commit d0da8f7e4b866502cb48f9b79868f976be33c042.
Reason for revert: Fix CastPermissionManager
Bug: 394547183, 393053278
Original change's description:
> Revert "[PermissionOptions] Use PermissionDescriptorPtr in PermissionControllerDelegate"
>
> This reverts commit e116ae4b94a5c9344be3c6ef021ed3e22355811f.
>
> Reason for revert: cause build failed: https://ci.chromium.org/ui/p/chromium/builders/ci/android-cast-arm64-dbg/6828/overview
>
> Bug: 394547183, 393053278
> Original change's description:
> > [PermissionOptions] Use PermissionDescriptorPtr in PermissionControllerDelegate
> >
> > This is part of a larger change to support permission options. Permissions with options can no longer be represented by a simple PermissionType enum value, hence the permission infrastructure will start relying on PermissionDescriptorPtrs instead of PermissionTypes.
> >
> > To reduce the complexity of this CL, it limits the scope of the interface changes to PermissionControllerDelegate, its children and their usages, and uses utility mapping functions to map from PermissionType to PermissionRequestDescriptionPtr, i.e. it does not yet modify the infrastructure itself yet to fully rely on PermissionRequestDescriptorPtr.
> >
> > Since all ContentSetting permission types currently map to exactly one PermissionDescriptorPtr and vice versa, the mapping for all content setting permission types is unique and can rely on these mapping utility functions. Permissions that want to make use of permission options in the future, will create the correct PermissionRequestDescriptorPtr instead of relying on the current mapping functions.
> >
> > Design doc: go/multi-state-permissions-dd
> >
> > Bug: 394547183, 393053278
> > Change-Id: I620e936a8dd433bfb23e822414126aed94e1995b
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6438921
> > Reviewed-by: David Song <wintermelons@google.com>
> > Commit-Queue: Florian Jacky <fjacky@chromium.org>
> > Reviewed-by: Colin Blundell <blundell@chromium.org>
> > Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
> > Reviewed-by: Nate Fischer <ntfschr@chromium.org>
> > Cr-Commit-Position: refs/heads/main@{#1446687}
>
> Bug: 394547183, 393053278
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Change-Id: I8bea71bb2ac283c37ea8154e3155c2bb8cf3738f
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6454573
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Owners-Override: Victor Tan <victortan@chromium.org>
> Commit-Queue: Victor Tan <victortan@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1446703}
Bug: 394547183, 393053278
Change-Id: I52ea81711a8f4125b3d4c2ae531030518cac5472
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6455975
Reviewed-by: Peter Beverloo <peter@chromium.org>
Reviewed-by: David Song <wintermelons@google.com>
Reviewed-by: Antonio Rivera <antoniori@google.com>
Commit-Queue: Florian Jacky <fjacky@chromium.org>
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Reviewed-by: Nate Fischer <ntfschr@chromium.org>
Reviewed-by: Victor Tan <victortan@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1447707}
This new enum type has no entries for the brave permission types. This
change adds the equivalent matching to satisfy the switch statements for
them.
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/65b7d1024662d56b3ad7bf59580c2f9aa04d090e
commit 65b7d1024662d56b3ad7bf59580c2f9aa04d090e
Author: Florian Jacky <fjacky@google.com>
Date: Mon Apr 7 03:02:52 2025 -0700
[PermissionOptions] Generalize PermissionRequestDescription
Refactor PermissionRequestDescription to hold PermissionDescriptorPtr.
Permissions with options can no longer be represented by a simple
PermissionType enum value, hence future infrastructure refactorings to
enable them will pass around PermissionDescriptorPtrs instead of mapping
PermissionDescriptorPts to PermissionTypes.
To reduce the complexity of this CL, it limits the scope of the
refactoring to PermissionRequestDescription, its creations and usages
and uses utility mapping functions to map
PermissionRequestDescriptionPtr usages of this object to the
PermissionTypes. I.e. it does not yet modify the infrastructure itself
yet to rely on PermissionRequestDescriptorPtr.
Since all ContentSetting permission types currently map to exactly one
PermissionDescriptorPtr and vice versa, the mapping for all content
setting permission types is unique and can rely on these mapping utility
functions. Permissions that want to make use of permission options in
the future, will create the correct PermissionRequestDescriptorPtr
instead of relying on the current mapping functions.
refactoring. We need to add mapping functions to reduce the scope of
this CL and avoid having to make all changes at once. These mapping
functions will not be necessary in fuchsia, as the infrastructure will
move to fully relying on a different type.
Bug: 405943540, 393053278
Fuchsia-Binary-Size: Increase is temporary. This CL is part of a large
Change-Id: I9d6e3e71385749787a973a61e41ce130665c860d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6387077
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Reviewed-by: Nate Fischer <ntfschr@chromium.org>
Commit-Queue: Florian Jacky <fjacky@chromium.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1443356}
This change migrates all uses of `#pragma allow_unsafe_buffers` to use
`UNSAFE_TODO`. This makes the offending places more visible, as well as
making explicit the introduction of new spots.
Resolves https://github.com/brave/brave-browser/issues/45414
The header itself is deleted and the implementation has moved elsewhere
making the inclusion unnecessary.
Chromium change:
https://chromium.googlesource.com/chromium/src/+/878f8351809ff802cae6173daaaac6f7bc05e2cd
commit 878f8351809ff802cae6173daaaac6f7bc05e2cd
Author: Sandor Major <sandormajor@chromium.org>
Date: Tue Feb 18 12:16:02 2025 -0800
Move `ParsedPermissionsPolicyDeclaration` from Blink to Network service
The network service is going to need access to the "storage-access"
Permissions Policy. This is the third step of moving some of the
Permissions Policy logic out of Blink to maintain a single
implementation of https://w3c.github.io/webappsec-permissions-policy
across Chromium.
Bug: 382291442
These are pure non-functional renamings that are mostly immaterial.
Chromium change:
https://chromium.googlesource.com/chromium/src/+/bbca3f0d400a895412f3ff8eda7dcad79e04b6a1
commit bbca3f0d400a895412f3ff8eda7dcad79e04b6a1
Author: Chase Phillips <cmp@chromium.org>
Date: Tue Oct 22 14:12:17 2024 +0000
permissions: Fix name for ContentSettingsType
ContentSettingsType was referred to in some places with a typo. Fix
the name to bring consistency, which should improve readability and
using other tools like grep.
Bug: 374797724