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/+/e8436cccafc34d6e4d9c060f682345060579d208https://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}
This change updates how brave/chromium_src overrides can reference original files: it adds ability to use #include <...> along with #include "src/...". This is enabled by replacing -I../../brave/chromium_src with -iquote../../brave_chromium_src, which adds an include search path only for #include "..." directives.
With this approach, other files in the build tree can reference brave/chromium_src overrides using #include "...", while the overrides themselves can reference original Chromium files using #include <...>. Since Chromium uses #include "..." for all in-tree files, we can leverage this convention and configure our overrides so that we can drop support for #include "src/" later by removing -I../../.. and making rbe_exec_root modification obsolete (the main goal).
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/7eb44b05ca808d66b3324aa4ea3902becfa3b0e9
commit 7eb44b05ca808d66b3324aa4ea3902becfa3b0e9
Author: Joshua Pawlicki <waffles@chromium.org>
Date: Tue May 6 08:51:18 2025 -0700
Updater: Clear CrxCache entries belonging to unregistered apps.
Additionally, proactively clear the qualification app from the cache
after successful qualification.
These changes required expanding the lifetime of the CrxCache from being
scoped to the UpdateEngine to being scoped to the configurator's
lifetime.
Fixed: 407176851
Download size is now a required attribute which our go updater currently
doesn't supply. Until the go updater gets fixed we can bypass the size
check.
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/cf775224f2c9a85364d1632e1f57e1023fa1d320
commit cf775224f2c9a85364d1632e1f57e1023fa1d320
Author: James Decker <deckerjames@google.com>
Date: Fri Apr 11 13:09:51 2025 -0700
Adding events for operation attribute errors.
- adds events for the existing unsupported operations error handling.
- adds checking for cases where expected attributes are either missing or do not match expectations (e.g. hash is empty, download size less than or equal to 0).
- For the missing attributes, we just reuse the existing operation event types.
- For unsupported operations, a new event was added to the protocol and implementation.
- Added naive size checking to verify that the download size for a payload both exists, and is at a minimum greater than 0. If this is not the case, then a bug on the server could lead to downloading payloads past the disk space limit of "available_space / 2", causing disk space issues for the client machine.
Note: kEventUnsupported should always have a failed result.
other notable changes:
- moved simple event creation to a shared location to reduce redundant code, and also give access to it from pipeline.cc
- modified the disjoint "terminal" and "non_terminal" ping data lists in update client tests to instead be "terminal" and "all pings". This allows us to ignore the operation events when needed, while allowing us to still verify the full order of events in the cases where non-terminal events are relevant.
Bug: 409566857
This class has now been spanified, which has dropped the use of the
factory function. This change corrects our use of this class too.
Chromium changes
https://chromium.googlesource.com/chromium/src/+/5a157ba810e66a8139990724edd941944955417a
commit 5a157ba810e66a8139990724edd941944955417a
Author: Elly <ellyjones@chromium.org>
Date: Tue Apr 8 10:05:56 2025 -0700
components/cup: migrate to new crypto APIs
This change migrates //components/client_update_protocol from:
* crypto/sha2 to crypto/hash
* crypto/signature_verifier to crypto/sign and crypto/keypair
Specifically:
* Uses of the obsolete SHA-256 APIs are replaced with uses of the new
crypto::hash API, generally resulting in less copying and intermediate
variables
* Use of SignatureVerifier is replaced with a single call to
crypto::sign::Verify
That causes a design change. Previously, the Ecdsa class relied on
SignatureCreator, and creation of SignatureCreator could fail, so
Ecdsa also had to have a constructor that could fail (its ::Create
static method). Since construction of PublicKey *can't* fail unless the
public key is malformed, and we know the public key in advance (it is
hardcoded), Ecdsa no longer needs a fallible ::Create method. It is now
possible to directly construct an Ecdsa instance and hold it inline.
This change bubbles outwards to clients of Ecdsa, which now hold Ecdsa
instances as class members directly rather than as unique_ptrs, and
allows removing a bunch of conditions / failure paths from those client
classes.
Apart from that design change (which accounts for the bulk of the LOC in
this CL), this CL:
* Migrates some raw arrays to std::arrays, fixing unsafe bounds
warnings;
* Promotes some DCHECKs that indicate programmer errors to CHECKs in
line with current guidance;
* Removes some logic that decoded static public keys from hardcoded
base64 strings at runtime in favor of hardcoding the raw key bytes
instead, and removes some failure paths as a result;
* Removes the MISSING_PUBLIC_KEY error code, since this is now
impossible in RequestSender (the public key is hardcoded, and no
longer needs fallible base64 decoding);
* Adds assignment operators to crypto::keypair, which I forgot to do
when originally adding them but which are needed for Ecdsa to allow
replacing its internal keys for testing
Bug: 372283556
This change does unifies the id/status pair data sent during `OnEvent`
under a single structure, which affects quite a few places where this
event is used.
Another place affected by these changes involves instantiating
`UpdateContext`, which doesn't require to pass along a
`notify_observers_callback` argument.
Chromium change:
https://chromium.googlesource.com/chromium/src/+/2c20c79dfeff629b1867c5e0a8837149e8a5f668
commit 2c20c79dfeff629b1867c5e0a8837149e8a5f668
Author: Joshua Pawlicki <waffles@chromium.org>
Date: Fri Sep 27 13:28:14 2024 +0000
update_client: Simplify observer mechanisms.
Prior to this CL, there were multiple observer mechanisms that used
different types, but all of which mapped to the same underlying
concepts. After this CL, there are still multiple mechanisms (depending
on whether the observer wants their observations scoped to a single
updater operation or whether they want to observe the updater as a
whole), but the types are now consistent, and observers get a constref
snapshot of the observed item.
Bug: 353249967
The return value for `GetInstalledFile` has changed, which has broken
the override, as it relies on the substitution declaration to have the
same return type.
Chromium change:
https://chromium.googlesource.com/chromium/src/+/4bc4563fa88f842b1fa05ee6ec28f80c26a48f6f
commit 4bc4563fa88f842b1fa05ee6ec28f80c26a48f6f
Author: Joshua Pawlicki <waffles@chromium.org>
Date: Thu Sep 12 19:14:48 2024 +0000
update_client: Simplify ActionRunner.
Also eliminate the implementation of GetInstalledFile for the extension
updater. The diff system no longer calls it and the only remaining
caller is ActionRunner, which we don't need to support for extensions.
Also add some checks against parent and absolute paths in the run
command. (We don't need these and maybe it's unwise to have the client
accept them from the server for insider risk reasons.)
The original motivation of the CL was to continue to eliminate refs to
Component (ActionRunner held a raw_ref.)
Bug: 353249967
This only affects how certain instatiations were being done, as the
data itself was only getting passed along.
Chromium change:
https://chromium.googlesource.com/chromium/src/+/eecda5d4d6f20fe6baba7f7c0eb0e02284a349f6
commit eecda5d4d6f20fe6baba7f7c0eb0e02284a349f6
Author: Joshua Pawlicki <waffles@chromium.org>
Date: Wed Sep 11 13:48:38 2024 +0000
update_client: Simplify ping_manager.
Also remove a dependency from util on component.
Also improve memory safety in request_sender.
Bug: 353249967
This commit adds an implementation that replaces Sparkle by Omaha 4 for
on-demand updates. It is hidden behind a default-disabled GN arg and
is highly experimental: The user must manually install Omaha 4 by
executing a command. They must also manually create a JSON file that
tells Omaha that Brave is installed. Once they do that, the
implementation can update to a new version via brave://settings/help.
The associated "Brave was updated - relaunch?" button does not work.
This change replaces all uses of `absl::optional` with `std::*` variants
for optional. This is in line with upstream recent changes making
`absl::optional` a `typedef` to the `std` type.
This change has been done using an automated script:
#!/bin/bash
function replace {
echo "Replacing $1 by $2"
git grep -l "$1" \
| cut -f1 -d: \
| sort \
| uniq \
| grep \
-e "\.h" \
-e "\.cc" \
-e "\.mm" \
-e "\.py" \
| xargs sed -i "s/$1/$2/g"
}
function delete_line_with {
echo "Deleting lines with $1"
git grep -l "$1" \
| cut -f1 -d: \
| sort \
| uniq \
| grep \
-e "\.h" \
-e "\.cc" \
-e "\.mm" \
-e "\.py" \
| xargs sed -i "/$1/d"
}
function add_header {
echo "Adding header $1"
git diff --name-only HEAD \
| xargs ../tools/add_header.py --header "$1"
}
replace "absl::make_optional" "std::make_optional"
replace "absl::optional" "std::optional"
replace "absl::nullopt" "std::nullopt"
replace "absl::in_place" "std::in_place"
replace "absl::in_place_t" "std::in_place_t"
add_header "<optional>"
delete_line_with "\"third_party\/abseil-cpp\/absl\/types\/optional.h\""
git cl format
Chromium change:
https://chromium.googlesource.com/chromium/src/+/d9d21aa16829a7d471a4f3b3a493a31170ed8271
commit d9d21aa16829a7d471a4f3b3a493a31170ed8271
Author: David Benjamin <davidben@chromium.org>
Date: Mon Oct 2 23:29:57 2023 +0000
Make absl::optional a typedef for std::optional
This only changes the types around. It doesn't rewrite existing uses
to std::optional, which we can do incrementally.
absl::optional to std::optional seems to have two visible impacts.
First, the field order is different (bool first vs bool last).
std::optional's order (bool last) seems to be better overall, decreasing
binary size. Second, absl::optional's assertions crash with
__builtin_trap, while std::optional calls __libcpp_verbose_abort which
calls base::ImmediateCrash. __builtin_trap permits the compiler to
combine crash sites within a function but leads to worse crash
debugging. In base::ImmediateCrash, we'd made a conscious decision to
prefer debuggability and pay some binary size for it. The net size
increase brings our optional type in line with that preference.
For more details see the discussion and document below:
https://groups.google.com/a/chromium.org/g/cxx/c/XG3G85_ZF1k/m/_QN8adIJBQAJhttps://docs.google.com/document/d/1AW7q9HCLOk738OCj8Z2U_AKVUC0YIFZWuyRvv09XTHk/edit
Binary-Size: See discussion above.
Fuchsia-Binary-Size: See discussion above.
Bug: 1373619
Chromium change:
https://chromium.googlesource.com/chromium/src/+/d91abf4b79a87df464a43a5adfde44dc6e2d5055
commit d91abf4b79a87df464a43a5adfde44dc6e2d5055
Author: Sorin Jianu <sorin@chromium.org>
Date: Sat Mar 11 01:48:51 2023 +0000
Updater: implement CheckForUpdate.
This function checks for updates, and not download/install.
Follow up CLs to:
* remote the function for Posix implementations using Mojo.
* roll a new CIPD build, fix, and re-enable ondemand legacy tests.
This CL creates an new function:
update_client::UpdateClient::CheckForUpdate.
Bug: 1396103
This change corrects all sites where pointer fields were still remaining
in the codebase, and replaces them with `raw_ptr<T>`, and `raw_ref<T>`.
This is in accordance with upstream hardening requirements, which are
about to be enforced by chromium's clang plugin, in M114.
This change goes one step further, and replaces pointer with references
in types where nullptr values are not supposed to be supported.
* Add presubmit check for IWYU export in chromium_src headers.
* Add // IWYU pragma: export to "src/" and "../gen/" includes.
* Export brave grit headers.
* Allow multiple includes for net_log_event_type_list.h.
* Std is not used in search_engines_handler.h.
* Fix recently added headers.
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/c71daa80f0178d271e53174364ee2e0d71568458
commit c71daa80f0178d271e53174364ee2e0d71568458
Author: Joshua Pawlicki <waffles@chromium.org>
Date: Thu Dec 2 22:23:06 2021 +0000
Reland "Component Updater: Refactor disable-updates policy."
This is a reland of 4df664317fc9f29f608ea8405a55b26c8bd1d8ca
Patch set 1 is the original change, and patch set 4 is the fixed version.
Original change's description:
> Component Updater: Refactor disable-updates policy.
>
> The handling of the policy and combination with component data is moved
> out of update_client (which is used by many embedders) and into
> component_updater.
>
> To achieve this, component_updater's Register no longer takes a strict
> subset of CrxComponent information as an argument. A new type
> (ComponentRegistration) is introduced to hold a component's registration
> information with the component updater, and it is used to construct
> CrxComponents on the fly in the crx data callback. The policy is applied
> at that time.
>
> There should be no change in behavior, but the simplication of
> update_client's API makes the behavior of chrome/updater more clear.
>
> Bug: 1094024
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/2d59e682ab9eb904124f5778eb8ceb3cb2a90231
commit 2d59e682ab9eb904124f5778eb8ceb3cb2a90231
Author: Anton Bikineev <bikineev@chromium.org>
Date: Tue May 18 12:29:22 2021 +0000
Deprecate base/optional.h and fix remaining mentions.
Docs are still to be updated (in a followup).
Bug: 1202909
Converted remaining cases of base::Optional to absl::optional, plus
updated DEPS file with an exception that is temporarily required
while we don't have such exception added to Chromium's toplevel DEPS
file (see commit linked below, not yet included in 92.0.4503.5).
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/9662571bb2954fb1759c49e5c45e59571cd1899e
commit 9662571bb2954fb1759c49e5c45e59571cd1899e
Author: Anton Bikineev <bikineev@chromium.org>
Date: Thu May 13 19:17:50 2021 +0000
Reland "Alias base::Optional to absl::optional"
This relands f3493eb4f80c5716ed2d7de195f710537beacc6b. The reason of the
failure: missing base// dep in some of the internal components, which
caused the branded builds to fail.
For sherrifs: the change may cause build failures on bots that are not
tested in the regular CQ pipeline. Those issues are mostly caused by
missing base// dependencies. Before reverting this change, please
consider fixing missing dependencies, similar to what the CL 2891488
does.
Original CL description:
> Alias base::Optional to absl::optional
>
> This CL does the following:
> 1) Replaces base::Optional and friends with aliases to corresponding
> entities from abseil. base::in_place is the only thing not aliased, as
> it's also used in other contexts (e.g. StructPtr in mojo).
> 2) Replaces all optional-related uses of base::in_place with
> absl::in_place.
> 3) Fixes missing headers (e.g. base/check.h) that used to be recursively
> included from base/optional.h
> 4) Also, removes forward declarations for base::Optional and instead
> includes "base/optional.h" directly. The argument is the same as for
> forward declarations of std types - the exact declaration (struct vs
> class, number of template arguments (e.g. for SFINAE)) is an
> implementation detail that can change.
>
> The CL also tries to support base/optional_unittest.cc (will be removed
> with base/optional.h) however the nocompile is already removed, since
> supporting it seems to be harder.
>
> Followup CLs will replace base::optional with absl::optional per
> component.
>
> Bug: 1202909
> Change-Id: I25b276401ceba13da35b3a0331d5ccbd338c4539
> AX-Relnotes: n/a.
> Reviewed-on:
> https://chromium-review.googlesource.com/c/chromium/src/+/2892208
> Commit-Queue: Anton Bikineev <bikineev@chromium.org>
> Commit-Queue: Peter Kasting <pkasting@chromium.org>
> Reviewed-by: Peter Kasting <pkasting@chromium.org>
> Reviewed-by: Kentaro Hara <haraken@chromium.org>
> Owners-Override: Peter Kasting <pkasting@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#882460}
Bug: 1202909