0
Commit Graph

186 Commits

Author SHA1 Message Date
Sandor Major
07aa8b0689 Move PermissionsPolicy to the network service
The network service needs access to the permissions policy. Previous CLs
moved all the dependencies so it is now safe to move this class.

The following files need to include permissions_policy.h because
otherwise they want to have access into incomplete `PermissionsPolicy`:
* components/permissions/permission_uma_util.cc
* third_party/blink/common/manifest/manifest_util.cc
* third_party/blink/renderer/core/html/client_hints_util.cc
* third_party/blink/renderer/modules/payments/payment_app_service_worker_registration.cc
* third_party/blink/renderer/modules/payments/payment_instruments.cc

Bug: 382291442
Low-Coverage-Reason: LARGE_SCALE_REFACTOR
Change-Id: Ifcf52df3bc5c035e8f6a45df02cf93f304b748c9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6310821
Auto-Submit: Sandor «Alex» Major <sandormajor@chromium.org>
Owners-Override: Rick Byers <rbyers@chromium.org>
Commit-Queue: Sandor «Alex» Major <sandormajor@chromium.org>
Reviewed-by: Ari Chivukula <arichiv@chromium.org>
Reviewed-by: Rick Byers <rbyers@chromium.org>
Reviewed-by: Maks Orlovich <morlovich@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1426391}
2025-02-28 09:24:35 -08:00
Sandor Major
23d052556d Move client hints-permissions policy mapping to the network service
Permissions policy code will be moved out of blink. Since it depends on
this mapping that also lived in blink, it needs to be moved first.

Bug: 382291442
Change-Id: I794cfb11f6c9b80ac1e688668b54fc6d5ab3fc9a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6301778
Reviewed-by: Ari Chivukula <arichiv@chromium.org>
Reviewed-by: Rick Byers <rbyers@chromium.org>
Commit-Queue: Sandor «Alex» Major <sandormajor@chromium.org>
Reviewed-by: Maks Orlovich <morlovich@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1425339}
2025-02-26 12:28:59 -08:00
Sandor Major
878f835180 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
Low-Coverage-Reason: LARGE_SCALE_REFACTOR
Change-Id: Ic6ad87dd4bd6f882a135a0c580d481dc1b219831
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6254141
Reviewed-by: Guido Urdaneta <guidou@chromium.org>
Reviewed-by: Rick Byers <rbyers@chromium.org>
Reviewed-by: Giovanni Ortuno Urquidi <ortuno@chromium.org>
Owners-Override: Rick Byers <rbyers@chromium.org>
Reviewed-by: Adam Rice <ricea@chromium.org>
Reviewed-by: Ari Chivukula <arichiv@chromium.org>
Commit-Queue: Sandor «Alex» Major <sandormajor@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1421574}
2025-02-18 12:16:02 -08:00
Sandor Major
ca47512a38 Reland "Move OriginWithPossibleWildcards from Blink to the Network service"
This is a reland of commit 0ea18895e7
Original change is in Patchset 1

The trait for `OriginWithPossibleWildcards` was depending on
`url_loader_base_shared` but it should depend on `url_loader_base`
I also got some hints how to reproduce this locally and it seems to
build properly now.

Original change's description:
> Reland "Move `OriginWithPossibleWildcards` from Blink to the Network service"
>
> This is a reland of commit 8cd5274221
> Original change is in Patchset 1
> The revert CL can be found here: https://crrev.com/c/6234523
>
>
> Original change's description:
> > Move `OriginWithPossibleWildcards` from Blink to the Network service
> >
> > The network service is going to need access to the "storage-access"
> > Permissions Policy. This is the second 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.
> >
> > The previous cl is under https://crrev.com/c/6219635
> >
> > Some files got a new include for
> > permissions_policy_feature.mojom-shared.h without content change. This
> > was required because previously the shared mojom header was probably
> > included transitively and now it's not anymore.
> >
> > Bug: 382291442
> > Change-Id: Ib83df88471dd45dcda00235a55113d7283b8814e
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6226434
> > Reviewed-by: Jeremy Roman <jbroman@chromium.org>
> > Auto-Submit: Sandor «Alex» Major <sandormajor@chromium.org>
> > Reviewed-by: Maks Orlovich <morlovich@chromium.org>
> > Commit-Queue: Jeremy Roman <jbroman@chromium.org>
> > Reviewed-by: Ari Chivukula <arichiv@chromium.org>
> > Reviewed-by: Joe Mason <joenotcharles@google.com>
> > Owners-Override: Jeremy Roman <jbroman@chromium.org>
> > Cr-Commit-Position: refs/heads/main@{#1416344}
>
> Bug: 382291442
> Change-Id: I540867ed61dbe858ee59cce96643692c01fc8f3b
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6238257
> Owners-Override: Jeremy Roman <jbroman@chromium.org>
> Reviewed-by: Maks Orlovich <morlovich@chromium.org>
> Commit-Queue: Jeremy Roman <jbroman@chromium.org>
> Reviewed-by: Joe Mason <joenotcharles@google.com>
> Reviewed-by: Ari Chivukula <arichiv@chromium.org>
> Auto-Submit: Sandor «Alex» Major <sandormajor@chromium.org>
> Reviewed-by: Jeremy Roman <jbroman@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1418188}

Bug: 382291442
Change-Id: If50327575954864dfe0638ed6d8d946a122beebc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6250085
Reviewed-by: Joe Mason <joenotcharles@google.com>
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Reviewed-by: Ari Chivukula <arichiv@chromium.org>
Reviewed-by: Maks Orlovich <morlovich@chromium.org>
Commit-Queue: Sandor «Alex» Major <sandormajor@chromium.org>
Owners-Override: Jeremy Roman <jbroman@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1418692}
2025-02-11 08:58:04 -08:00
Yao Xiao
4b5842c9a4 Revert "Reland "Move OriginWithPossibleWildcards from Blink to the Network service""
This reverts commit 0ea18895e7.

Reason for revert: caused build failure: https://ci.chromium.org/ui/p/chromium/builders/ci/win32-archive-rel/47925/overview

Original change's description:
> Reland "Move `OriginWithPossibleWildcards` from Blink to the Network service"
>
> This is a reland of commit 8cd5274221
> Original change is in Patchset 1
> The revert CL can be found here: https://crrev.com/c/6234523
>
>
> Original change's description:
> > Move `OriginWithPossibleWildcards` from Blink to the Network service
> >
> > The network service is going to need access to the "storage-access"
> > Permissions Policy. This is the second 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.
> >
> > The previous cl is under https://crrev.com/c/6219635
> >
> > Some files got a new include for
> > permissions_policy_feature.mojom-shared.h without content change. This
> > was required because previously the shared mojom header was probably
> > included transitively and now it's not anymore.
> >
> > Bug: 382291442
> > Change-Id: Ib83df88471dd45dcda00235a55113d7283b8814e
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6226434
> > Reviewed-by: Jeremy Roman <jbroman@chromium.org>
> > Auto-Submit: Sandor «Alex» Major <sandormajor@chromium.org>
> > Reviewed-by: Maks Orlovich <morlovich@chromium.org>
> > Commit-Queue: Jeremy Roman <jbroman@chromium.org>
> > Reviewed-by: Ari Chivukula <arichiv@chromium.org>
> > Reviewed-by: Joe Mason <joenotcharles@google.com>
> > Owners-Override: Jeremy Roman <jbroman@chromium.org>
> > Cr-Commit-Position: refs/heads/main@{#1416344}
>
> Bug: 382291442
> Change-Id: I540867ed61dbe858ee59cce96643692c01fc8f3b
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6238257
> Owners-Override: Jeremy Roman <jbroman@chromium.org>
> Reviewed-by: Maks Orlovich <morlovich@chromium.org>
> Commit-Queue: Jeremy Roman <jbroman@chromium.org>
> Reviewed-by: Joe Mason <joenotcharles@google.com>
> Reviewed-by: Ari Chivukula <arichiv@chromium.org>
> Auto-Submit: Sandor «Alex» Major <sandormajor@chromium.org>
> Reviewed-by: Jeremy Roman <jbroman@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1418188}

Bug: 382291442
Change-Id: I4bf4fa5e3034e15791e1acae63cc665a4e3d12bb
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6248599
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Yao Xiao <yaoxia@chromium.org>
Owners-Override: Yao Xiao <yaoxia@chromium.org>
Auto-Submit: Yao Xiao <yaoxia@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1418238}
2025-02-10 10:34:15 -08:00
Sandor Major
0ea18895e7 Reland "Move OriginWithPossibleWildcards from Blink to the Network service"
This is a reland of commit 8cd5274221
Original change is in Patchset 1
The revert CL can be found here: https://crrev.com/c/6234523


Original change's description:
> Move `OriginWithPossibleWildcards` from Blink to the Network service
>
> The network service is going to need access to the "storage-access"
> Permissions Policy. This is the second 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.
>
> The previous cl is under https://crrev.com/c/6219635
>
> Some files got a new include for
> permissions_policy_feature.mojom-shared.h without content change. This
> was required because previously the shared mojom header was probably
> included transitively and now it's not anymore.
>
> Bug: 382291442
> Change-Id: Ib83df88471dd45dcda00235a55113d7283b8814e
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6226434
> Reviewed-by: Jeremy Roman <jbroman@chromium.org>
> Auto-Submit: Sandor «Alex» Major <sandormajor@chromium.org>
> Reviewed-by: Maks Orlovich <morlovich@chromium.org>
> Commit-Queue: Jeremy Roman <jbroman@chromium.org>
> Reviewed-by: Ari Chivukula <arichiv@chromium.org>
> Reviewed-by: Joe Mason <joenotcharles@google.com>
> Owners-Override: Jeremy Roman <jbroman@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1416344}

Bug: 382291442
Change-Id: I540867ed61dbe858ee59cce96643692c01fc8f3b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6238257
Owners-Override: Jeremy Roman <jbroman@chromium.org>
Reviewed-by: Maks Orlovich <morlovich@chromium.org>
Commit-Queue: Jeremy Roman <jbroman@chromium.org>
Reviewed-by: Joe Mason <joenotcharles@google.com>
Reviewed-by: Ari Chivukula <arichiv@chromium.org>
Auto-Submit: Sandor «Alex» Major <sandormajor@chromium.org>
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1418188}
2025-02-10 08:54:55 -08:00
Kouhei Ueno
27f86cb71c ClientHints: remove is_javascript_enabled plumbing for prefetch
This CL intends to tidy up the code by removing `is_javascript_enabled`
plumbing to ClientHints impl. The CH currently just refuses to add the
Client Hints headers if Javascript is disabled. This CL modifies to that
the check is done in the caller side.

Bug: None
Change-Id: Icf8b737871325b766c8edf8035e6dd961310de4e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6232361
Commit-Queue: Kouhei Ueno <kouhei@chromium.org>
Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org>
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Reviewed-by: Ari Chivukula <arichiv@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1416653}
2025-02-06 01:03:36 -08:00
Anton Maliev
666c9c8203 Revert "Move OriginWithPossibleWildcards from Blink to the Network service"
This reverts commit 8cd5274221.

Reason for revert: Tree is closed due to compile error: https://ci.chromium.org/ui/p/chromium/builders/ci/mac-arm64-archive-rel/43617/overview

Original change's description:
> Move `OriginWithPossibleWildcards` from Blink to the Network service
>
> The network service is going to need access to the "storage-access"
> Permissions Policy. This is the second 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.
>
> The previous cl is under https://crrev.com/c/6219635
>
> Some files got a new include for
> permissions_policy_feature.mojom-shared.h without content change. This
> was required because previously the shared mojom header was probably
> included transitively and now it's not anymore.
>
> Bug: 382291442
> Change-Id: Ib83df88471dd45dcda00235a55113d7283b8814e
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6226434
> Reviewed-by: Jeremy Roman <jbroman@chromium.org>
> Auto-Submit: Sandor «Alex» Major <sandormajor@chromium.org>
> Reviewed-by: Maks Orlovich <morlovich@chromium.org>
> Commit-Queue: Jeremy Roman <jbroman@chromium.org>
> Reviewed-by: Ari Chivukula <arichiv@chromium.org>
> Reviewed-by: Joe Mason <joenotcharles@google.com>
> Owners-Override: Jeremy Roman <jbroman@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1416344}

Bug: 382291442
Change-Id: I8a8749ea77398bce5a1c6c3e2d0dfd5e06945b97
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6234523
Auto-Submit: Anton Maliev <amaliev@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Anton Maliev <amaliev@chromium.org>
Owners-Override: Anton Maliev <amaliev@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1416362}
2025-02-05 11:50:33 -08:00
Sandor Major
8cd5274221 Move OriginWithPossibleWildcards from Blink to the Network service
The network service is going to need access to the "storage-access"
Permissions Policy. This is the second 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.

The previous cl is under https://crrev.com/c/6219635

Some files got a new include for
permissions_policy_feature.mojom-shared.h without content change. This
was required because previously the shared mojom header was probably
included transitively and now it's not anymore.

Bug: 382291442
Change-Id: Ib83df88471dd45dcda00235a55113d7283b8814e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6226434
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Auto-Submit: Sandor «Alex» Major <sandormajor@chromium.org>
Reviewed-by: Maks Orlovich <morlovich@chromium.org>
Commit-Queue: Jeremy Roman <jbroman@chromium.org>
Reviewed-by: Ari Chivukula <arichiv@chromium.org>
Reviewed-by: Joe Mason <joenotcharles@google.com>
Owners-Override: Jeremy Roman <jbroman@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1416344}
2025-02-05 11:20:26 -08:00
Sandor «Alex» Major
e9545a72e6 Reland "Move PermissionsPolicyFeature from Blink to the Network service"
This is a reland of commit 1b851527a0

A new usage of `PermissionsPolicyFeature` appeared in the meantime.
Fixed in this CL.

Original change's description:
> Move `PermissionsPolicyFeature` from Blink to the Network service
>
> The network service is going to need access to the "storage-access"
> Permissions Policy. This is the first 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.
>
> Tha main change here is moving the `PermissionsPolicyFeature` type from
> `blink.mojom` to `network.mojom`:
> https://crrev.com/c/6180431/7/services/network/public/mojom/permissions_policy/permissions_policy_feature.mojom
>
> Bug: 382291442
> Change-Id: Ib99fbd285031936dbf40d5f210816cc775c51dfa
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6180431
> Auto-Submit: Sandor «Alex» Major <sandormajor@chromium.org>
> Reviewed-by: Ari Chivukula <arichiv@chromium.org>
> Reviewed-by: Maks Orlovich <morlovich@chromium.org>
> Owners-Override: Rick Byers <rbyers@chromium.org>
> Reviewed-by: Rick Byers <rbyers@chromium.org>
> Commit-Queue: Sandor «Alex» Major <sandormajor@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1414133}

Bug: 382291442
Change-Id: I853b73f61ab7ecd807fc3d16cd2895c353ebd126
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6219635
Auto-Submit: Sandor «Alex» Major <sandormajor@chromium.org>
Owners-Override: Rick Byers <rbyers@chromium.org>
Reviewed-by: Ari Chivukula <arichiv@chromium.org>
Reviewed-by: Maks Orlovich <morlovich@chromium.org>
Reviewed-by: Rick Byers <rbyers@chromium.org>
Commit-Queue: Sandor «Alex» Major <sandormajor@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1414345}
2025-01-31 12:40:46 -08:00
Kevin McNee
4a02d170a9 Revert "Move PermissionsPolicyFeature from Blink to the Network service"
This reverts commit 1b851527a0.

Reason for revert: Broke the build https://ci.chromium.org/ui/p/chromium/builders/ci/Linux%20MSan%20Builder/86647/overview

Original change's description:
> Move `PermissionsPolicyFeature` from Blink to the Network service
>
> The network service is going to need access to the "storage-access"
> Permissions Policy. This is the first 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.
>
> Tha main change here is moving the `PermissionsPolicyFeature` type from
> `blink.mojom` to `network.mojom`:
> https://crrev.com/c/6180431/7/services/network/public/mojom/permissions_policy/permissions_policy_feature.mojom
>
> Bug: 382291442
> Change-Id: Ib99fbd285031936dbf40d5f210816cc775c51dfa
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6180431
> Auto-Submit: Sandor «Alex» Major <sandormajor@chromium.org>
> Reviewed-by: Ari Chivukula <arichiv@chromium.org>
> Reviewed-by: Maks Orlovich <morlovich@chromium.org>
> Owners-Override: Rick Byers <rbyers@chromium.org>
> Reviewed-by: Rick Byers <rbyers@chromium.org>
> Commit-Queue: Sandor «Alex» Major <sandormajor@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1414133}

Bug: 382291442
Change-Id: I068a9cbfb77057ded4295dc214aee51bee8a503c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6219376
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Kevin McNee <mcnee@chromium.org>
Owners-Override: Kevin McNee <mcnee@google.com>
Cr-Commit-Position: refs/heads/main@{#1414150}
2025-01-31 08:22:14 -08:00
Sandor Major
1b851527a0 Move PermissionsPolicyFeature from Blink to the Network service
The network service is going to need access to the "storage-access"
Permissions Policy. This is the first 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.

Tha main change here is moving the `PermissionsPolicyFeature` type from
`blink.mojom` to `network.mojom`:
https://crrev.com/c/6180431/7/services/network/public/mojom/permissions_policy/permissions_policy_feature.mojom

Bug: 382291442
Change-Id: Ib99fbd285031936dbf40d5f210816cc775c51dfa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6180431
Auto-Submit: Sandor «Alex» Major <sandormajor@chromium.org>
Reviewed-by: Ari Chivukula <arichiv@chromium.org>
Reviewed-by: Maks Orlovich <morlovich@chromium.org>
Owners-Override: Rick Byers <rbyers@chromium.org>
Reviewed-by: Rick Byers <rbyers@chromium.org>
Commit-Queue: Sandor «Alex» Major <sandormajor@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1414133}
2025-01-31 07:48:32 -08:00
Peter Kasting
1557e5fbe4 [cleanup] Replace base::ranges with std::ranges: content/
Done entirely with `git grep` and `sed` + `git cl format`, no
hand-editing.

Bug: 386918226
Change-Id: I8561612cb02c9d62c455836dba414ab402e40694
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6199140
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Owners-Override: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1412009}
2025-01-27 17:14:08 -08:00
Sandor Major
d1bbf7751c Deduplicate permissions policy getter
RFHI's permissions_policy() and GetPermissionsPolicy() are doing the
same thing, keeping the latter as that's exposed on the RFH as well.

Bug: 382291442
Change-Id: I846764815f6adb72c6906c59d6d6810e02a5d611
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6164805
Reviewed-by: Bo Liu <boliu@chromium.org>
Commit-Queue: Sandor «Alex» Major <sandormajor@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1404447}
2025-01-09 14:49:30 -08:00
Dave Tapuska
94a6978abd [MPArch guest view] Allow User Agent overrides
Enable overriding of the user agent. Be sure to sync renderer preferences and reload the frame when the user agent changes.

Bug: 376085326
Change-Id: Icbae92e4a7964070d71f1f23414b40a5fe3d4922
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5999905
Reviewed-by: Kevin McNee <mcnee@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1386808}
2024-11-22 14:37:29 +00:00
Kalvin Lee
c1ffdb738a spanify: Array-ify kWebEffectiveConnectionTypeMapping
`spanify` wants to rewrite this constant but fails to find the size.
This CL does so manually.

While we're at it, clean up a number of `DCHECK()`s that use only
compile-time constants, deduplicating them, upgrading them to
`static_assert()`, and moving them right under the declaration of
`kWebEffectiveConnectionTypeMapping`.

Additionally, remove a legacy `DCHECK()` from
`network_state_notifier.cc`, since converting this constant to a
`std::array` also gives us bound checks, which will surface a crash just
as reliably as said `DCHECK()`.

Bug: 364338808
Change-Id: I8ae7ca4f70045f397cb41179a264e0f15413348c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6023055
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Kalvin Lee <kdlee@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1384245}
2024-11-18 11:11:25 +00:00
Mark Schillaci
7f43c6697b [Page Zoom] Remove AccessibilityPageZoom flag references
The Accessibility Page Zoom feature has shipped to 100% Stable in the
last milestone. This CL safely removes all references and checks
against the flag, since they are no longer needed.

The feature shipped with a FeatureParam set to false. We could remove
a method and all related checks, but instead we have kept that method
and the related tests around, since there may be future work to
experiment with modifying this param. We added some ForTesting methods
to make this all work since we are no longer initializing tests with
specific flag and param values.

Note: This CL will be making the FontSizePrefs flow obsolete, but that
will be removed in a follow-up CL to keep the CLs easier to review.

AX-Relnotes: N/A
Bug: 376038818
Change-Id: I7b75c6d235028602000af64cab4ff0f0bfe087c9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5970817
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Philip Rogers <pdr@chromium.org>
Reviewed-by: Amanda Lin Dietz <aldietz@google.com>
Reviewed-by: Theresa Sullivan <twellington@chromium.org>
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Commit-Queue: Mark Schillaci <mschillaci@google.com>
Cr-Commit-Position: refs/heads/main@{#1376444}
2024-10-31 17:52:26 +00:00
Ari Chivukula
139bfa4b16 [ClientHints.Viewport.IsDeviceScaleFactorOne] Remove Expired Histogram
OBSOLETE_HISTOGRAMS=Expired as of 2024-02-20 and removed as of 2024-10-25.

Change-Id: Idab35cf3d6dd252fe1e65e8d55ff76ea863a6845
Fixed: 41489677
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5966520
Reviewed-by: Max Curran <curranmax@chromium.org>
Auto-Submit: Ari Chivukula <arichiv@chromium.org>
Commit-Queue: Max Curran <curranmax@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1374128}
2024-10-25 20:57:50 +00:00
Ari Chivukula
080adbbc95 Clean up stale base::Feature "ClientHints*"
Let's remove all the flags not to be used in a deprecation that aren't
active in finch and have been enabled for a while.

Fixed: 356624414, 356624597, 356625182, 356624970, 356624950, 356625165
Change-Id: If6fbbeeb015547b5f1fc4bf7e9cb2a5df9fbcdce
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5894771
Auto-Submit: Ari Chivukula <arichiv@chromium.org>
Commit-Queue: Ari Chivukula <arichiv@chromium.org>
Reviewed-by: Peter Kvitek <kvitekp@chromium.org>
Reviewed-by: Yoav Weiss (@Shopify) <yoavweiss@chromium.org>
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1361875}
2024-09-30 17:25:21 +00:00
Avi Drissman
13d20e92ee Use an opaque type for FrameTreeNode IDs, part 14
content/browser bits

Bug: 361344235
Change-Id: I12275a6cb6864da69e7e719032bf43a1756c1744
Include-Ci-Only-Tests: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5836984
Commit-Queue: Nasko Oskov <nasko@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Auto-Submit: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1351508}
2024-09-05 16:56:30 +00:00
Adithya Srinivasan
39c819171a Portals: Remove remaining mentions in content/
Removes mentions of portals in code comments.

Bug: 40287334
Change-Id: Ia3d55f376bdbb532a3a59a8853f2fcc5a4023c1a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5679217
Commit-Queue: Adithya Srinivasan <adithyas@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1326368}
2024-07-11 20:44:21 +00:00
Stefan Zager
036a35c934 Apply consistent naming conventions to "zoom" values
Previously, "page zoom" was overloaded to refer to (1) the browser zoom
user setting and (2) the actual multiplier used in rendering arithmetic.
The first value uses a log scale and doesn't include hardware device
pixel ratio; the second value is a straight multiplier and *does*
include device pixel ratio. Some parts of the code distinguished between
these two values by referring to "(page) zoom level" for the first
value and "(page) zoom factor" for the second.

A subsequent change will add a third variable to the mix: the CSS "zoom"
property, which for the first time will affect the rendering of an
<iframe>'s content document. Browser zoom and inherited CSS zoom will
combine to produce a single "zoom level" value using the log scale;
"zoom level" will be de-log-ified and multiplied by device pixel ratio
to give a "zoom factor" used for rendering. Importantly, "zoom level"
and "zoom factor" are no longer page-level concepts; the new behavior
of CSS zoom means that two frames in the same page may have different
zoom levels and different zoom factors.

This CL attempts to bring consistent naming conventions to all
zoom-related code. In particular, the use of "page" in zoom-related
names is mostly eliminated, in favor of "browser zoom level" to describe
the browser zoom user setting and "layout zoom factor" to describe the
value used for rendering. The new naming convention can be seen most
clearly in the changes to local_frame.h and page_zoom.(h|cc).

Bug: chromium:329482480
Change-Id: I41abb9fd949f63f291487af9039391a4acc21cbc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5621488
Reviewed-by: Philip Rogers <pdr@chromium.org>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Filipa Senra <fsenra@google.com>
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
Reviewed-by: Emily Shack <emshack@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Khalid Peer <khalidpeer@chromium.org>
Commit-Queue: Stefan Zager <szager@chromium.org>
Reviewed-by: Danil Somsikov <dsv@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Reviewed-by: Denis Kuznetsov <antrim@chromium.org>
Reviewed-by: Wez <wez@chromium.org>
Reviewed-by: David Roger <droger@chromium.org>
Reviewed-by: Kevin Graney <kmg@google.com>
Cr-Commit-Position: refs/heads/main@{#1314855}
2024-06-13 20:53:34 +00:00
Nasko Oskov
ee48dfb4fa Prepare to remove //content/ from unsafe_bufers_paths.txt
Suppress unsafe buffer usage on a file-by-file basis.  Out of
approximately 5850 .cc and .h files only roughly 160 files fail
compilation with the unsafe buffers warning.

Suppress only, by inserting boilerplate into affected files. Do not
re-write any code to work around the issues. Properly fixing each file
will be done in follow-up CLs.

//content/ is not removed from unsafe_bufers_paths.txt file and will be
also done as a follow-up, so it makes potential reverts simpler.

Bug: 342213636
Change-Id: I4a936e63dea95a78951f7bfae6d5487708ae3c0b
AX-Relnotes: n/a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5608913
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Nasko Oskov <nasko@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1312393}
2024-06-08 05:13:06 +00:00
Fergal Daly
a58cd78797 Replace OverwriteHeaderPolicyForClientHints with WithClientHints.
WithClientHints returns a new instance with the hints applied.

Change-Id: I3e5c2d25213ee6003f14c1d7f8d1768837e3b9fe
Bug: 338183241
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5480647
Reviewed-by: Yoav Weiss (@Shopify) <yoavweiss@chromium.org>
Auto-Submit: Fergal Daly <fergal@chromium.org>
Reviewed-by: Ian Clelland <iclelland@chromium.org>
Reviewed-by: Vladimir Levin <vmpstr@chromium.org>
Commit-Queue: Fergal Daly <fergal@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1297865}
2024-05-08 00:23:31 +00:00
Fergal Daly
472b0b92b0 Pass a ParsedPermissionPolicy into factory methods.
This allow removing many calls to SetHeaderPolicy so that PermissionsPolicy objects do not have their allowlists or reporting endpoints modified after construction.

Change-Id: I85dee412b309bf229fcacdaf63dde11f597e7af4
Bug: 338183241
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5474264
Reviewed-by: Ian Clelland <iclelland@chromium.org>
Reviewed-by: Yoav Weiss (@Shopify) <yoavweiss@chromium.org>
Reviewed-by: Charlie Reis <creis@chromium.org>
Commit-Queue: Charlie Reis <creis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1295587}
2024-05-02 17:43:47 +00:00
Alison Gale
81f4f2c793 Migrate TODOs referencing old crbug IDs to the new issue tracker IDs
The canonical bug format is TODO(crbug.com/<id>). TODOs of the
following forms will all be migrated to the new format:

- TODO(crbug.com/<old id>)
- TODO(https://crbug.com/<old id>)
- TODO(crbug/<old id>)
- TODO(crbug/monorail/<old id>)
- TODO(<old id>)
- TODO(issues.chromium.org/<old id>)
- TODO(https://issues.chromium.org/<old id>)
- TODO(https://issues.chromium.org/u/1/issues/<old id>)
- TODO(bugs.chromium.org/<old id>)

Bug id mapping is sourced from go/chrome-on-buganizer-prod-issues.
See go/crbug-todo-migration for details.

#crbug-todo-migration

Bug: b/321899722
Change-Id: Iee14d10d544e9f0ec046117cc4ec8a55c427adc0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5469947
Reviewed-by: Darryl James <dljames@chromium.org>
Owners-Override: Alison Gale <agale@chromium.org>
Commit-Queue: Alison Gale <agale@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1290838}
2024-04-22 19:33:31 +00:00
Alison Gale
53c77f6b62 Migrate TODOs referencing old crbug IDs to the new issue tracker IDs
The canonical bug format is TODO(crbug.com/<id>). TODOs of the
following forms will all be migrated to the new format:

- TODO(crbug.com/<old id>)
- TODO(https://crbug.com/<old id>)
- TODO(crbug/<old id>)
- TODO(crbug/monorail/<old id>)
- TODO(<old id>)
- TODO(issues.chromium.org/<old id>)
- TODO(https://issues.chromium.org/<old id>)
- TODO(https://issues.chromium.org/u/1/issues/<old id>)
- TODO(bugs.chromium.org/<old id>)

Bug id mapping is sourced from go/chrome-on-buganizer-prod-issues.
See go/crbug-todo-migration for details.

#crbug-todo-migration

Bug: b/321899722
Change-Id: Iabdfea2fd5393d6bbc54390ca0c995eb2c55bbaa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5469882
Reviewed-by: Darryl James <dljames@chromium.org>
Owners-Override: Alison Gale <agale@chromium.org>
Commit-Queue: Alison Gale <agale@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1290673}
2024-04-22 15:16:27 +00:00
Alison Gale
47d1537de7 Migrate TODOs referencing old crbug IDs to the new issue tracker IDs
The canonical bug format is TODO(crbug.com/<id>). TODOs of the
following forms will all be migrated to the new format:

- TODO(crbug.com/<old id>)
- TODO(https://crbug.com/<old id>)
- TODO(crbug/<old id>)
- TODO(crbug/monorail/<old id>)
- TODO(<old id>)
- TODO(issues.chromium.org/<old id>)
- TODO(https://issues.chromium.org/<old id>)
- TODO(https://issues.chromium.org/u/1/issues/<old id>)
- TODO(bugs.chromium.org/<old id>)

Bug id mapping is sourced from go/chrome-on-buganizer-prod-issues.
See go/crbug-todo-migration for details.

#crbug-todo-migration

Bug: b/321899722
Change-Id: Ieeb461e2d489e86fd50b87a2a0721a2be34520c3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5467317
Owners-Override: Alison Gale <agale@chromium.org>
Commit-Queue: Darryl James <dljames@chromium.org>
Commit-Queue: Alison Gale <agale@chromium.org>
Reviewed-by: Darryl James <dljames@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1290198}
2024-04-19 21:31:46 +00:00
Dustin J. Mitchell
5909d3b443 Pluralize Sec-CH-UA-Form-Factor/formFactor
Per https://github.com/WICG/ua-client-hints/issues/355, this hint should
be plural since it contains a list of form factors.

Bug: 328490271
Change-Id: I36062ade29b59c38199f54e29b8ec43795c4a7d7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5353828
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Reviewed-by: Mike Taylor <miketaylr@chromium.org>
Reviewed-by: Victor Tan <victortan@chromium.org>
Reviewed-by: Bo Liu <boliu@chromium.org>
Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Dustin Mitchell <djmitche@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1271919}
2024-03-13 01:03:24 +00:00
Hiroshige Hayashizaki
560e972b34 Remove URLLoaderThrottle::Delegate::RestartWithURLResetAndFlags
Remove `defer` from
`URLLoaderThrottle::BeforeWillProcessResponse` and
`URLLoaderThrottle::BeforeWillRedirectRequest`
as they are not used.
This removes `DEFERRED_BEFORE_RESPONSE` as well.

Remove `URLLoaderThrottle::Delegate::RestartWithURLResetAndFlags`,
and instead signal a restart by setting `RestartWithURLReset` to true
in `BeforeWillProcessResponse` or `BeforeWillRedirectRequest`,
because and to clarify `RestartWithURLReset` can be set only
synchronously within these methods.

Remove `pending_restart_flags_`.
(`RestartWithURLResetAndFlags()` was always called with 0)

Remove `throttle_will_start_original_url_`
(always true when `RestartWithURLResetNow()` is called)

Remove `has_pending_restart_`, and use `RestartWithURLReset` local
variables instead, because Before* methods can no longer defer the
loading and thus restarting is processed immediately.

Bug: 325314722
Change-Id: Ia520d055966d03a2cb402f961afd837b74683796
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5149865
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org>
Reviewed-by: Lingqi Chi <lingqi@chromium.org>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1263152}
2024-02-21 05:22:20 +00:00
Victor Tan
7cb768195f Remove UserAgentClientHint feature flag
The Client hints feature has been rolled out in all platforms.

Change-Id: Ib1d3cdeccf34dc57211627278cf7485beade137d
Bug: 1518844
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5200952
Reviewed-by: Ari Chivukula <arichiv@chromium.org>
Reviewed-by: Dominic Farolino <dom@chromium.org>
Commit-Queue: Victor Tan <victortan@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Richard (Torne) Coles <torne@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1249621}
2024-01-19 22:53:24 +00:00
Ari Chivukula
4ab383b4fb [runtime enabled feature cleanup] Remove ClientHintThirdPartyDelegation
This has been launched since M100.

Bug: 1517958
Change-Id: I733b6241f446fc12fa58077fcd5d4f09c0007e6b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5197820
Auto-Submit: Ari Chivukula <arichiv@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Commit-Queue: Ari Chivukula <arichiv@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1247530}
2024-01-16 15:43:27 +00:00
Liam Brady
14c49e5487 Allow non-opaque fenced frames to inherit select permissions.
For fenced frames with unpartitioned data access, they will need to use
Shared Storage in order to read and write the unpartitioned data. They
will also need to be able to call the Private Aggregation API in order
to send reports and telemetry without running the risk of introducing a
fingerprinting vector. Both of those features are permissions
policy-backed features.

Fenced frames do not currently support permissions policies, so none of
these features will be able to be enabled. The reason we disabled
permissions policies originally was to prevent cross-channel
communication from the embedder into the fenced frame. However, fenced
frames with unpartitioned data do allow for data inflow, just not data
outflow. Because of that, we can now allow permissions policies to be
enabled on non-opaque fenced frames (i.e. fenced frames not created
using Protected Audience or Shared Storage).

This CL allows fenced frames to set and inherit permissions policies.
Only Shared Storage and Private Aggregation can be turned on. All other
permissions policies will be forced off if attempted to be enabled or
inherited, and a console warning will be output for debugging purposes.
Note that fenced frames created through Protected Audience or Shared
Storage will continue to have their existing restrictions, and this CL
will not affect their behavior.

As a feature of its architecture, MPArch does not have access to
permissions policy information in its parent on the renderer side. To
give a fenced frame that access, we need to explicitly give it that
information through the fenced frame properties. This CL adds the parent
frame's parsed permissions policies and its origin to the
FencedFrameConfig and FencedFrameProperties objects. This is done
instead of just adding the PermissionsPolicy object for IPC reasons. The
parsed permissions policies and origin can be sent in an IPC message and
are the 2 pieces needed in order to reconstruct a PermissionsPolicy on
the renderer-side.

This CL also fixes an issue where container policies for fenced frame
roots were not taken into consideration when building the permissions
policy on the renderer side.

This CL explicitly does not modify any permissions policy code related
to client hints. That will be done as a follow up if and when we choose
to allow client hints in fenced frames.

Change-Id: I00e56dc35e07e7dfa16a3b57eb40be384faa8252
Bug: 1515327
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5150117
Commit-Queue: Liam Brady <lbrady@google.com>
Reviewed-by: Dominic Farolino <dom@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1245934}
2024-01-11 17:38:35 +00:00
Arthur Sonzogni
c686e8f4fd Rename {absl => std}::optional in //content/
Automated patch, intended to be effectively a no-op.

Context:
https://groups.google.com/a/chromium.org/g/cxx/c/nBD_1LaanTc/m/ghh-ZZhWAwAJ?utm_medium=email&utm_source=footer

As of https://crrev.com/1204351, absl::optional is now a type alias for
std::optional. We should migrate toward it.

Script:
```
function replace {
  echo "Replacing $1 by $2"
  git grep -l "$1" \
    | cut -f1 -d: \
    | grep \
      -e "^content" \
    | sort \
    | uniq \
    | grep \
      -e "\.h" \
      -e "\.cc" \
      -e "\.mm" \
      -e "\.py" \
    | xargs sed -i "s/$1/$2/g"
}
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"
replace "\"third_party\/abseil-cpp\/absl\/types\/optional.h\"" "<optional>"
git cl format
```

# Skipping unrelated "check_network_annotation" errors.
NOTRY=True

Bug: chromium:1500249
Change-Id: Icfd31a71d8faf63a2e8d5401127e7ee74cc1c413
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5185537
Auto-Submit: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Owners-Override: Avi Drissman <avi@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1245739}
2024-01-11 08:36:37 +00:00
Garrett Tanzer
0698070f02 Fenced frames: Refactor FencedFrameConfig/Properties from structs to classes [1/2]
This first CL refactors FencedFrameProperties from a struct to a class.
The second one will do FencedFrameConfig.

Bug: 1417871
Change-Id: Iab0686bed2dca67293fb1ac9403b70aa185c14ef
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5095298
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Dominic Farolino <dom@chromium.org>
Commit-Queue: Garrett Tanzer <gtanzer@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1236512}
2023-12-12 19:48:20 +00:00
Dustin J. Mitchell
176f907c05 Reland "Represent form-factor client hint as a list"
This is a reland of commit bcd5a8cea9

No changes were required to re-land, as the memory regression that caused the revert was due to an error in the benchmark. However, since that commit, resubmit required adding `inline` to the contexprs in  `third_party/blink/public/common/user_agent/user_agent_metadata.h`

Original change's description:
> Represent form-factor client hint as a list
>
> Per the updated draft spec, the form-factor hint is represented as a
> list, rather than a single value.
>
> Incidentally, `""` no longer means Desktop, so that value must be
> spelled out.
>
> Bug: 1442283
> Change-Id: I11d5d87e58519afec658ceb37f6f91304fe685e2
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4852290
> Reviewed-by: Scott Violet <sky@chromium.org>
> Reviewed-by: danakj <danakj@chromium.org>
> Reviewed-by: Peter Pakkenberg <pbirk@chromium.org>
> Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
> Reviewed-by: Bo Liu <boliu@chromium.org>
> Reviewed-by: Brendon Tiszka <tiszka@chromium.org>
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Commit-Queue: Dustin Mitchell <djmitche@chromium.org>
> Reviewed-by: Victor Tan <victortan@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1214568}

Bug: 1442283
Change-Id: I302745f335a7005ff85d6ce8a0e837f269445527
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4994377
Reviewed-by: danakj <danakj@chromium.org>
Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
Reviewed-by: Bo Liu <boliu@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Brendon Tiszka <tiszka@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Commit-Queue: Dustin Mitchell <djmitche@chromium.org>
Reviewed-by: Victor Tan <victortan@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1225060}
2023-11-15 18:57:15 +00:00
Dustin Mitchell
e6b6243a43 Revert "Represent form-factor client hint as a list"
This reverts commit bcd5a8cea9.

Reason for revert: Memory regressions (bug 1495660)

Original change's description:
> Represent form-factor client hint as a list
>
> Per the updated draft spec, the form-factor hint is represented as a
> list, rather than a single value.
>
> Incidentally, `""` no longer means Desktop, so that value must be
> spelled out.
>
> Bug: 1442283
> Change-Id: I11d5d87e58519afec658ceb37f6f91304fe685e2
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4852290
> Reviewed-by: Scott Violet <sky@chromium.org>
> Reviewed-by: danakj <danakj@chromium.org>
> Reviewed-by: Peter Pakkenberg <pbirk@chromium.org>
> Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
> Reviewed-by: Bo Liu <boliu@chromium.org>
> Reviewed-by: Brendon Tiszka <tiszka@chromium.org>
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Commit-Queue: Dustin Mitchell <djmitche@chromium.org>
> Reviewed-by: Victor Tan <victortan@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1214568}

Bug: 1442283
Change-Id: I80033489c6d5e81c8cc35e0a823cf5a7348e8ef0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4974000
Auto-Submit: Dustin Mitchell <djmitche@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1214942}
2023-10-25 17:29:11 +00:00
Dustin J. Mitchell
bcd5a8cea9 Represent form-factor client hint as a list
Per the updated draft spec, the form-factor hint is represented as a
list, rather than a single value.

Incidentally, `""` no longer means Desktop, so that value must be
spelled out.

Bug: 1442283
Change-Id: I11d5d87e58519afec658ceb37f6f91304fe685e2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4852290
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Reviewed-by: Peter Pakkenberg <pbirk@chromium.org>
Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
Reviewed-by: Bo Liu <boliu@chromium.org>
Reviewed-by: Brendon Tiszka <tiszka@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Dustin Mitchell <djmitche@chromium.org>
Reviewed-by: Victor Tan <victortan@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1214568}
2023-10-25 01:04:50 +00:00
Xiaochen Zhou
86f2e710e2 Fenced frames: Fix reportEvent crash due to different Fenced Frames
properties getter implementations.

See the comment of the added test
"GetFencedFramePropertiesShouldTravseFrameTree" in
fenced_frame_browsertest.cc for a detailed explanation of the crash.

The TLDR is the FencedFrameProperties used at browser side v.s.
renderer side are different. They may end up with different result in
some cases. For example, to reproduce, see below 3 layers of nested
frames, from top to bottom:

- Fenced frame.
- Urn iframe.
- iframe.

At browser, the iframe's navigation request gets the fenced frame's
FencedFrameProperties. Because at browser side the getter does not do
a tree traversal.

At renderer, during reportEvent call, the iframe gets the urn iframe's
FencedFrameProperties. Because at renderer side the getter does a tree
traversal.

The correct semantics here should be doing a tree traversal. The reason
is in this case an urn iframe should acting as if it is a fenced frame.

The CL
1. changed `FrameTreeNode::GetFencedFrameProperties()` to do tree
traversal by default, except for partition nonce. In a FF frame tree,
all frames should operate on the root FF's partition nonce.
2. made sure browser and renderer side calls for the getter both do a
tree traversal to fix this crash.

Also added test cases to verify the change does not regress partition nonce:
1. An urn iframe nested in a fenced frame should operate on the fenced
frame's partition nonce.
2. In the above test, if there is an additional regular iframe nested
under the urn iframe, it should also operate on the fenced frame's
partition nonce.

For ClientHintsExtendedData and permission policy related usage of
FencedFrameProperties getter, both call sites are calling the getter
inside after checking the node is a fenced frame root node. In this
case it has no difference whether to do a tree traversal or not. The
FencedFrameProperties of the fenced frame node itself is returned.
Plus client hints are disabled for now. Added TODO that future tests
should cover cases similar to above.

In long term, urn iframe support will be deprecated. This will make
the algorithm much simpler. This parameter to the getter can be
removed entirely then.

Bug: 1470634
Change-Id: Ibdc56dd8263a1cee129afd14631113ec4b9f556d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4775457
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Commit-Queue: Xiaochen Zhou <xiaochenzh@chromium.org>
Reviewed-by: Garrett Tanzer <gtanzer@chromium.org>
Reviewed-by: Liam Brady <lbrady@google.com>
Cr-Commit-Position: refs/heads/main@{#1196205}
2023-09-13 19:55:04 +00:00
Arthur Sonzogni
bdeca8e234 Privatize content features.
There are two headers to declare features in content.
- the public one: `content/public/common/content_features.h`
- the private one: `content/common/features.h`.

Unfortunately, most are declared in the public one, despite being used
privately exclusively. This violate the `content/public/` rules. This
patches provides a fix.

Parts of this patch was made programmatically using this script:
https://paste.googleplex.com/6699322946093056, with the following
output: https://paste.googleplex.com/5591288895242240

This patch:
1. Update `docs/how_to_add_your_feature_flag.md` to incentive
   developers to the non public versions.
2. Move ~70 features back into the private version.
3. Programmatically update the includes to include the correct
   #include header(s).
4. For consistency and minimizing the amount of files modified,
   the two headers to use the `features::` namespace.

AX-Relnotes: n/a.
Change-Id: Id9126a95dfbc533d4778b188b659b5acc9b3d9e3
Bug: None
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4836057
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1194718}
2023-09-11 08:32:12 +00:00
Luke Warlow
86339296c2 Implement Sec-CH-Prefers-Reduced-Transparency
The `Sec-CH-Prefers-Reduced-Transparency` client hint is modeled after
the `prefers-reduced-transparency` user preference media feature as
defined in Media Queries 5.

Intent to prototype: https://groups.google.com/a/chromium.org/g/blink-dev/c/GFHrc2-lOo8

Bug: 1466423
Change-Id: I7b1e37d879dcc05b19475ba184daf28275d6ae9e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4705483
Reviewed-by: Nate Fischer <ntfschr@chromium.org>
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Reviewed-by: Ari Chivukula <arichiv@chromium.org>
Reviewed-by: Mike Taylor <miketaylr@chromium.org>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Luke <lukewarlow156@gmail.com>
Cr-Commit-Position: refs/heads/main@{#1188705}
2023-08-26 16:55:25 +00:00
Dustin J. Mitchell
434a18c526 Add the Sec-CH-UA-Form-Factor header (re-land)
As described in https://wicg.github.io/ua-client-hints/#sec-ch-ua-form-factor

This is protected by the ClientHintsFormFactor feature flag, which is
disabled by default, so the CL introduces no new behavior. There are
still several open questions about the header, but this initial
implementation should make a suitable starting point regardless of how
those are decided.

This does _not_:
 * Add the hint to devtools (this can wait until more questions are answered).

This is a re-land of crrev.com/c/4558705.

Bug: 1442283
Change-Id: Id57fb319fa51bdde58aaba7b8fb7946a244aa448
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4628277
Reviewed-by: Bo Liu <boliu@chromium.org>
Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
Reviewed-by: Brendon Tiszka <tiszka@chromium.org>
Commit-Queue: Dustin Mitchell <djmitche@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Yoav Weiss <yoavweiss@chromium.org>
Reviewed-by: Victor Tan <victortan@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1161224}
2023-06-22 15:32:36 +00:00
Hailey Wang
5a2f1efdc6 Revert "Add the Sec-CH-UA-Form-Factor header"
This reverts commit 3aa4fb98a4.

Reason for revert: Causing test failures in ClientHints https://bugs.chromium.org/p/chromium/issues/detail?id=1456453

Original change's description:
> Add the Sec-CH-UA-Form-Factor header
>
> As described in https://wicg.github.io/ua-client-hints/#sec-ch-ua-form-factor
>
> This is protected by the ClientHintsFormFactor feature flag, which is
> disabled by default, so the CL introduces no new behavior. There are
> still several open questions about the header, but this initial
> implementation should make a suitable starting point regardless of how
> those are decided.
>
> This does _not_:
>  * Add the hint to devtools (this can wait until more questions are answered).
>
> Bug: 1442283
> Change-Id: I964200563ad1f3dea3a8a7a59afc03b5d23f9cf3
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4558705
> Reviewed-by: Ken Buchanan <kenrb@chromium.org>
> Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
> Reviewed-by: Yoav Weiss <yoavweiss@chromium.org>
> Commit-Queue: Dustin Mitchell <djmitche@chromium.org>
> Reviewed-by: Ari Chivukula <arichiv@chromium.org>
> Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
> Reviewed-by: Brendon Tiszka <tiszka@chromium.org>
> Reviewed-by: Victor Tan <victortan@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1160067}

Bug: 1442283
Change-Id: Idba5177bfdc46c89c5625663677f73c9d23f75cb
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4628153
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Hailey Wang <haileywang@google.com>
Owners-Override: Hailey Wang <haileywang@google.com>
Commit-Queue: Hailey Wang <haileywang@google.com>
Cr-Commit-Position: refs/heads/main@{#1160180}
2023-06-20 18:59:50 +00:00
Dustin J. Mitchell
3aa4fb98a4 Add the Sec-CH-UA-Form-Factor header
As described in https://wicg.github.io/ua-client-hints/#sec-ch-ua-form-factor

This is protected by the ClientHintsFormFactor feature flag, which is
disabled by default, so the CL introduces no new behavior. There are
still several open questions about the header, but this initial
implementation should make a suitable starting point regardless of how
those are decided.

This does _not_:
 * Add the hint to devtools (this can wait until more questions are answered).

Bug: 1442283
Change-Id: I964200563ad1f3dea3a8a7a59afc03b5d23f9cf3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4558705
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Yoav Weiss <yoavweiss@chromium.org>
Commit-Queue: Dustin Mitchell <djmitche@chromium.org>
Reviewed-by: Ari Chivukula <arichiv@chromium.org>
Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
Reviewed-by: Brendon Tiszka <tiszka@chromium.org>
Reviewed-by: Victor Tan <victortan@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1160067}
2023-06-20 16:10:15 +00:00
Victor Tan
b37a4c8219 Remove OT client hints and UA reduction OT for embed requests
In order to enabled the UA Reduction/Deprecation origin trial for embed requests (both first-party and third-party), we introduced two client hints: Sec-CH-UA-Reduced/Sec-CH-UA-Full. We accomplished this by persisting Sec-CH-UA-Reduced/Sec-CH-UA-Full from an embed response headers if a valid Origin Trial token is present.

As we completed the UA reduction origin trials, Sec-CH-UA-Reduced and Sec-CH-UA-Full are no longer be persisted in any context, they should be removed and be simplified. For all future similar origin trials, we prefer to use Persistent Origin Trials.

This CL remove the two origin trial client hints: Sec-CH-UA-Reduced and Sec-CH-UA-Full and simplify the client hints logics when parsing
ACCEPT-CH headers. It also refactors corresponding tests to make the user-agent reduction behavior depending on the UA reduction phases' features.


The following up cls will:
 * Remove UA reduction origin trial for service worker
 * Remove UA reduction origin trial for all requests

Change-Id: I474122a36ec633d5589e8dfc5f11f31916a40863
Bug: 1258063
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4551662
Reviewed-by: Ari Chivukula <arichiv@chromium.org>
Reviewed-by: Bo Liu <boliu@chromium.org>
Reviewed-by: Colin Blundell <blundell@chromium.org>
Commit-Queue: Victor Tan <victortan@chromium.org>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Luc Nguyen <lucnguyen@google.com>
Reviewed-by: Yoav Weiss <yoavweiss@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1154936}
2023-06-08 16:18:28 +00:00
Hiroki Nakagawa
e2e4558d56 Prerender: Clean up PrerenderHost::GetPrerenderHostFromFrameTreeNode()
This is a follow-up of a review comment on crrev.com/c/4570158. For code
simplification, this CL does...

- rename PrerenderHost::GetPrerenderHostFromFrameTreeNode() to
  GetFromFrameTreeNodeIfPrerendering(). This function is similar to
  GetFromFrameTreeNode(), but it returns nullptr if a given
  FrameTreeNode is not being prerendered.
- let GetFromFrameTreeNodeIfPrerendering() return a valid PrerenderHost
  even when prerendering has already been canceled as long as its
  FrameTreeNode is accessible.

Bug: 1355279
Change-Id: I6a1fc2b0e92d2a1d82f93b02ee5316a2c6929181
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4583320
Reviewed-by: Yoav Weiss <yoavweiss@chromium.org>
Reviewed-by: Lingqi Chi <lingqi@chromium.org>
Commit-Queue: Hiroki Nakagawa <nhiroki@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1154289}
2023-06-07 07:54:48 +00:00
Max Curran
0d344cfe08 Fix crash when getting viewport size client hints for a subframe.
When getting the viewport size of a subframe for client hints, the
DCHECK in RenderWidgetHostViewChildFrame::GetVisibleViewportSize() would
be triggered. This CL fixes that by always calling GetMainFrame() first
before getting the RenderWidgetHostView.

Bug: 1430329
Change-Id: I924f1594d2faa3d51b5db5f28fd678ef1ae2e219
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4559151
Reviewed-by: Ari Chivukula <arichiv@chromium.org>
Commit-Queue: Max Curran <curranmax@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1149254}
2023-05-25 18:31:18 +00:00
Liam Brady
ca697ff437 Fenced frame: permissions refactor to match spec.
While writing the fenced frame spec for permissions policy interaction,
we decided to change the behavior to only allow a fenced frame to load
if the required permissions to load was enabled for *all* origins,
instead of just if the permissions were enabled for the origin of the
document being loaded into a fenced frame. This makes the spec simpler
and eliminates a weird corner case where a fenced frame could fail
when trying to navigate itself to a different origin, causing the ad to
break.

This CL reflects those changes in the implementation.

As part of this change, fenced frames created through an API that
navigate themselves to a cross-origin page need to know what the list of
required permissions was in the config. Currently, the redacted config
is not given to document that is cross-origin to the config's mapped
url. This CL modifies the behavior to give cross-origin documents access
to the config to calculate their permissions policies, but in a way that
prevents them from accessing the window.fence APIs. This does that by
introducing a new `VisibilityToContent`, `kTransparentForAllOrigins`,
which allows both same-origin and cross-origin documents to see a given
field. The existing `kTransparent` visibility will now only make fields
transparent if the document is same-origin to the mapped url.

Change-Id: I00acb013076d527e482b3ce8f4bd0e45a93c5cf8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4514455
Reviewed-by: Dominic Farolino <dom@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Liam Brady <lbrady@google.com>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Garrett Tanzer <gtanzer@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1148161}
2023-05-23 21:03:21 +00:00
Ari Chivukula
68ba0c7da4 [Client Hints] Implement criticalCHRestart timing field
This timestamp allows developers to understand the cost of a Critical-CH
HTTP Header related restart in the load of a page. This is behind an
experimental realtime feature and tested in WPTs. The ongoing launch is:
https://groups.google.com/a/chromium.org/g/blink-dev/c/f28WWMD8HVE/

Bug: 1425910
Change-Id: I68e3a6b9d37f3e11cb3b27469321106940aa1246
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4538244
Auto-Submit: Ari Chivukula <arichiv@chromium.org>
Reviewed-by: Nick Harper <nharper@chromium.org>
Commit-Queue: Nick Harper <nharper@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1146593}
2023-05-19 18:09:59 +00:00
Victor Tan
969e157349 Fix origin trial client hints overwrite existing accept-ch cache
As initial design, we only allow the main frame should parse accept-CH.
However, to support the one-off origin trial client hints
https://crrev.com/c/3179447, we allow to parse the origin trial client
hints in embedded frame. Also, we only support full update for the Accept-ch Cache to avoid the unnecessary prefs read.

When the embedded frame opt-in the user-agent reduction origin trial, it will try to do a full update to overwrite the existing main frame Accept-ch cache. This might cause problem to send client hints for embedded iframe subresource requests because the embedded iframe overwrite the existing accept-ch cache and the cache will only contains the origin trial client hints.

Instead of overwrite the accept-ch cache, we only allow to append the origin trial client hints to existing accept-ch cache. To avoid any performance regression, it only appends when embedded iframe response accept-ch header has origin trial hints and a valid origin trial token.

Change-Id: If985a5deb04a12209dd2124b4f347d83ab52c965
Bug: 1446805
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4547454
Commit-Queue: Victor Tan <victortan@chromium.org>
Reviewed-by: Ari Chivukula <arichiv@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1146582}
2023-05-19 17:49:28 +00:00