20 Commits
Author SHA1 Message Date
Claudio DeSouza 0f82c17c07 [cr145] CookieBlocking3pcdStatus deleted
The use of this status everywhere has been dropped from Chromium.

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/45619a47cea5e2b373bfc46826552c7a6e925b90

commit 45619a47cea5e2b373bfc46826552c7a6e925b90
Author: Fiona Macintosh <fmacintosh@google.com>
Date:   Thu Dec 18 12:25:20 2025 -0800

    Clean up CookieBlocking3pcdStatus

    Bug: b:382043551
    Change-Id: I924186151afccc3511731f90d07e2bd9e9d71fe0
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7268426
    Reviewed-by: Christian Dullweber <dullweber@chromium.org>
    Commit-Queue: Fiona Macintosh <fmacintosh@google.com>
    Reviewed-by: Calder Kitagawa <ckitagawa@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1560755}
2026-01-29 13:40:47 -05:00
Aleksei Khoroshilov a41bf5350b Replace "src/" includes with <> in chromium_src. (#30096)
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).
2025-07-24 17:37:44 +07:00
Claudio DeSouza decc14b198 [cr137] Fix unused variable errors for should_highlight
The override was previously replacing a function call, but now the
function call was hoisted into a variable, which has caused the clang
warning. This fix finds a way to evaluate the variable, but always to
false.

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

commit e428f68d1f5209639ec9207de65c1fe641288a98
Author: Aldo Culquicondor <acondor@chromium.org>
Date:   Mon Apr 7 08:09:07 2025 -0700

    Optimize CookieControlsController::UpdateUserBypass

    PageSpecificContentSettings::OnCookiesAccessed takes around 0.5% of
    non-idle CPU time in the wild.

    CookieControlsController::UpdateUserBypass was one of the most consuming
    operations in there.

    - Before: https://screenshot.googleplex.com/4wtupsPnqS4QL3L
    - After: https://screenshot.googleplex.com/8XrJg2B7KKxZwDP

    Bug: 408434907
    Change-Id: Ia679e3a6934d50b046069213155e72de4f48d331
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6434888
    Reviewed-by: Fiona Macintosh <fmacintosh@google.com>
    Commit-Queue: Aldo Culquicondor <acondor@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1443484}
2025-05-13 15:52:49 -04:00
Aleksei Khoroshilov 16c3660c5b Ensure shields settings always exist in worker. (#27762)
* Ensure shields settings are valid in worker.

* Add a comment for the added method.
2025-03-18 16:52:29 +07:00
goodov 66b72c6004 Refresh Ephemeral Storage changes in CookieSettingsBase (#24364)
* Cleanup NOTREACHED_IN_MIGRATION.

* Use CookieSettingWithMetadata as it now has all required info.

* IsCookieAccessAllowedImpl no longer exists upstream.

* Remove now unused replacement.

* Remove CookieSettingOverrides from ShouldUseEphemeralStorage().
2024-06-27 14:38:57 +07:00
Artem Samoilenko 36c64efb19 [C124] Disable third-party cookies warning 2024-04-11 12:46:54 -04:00
Claudio DeSouza ce479b627d Content manager passing a LocalFrameToken
The use of weakly typed `render_frame_id` is being replaced by a
specific type called LocalFrameToken, to be passed from the renderer.
This change corrects our overrides of `ContentSettingsManager`, as well
as our own injected extension to it, to use this type.

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

commit f8178e69f288c5d68072c9c985cbf82904cac212
Author: Dave Tapuska <dtapuska@chromium.org>
Date:   Tue Nov 14 18:50:13 2023 +0000

    [content_settings] Pass frame tokens from the renderer

    Change the mojo call to pass a strongly typed frame token instead
    of a routing ID.

    Bug: 993189
2024-01-15 14:26:12 -05:00
cdesouza-chromium d1384a7872 [CodeHealth] Replace absl::optional with std::* (#21156)
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/_QN8adIJBQAJ
    https://docs.google.com/document/d/1AW7q9HCLOk738OCj8Z2U_AKVUC0YIFZWuyRvv09XTHk/edit

    Binary-Size: See discussion above.
    Fuchsia-Binary-Size: See discussion above.
    Bug: 1373619
2023-12-01 10:16:12 +00:00
Max Karolinskiy 03e0a4ced2 Fixes missing #undefs, etc. in chromium_src overrides. 2023-10-12 11:39:40 -04:00
Aleksey Khoroshilov 476ec0cd62 Fix global third-party blocking setting applying. 2023-03-17 18:51:38 -04:00
Claudio DeSouza 5ce9f8f4a8 net::CookieSettingOverride::kNone removed
Chromium change:
https://chromium.googlesource.com/chromium/src/+/bfaa7208ef6e0a2255af3f66ce86a969ec6d5192

commit bfaa7208ef6e0a2255af3f66ce86a969ec6d5192
Author: Chris Fredrickson <cfredric@chromium.org>
Date:   Tue Jan 31 17:13:24 2023 +0000

    Remove unused kNone variant

    This variant is never used explicitly, and there are no
    default-initialized CookieSettingOverride variables, so it is never
    used implicitly either.

    Thus far, the only use of the CookieSettingOverride enum is in an
    EnumSet, and in that use case, it's unnecessary to have an explicit
    variant for "no override", since the set could just be empty instead.

    (If, in the future, we need a way to represent "a single override or
    maybe nothing", we should use a absl::optional<CookieSettingOverride>
    for that.)

    Change-Id: If0c6b37812818c581ccdcf5a1e2271e03a9ac57a
2023-03-17 18:47:11 -04:00
Claudio DeSouza 041f14292c Plumbing CookieSettingOverrides through CookieSettings
Chromium change:
https://chromium.googlesource.com/chromium/src/+/e9feaa7af4dca3d56a62bb449778b112b5126bbf

commit e9feaa7af4dca3d56a62bb449778b112b5126bbf
Author: Chris Fredrickson <cfredric@chromium.org>
Date:   Tue Jan 24 21:01:59 2023 +0000

    Remove deprecated GetCookieSetting overload

    Bug: 1386190, 1401089
2023-02-22 06:29:19 -05:00
Aleksey Khoroshilov ae5328be76 Enforce IWYU export pragma in chromium_src headers for src/ includes (#16957)
* 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.
2023-02-14 07:57:35 -05:00
Aleksey Khoroshilov 3b0a9340c0 Remove unnecessary same dir rules in DEPS. 2021-12-08 14:48:24 +07:00
Aleksey Khoroshilov 5a33f242de Remove unnecessary DEPS rules. 2021-12-08 14:48:21 +07:00
Aleksey Khoroshilov 860f6ec6cb Replace relative paths in chromium_src to src-based.
# Conflicts:
#	chromium_src/chrome/browser/ui/dialogs/outdated_upgrade_bubble.cc
#	chromium_src/chrome/browser/ui/views/bubble/bubble_contents_wrapper.cc
#	chromium_src/chrome/browser/ui/views/page_info/page_info_bubble_view.cc
#	chromium_src/chrome/browser/ui/views/page_info/page_info_view_factory.h
#	chromium_src/chrome/common/webui_url_constants.cc
#	chromium_src/components/safe_browsing/content/browser/client_side_model_loader.cc
#	chromium_src/components/translate/core/browser/translate_prefs.cc
#	chromium_src/third_party/blink/renderer/core/loader/subresource_redirect_util.cc
#	chromium_src/third_party/blink/renderer/core/loader/subresource_redirect_util.h
2021-12-08 14:47:35 +07:00
Mario Sanchez Prada b1d78a91a7 Migrate from GURL to SiteForCookies in chromium_src overrides
We need to adapt our several chromium overrides for C++ and Mojo to
adapt to the new type used upstream.

Chromium change:

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

commit c5d52f95c789dee2102bae02b16fa9001ef550c0
Author: Ari Chivukula <arichiv@chromium.org>
Date:   Wed Aug 25 04:22:29 2021 +0000

    [GURL -> SiteForCookies] cookie_settings_base

    This is part of a larger effort to replace GURL with SiteForCookies to
    simplify/consolidate comparison and increase safety. This file was found
    by looking for mojom files as follows:
    https://source.chromium.org/search?q=%22GURL%26%20site_for_cookies%22

    Bug: 577565
2021-10-05 16:20:01 -04:00
Aleksey Khoroshilov bd7ddb2fce Remove unused StorageType parameter from EphemeralOrigin getter. 2021-07-29 21:33:13 +07:00
Aleksey Khoroshilov 1a67fade4f Implement proper in-memory ephemeral localStorage support. 2021-07-23 17:52:26 +07:00
Aleksey Khoroshilov 3f91a7ab57 Unify ephemeral storage trigger logic to use net::CookieOptions. 2021-06-28 18:08:37 +07:00