0
Commit Graph

831 Commits

Author SHA1 Message Date
Jonathan Hao
3e33cb08b8 [Private Network Access] Log UseCounter for WebSocket
Delegate the OnConnected from net to the network service, which then
makes an IPC call to content browser which can then log the use counter
to the right frame.

Bug: 40234396
Change-Id: Ie9cf91aad6614ac28b117a5c51009e096d1fed7f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5291080
Auto-Submit: Jonathan Hao <phao@chromium.org>
Reviewed-by: Gary Kacmarcik <garykac@chromium.org>
Commit-Queue: Jonathan Hao <phao@chromium.org>
Reviewed-by: Mike West <mkwst@chromium.org>
Reviewed-by: Theresa Sullivan <twellington@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: Adam Rice <ricea@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1269153}
2024-03-06 19:36:01 +00:00
Sharon Yang
302213dc65 Introduce a general navigation state keep alive object
This moves the keepalive behaviour that was previously on
PolicyContainerHost to a separate NavigationStateKeepAlive class. The
Blink mirror mojo remote mechanism remains the same, but the definitions
have moved.
There is now one mojo UniqueReceiverSet per storage partition.
Previously, there was one per PolicyContainerHost (and thus
RenderFrameHost). This UniqueReceiverSet can have receivers for multiple
RenderFrameHosts, and multiple receivers per RenderFrameHost (e.g., for
multiple queued navigations).

behaviour change

Test: Covered by NavigationBrowserTest.FormSubmission* tests, minimal
Bug: 323753235
Change-Id: If120e495c228d687e3624d53344e72b5e8cacbeb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5278216
Reviewed-by: Charlie Reis <creis@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Antonio Sartori <antoniosartori@chromium.org>
Commit-Queue: Sharon Yang <yangsharon@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1269131}
2024-03-06 19:03:44 +00:00
Vikram Pasupathy
edd7591f93 [Browsing Data Model] Add CdmStorageDataModel interface
As part of the effort to integrate the CdmStorageDatabase with the
BrowsingDataModel, we add an interface CdmStorageDataModel to expose
functions that are requisite in the integration with BrowsingDataModel.

Implementation will be done in another CL.

Bug: 1454512
Change-Id: I848a9d9610a68026bde6c3a5e10d5588af2c1ba6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5296881
Commit-Queue: Vikram Pasupathy <vpasupathy@chromium.org>
Reviewed-by: John Rummell <jrummell@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Bo Liu <boliu@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1263755}
2024-02-22 02:28:58 +00:00
Daniel Vogelheim
be92f4cc2f Rename URLLoaderFactoryParams::is_corb_enabled to is_orb_enabled.
This is part of cleanup work to remove CORB code, now that its successor ORB has been enabled. This particular CL is a rename, and should be functionally neutral.

Bug: 324418206
Change-Id: I77143b897e4957a41e21c59630f1dd5a2575866a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5277040
Reviewed-by: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: Kenichi Ishibashi <bashi@chromium.org>
Commit-Queue: Daniel Vogelheim <vogelheim@chromium.org>
Reviewed-by: Mihai Sardarescu <msarda@chromium.org>
Reviewed-by: Sean Topping <seantopping@chromium.org>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Colin Blundell <blundell@chromium.org>
Reviewed-by: Alex Turner <alexmt@chromium.org>
Reviewed-by: Mike Dougherty <michaeldo@chromium.org>
Reviewed-by: Nate Fischer <ntfschr@chromium.org>
Reviewed-by: Matt Mueller <mattm@chromium.org>
Reviewed-by: Finnur Thorarinsson <finnur@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1260357}
2024-02-14 10:03:33 +00:00
John Abd-El-Malek
f2592dba26 Reduce large includes in storage_partition_impl.h
The issue is that render_frame_host_impl.h is very large [1], and the biggest include by an order of a magnitude is storage_partition_impl.h. The biggest two includes there by more than an order of a magnitude are network_context.mojom and cert_verifier_service.mojom [2]. The former is needed because StoragePartitionImpl derives from NetworkContextClient, which this cl moves to a separate mojom, and mojo::Remote<NetworkContext> which is moved to a forward declared inner class. The latter is needed for CertVerifierServiceUpdater which is likewise moved to its own file.

[1] https://commondatastorage.googleapis.com/chromium-browser-clang/chrome_includes_2024-02-08_120812.html#view=edges&filter=%5Econtent%2Fbrowser%2Frenderer_host%2Frender_frame_host_impl%5C.h%24&sort=asize&reverse=&includer=%5Econtent%2Fbrowser%2Frenderer_host%2Frender_frame_host_impl%5C.h%24&included=&limit=1000
[2] https://commondatastorage.googleapis.com/chromium-browser-clang/include-analysis.html#view=edges&filter=%5Econtent%2Fbrowser%2Fstorage_partition_impl%5C.h%24&sort=asize&reverse=&includer=%5Econtent%2Fbrowser%2Fstorage_partition_impl%5C.h%24&included=&limit=1000

Bug: 324512302
Change-Id: I9ed249738f9a15f3415f8bae26c58565d9fbda78
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5280714
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Owners-Override: John Abd-El-Malek <jam@chromium.org>
Auto-Submit: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1259050}
2024-02-12 07:20:23 +00:00
Hiroshige Hayashizaki
c6b293d0af Introduce url_loader_factory::GetInterceptor
To merge the similar callbacks in
`RenderProcessHost`, `StoragePartitionImpl`,
`NavigationURLLoaderImpl`, and `ServiceWorkerContextWrapper`.

Bug: 1506871
Change-Id: I719f0ff1a2cf228070dd87b5181a6d749f4ff899
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5149450
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Reviewed-by: Lingqi Chi <lingqi@chromium.org>
Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1253098}
2024-01-28 13:18:04 +00:00
Hiroshige Hayashizaki
06ac664641 Introduce URLLoaderInterceptor::Wrapper
To simplify the code, this CL merges `URLLoaderInterceptor`'s
`BrowserProcessWrapper`, `RenderProcessHostWrapper` and
`URLLoaderFactoryNavigationWrapper` into a single `Wrapper`.

This CL also migrates related callbacks to use
`network::URLLoaderFactoryBuilder`.

Bug: 1506871
Change-Id: I91111bfb9c9e45a3c26a515789c967ff24e8661e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5148395
Reviewed-by: Lingqi Chi <lingqi@chromium.org>
Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1253091}
2024-01-28 10:57:21 +00:00
Erik Chen
7776c8d32e Clean up StoragePartitionImpl. Part 2.
This CL is a refactor with no intended behavior change.

This CL replaces SSLClientAuthHandler::ContextGetter with base::WeakPtr.
This CL makes URLLoaderNetworkContext private. This CL deletes
now-unnecessary wrapper functions GetContextFromStoragePartition and
GetBrowserContextFromStoragePartition.

Bug: 1371177
Change-Id: I4bc5c43be8933dc5337f0e38004d69747d0d5957
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5214875
Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
Commit-Queue: Erik Chen <erikchen@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1251234}
2024-01-24 04:46:11 +00:00
Erik Chen
24c4f8893c Clean up StoragePartitionImpl. Part 1.
This CL is a refactor with no intended behavior change.

This CL replaces usage of web_contents_getter and browser_context_getter
with WeakPtrs in several content classes. This removes several potential
sources of UaFs.

Change-Id: I831c3f51730386146433726ce5f3efba08288616
Bug: 1371177
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5208248
Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
Commit-Queue: Erik Chen <erikchen@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1249178}
2024-01-19 01:30:46 +00:00
Erik Chen
0c0134982e Allow extensions to intercept HttpAuth from ServiceWorkers
This CL modifies CreateAuthCertObserverForServiceWorker to store the
RenderProcessHost's process_id. This is passed to the http auth handler
which will let extensions fill in the info for http auth. This fixes bug
1371177.

Change-Id: Iadbb19184922a861d0cbf83b9d58028d7d5508b6
Bug: 1371177
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5183565
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
Commit-Queue: Erik Chen <erikchen@chromium.org>
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1249074}
2024-01-18 22:06:50 +00:00
Erik Chen
db55c037ea Improve LoginHandler (Part 10 / N)
This CL updates AwHttpAuthHandler::CreateLoginDelegate() to handle null
WebContents as input. The class already handles WebContents becoming
null later. All other implementations of CreateLoginDelegate() already
handle null WebContents as input.

This CL removes the indirection web_contents_getter, which added
complexity but was functionally equivalent to base::WeakPtr. The
functionality was added in this CL with no explanation:
https://chromium-review.googlesource.com/c/chromium/src/+/877512.

Bug: 1371177
Change-Id: I56f197c6c27ef499d8087a91c5b93dee6507c1c1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5180166
Commit-Queue: Erik Chen <erikchen@chromium.org>
Reviewed-by: Richard (Torne) Coles <torne@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1246266}
2024-01-12 05:28:37 +00:00
Erik Chen
7cc967a7c0 Improve LoginHandler (Part 9 / N)
This CL is a refactor with no intended behavior change.

This CL modifies CreateLoginDelegate to pass in a BrowserContext. This
is always set, unlike WebContents, which will not be set in the future
for ServiceWorkers.

Change-Id: Ia6c7f1fb6582d1f8989ead805ca48c5614fdb726
Bug: 1371177
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5181931
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Takumi Fujimoto <takumif@chromium.org>
Commit-Queue: Erik Chen <erikchen@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Richard (Torne) Coles <torne@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1246199}
2024-01-12 03:24:28 +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
Kenichi Ishibashi
cd28cc12b8 Remove ResourceCache
We don't pursue this feature any longer.

OBSOLETE_HISTOGRAMS=Blink.MemoryCache.Remote.IsInCache.{Destination}=No longer needed
OBSOLETE_HISTOGRAMS=Blink.MemoryCache.Remote.{Visibility}.{LifecycleState}.IPCRecvDelay=No longer needed
OBSOLETE_HISTOGRAMS=Blink.MemoryCache.Remote.{Visibility}.{LifecycleState}.IPCSendDelay=No longer needed

Bug: 1512779,1512780,1414262
Change-Id: Id4fcb8c92cedd771566d6a9ec2b066e4b5c10d65
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5171390
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Reviewed-by: Takashi Toyoshima <toyoshim@chromium.org>
Commit-Queue: Kenichi Ishibashi <bashi@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1244505}
2024-01-09 07:40:23 +00:00
Vikram Pasupathy
2cd0591870 Implement new schema and time based removal into CdmStorageDatabase
A new schema is introduced into CdmStorageDatabase to add last_modified
and file_size to be able to support time-based deletion and time-based
usage calculation.

Methods were implemented to delete by time frame, by storage key, and
to calculate file size using SQL queries for time frames by storing
the file size into the CdmStorageDatabase to be a one time operation.

This CL also provides the functionality that automatically deletes the
database if a Delete function for a subset (i.e file, storage key,
time-frame) ends up removing entries such that there are no more entries
in the database.

An SQL statement is used to alter the version1 database so that we don't
run into crashes when a user that already has the CdmStorageDatabase
v1.0 in their profile runs into queries that are made for the v2.0, such
as writing into the column file_size, since file_size is only in v2.0.

Testing: unittests +

Manual Testing Steps for the Schema Alter code:
1. Build chrome on main branch.
2. Go to chrome://flags and enable kCdmStorageDatabase and
kCdmStorageDatabaseMigration.
3. Open a new profile, name it CdmStorageDatabase (or anything you want)
4. Play this website: https://integration.staging.widevine.com/player?contentUrl=https://storage.googleapis.com/wvtemp/hmchen/poc/tears_hd_cenc.mpd&proxyServerUrl=https://proxy.uat.widevine.com/proxy?video_id=GTS_CAN_PLAY_CLIENT_TOKEN%26provider=widevine_test%26full_response=true&persistentStateRequired=true
5. Log the kVersionNumber (should be 1) (I did this through LOG(ERROR)).
6. A value should be written.
7. Quit Chrome.
8. Switch your branch to these changes using git and build chrome.
9. Open chrome, verify the same flags are still enabled, and open
the same profile you used as before.
10. Play same website as step .
11. log the kVersionNumber (should be 2) (I did this through LOG(ERROR))
12. View in chrome://histograms/Media.EME that the
IncompatibleDatabaseDetected histogram was triggered.
13. Verify that playback plays continuously and Chrome does not crash.

OBSOLETE_HISTOGRAMS= Media.EME.CdmStorageManager.DeleteDatabaseError.Incognito, Media.EME.CdmStorageManager.DeleteDatabaseError.NonIncognito.

Bug: 1454512
Change-Id: I64f9dff580114545ececf5d7b4f03124b1f55192
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4994868
Reviewed-by: Evan Stade <estade@chromium.org>
Reviewed-by: Evan Liu <evliu@google.com>
Reviewed-by: John Rummell <jrummell@chromium.org>
Commit-Queue: Vikram Pasupathy <vpasupathy@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1242731}
2024-01-04 01:06:06 +00:00
Anthony Garant
bb769fcc7f Record metric when 3pcd label header is added
Recorded only for requests where a 3pcd facilitated testing is enabled
(the client is part of the experiment and the profile is not guest or
incognito).

The metrics records:
- `kSet` if the `Sec-Cookie-Deprecation` header is added to the request.
- `kNoLabel` if there is no label available. This happens when the
   client is ineligible to the experiment or when the label value
   configured in the experiment is empty &quot;&quot;
-`kNoCookie` if there is a label available but the opt-in cookie is not
  available.

Change-Id: I2c1d533335f0d0e817109481510cedb4199208bc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5115112
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Kenichi Ishibashi <bashi@chromium.org>
Commit-Queue: Anthony Garant <anthonygarant@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1242406}
2024-01-03 14:16:33 +00:00
Camillia Smith Barnes
0e416b3d3b Shared Storage: Browser PermissionsPolicy check for headers
We pay down some tech debt by adding a browser-side
`PermissionsPolicy` check for the
`blink::mojom::PermissionsPolicyFeature::kSharedStorage` feature
in the cases where the initial check was done by the renderer.

For the iframe navigation case, however, since the initial
permissions policy check for shared storage writing from an iframe
navigation request already occurs in the browser process in
`NavigationRequest`, it's not absolutely necessary to do a double
check, and so if we are unable to perform one due to not being able
to obtain the parent policy, we skip the check and proceed with the
operation(s). Whereas, in non-navigation-initiated cases, if we are
unable to perform the check, we drop any operation(s).

While we're at it, we pass in the `NavigationOrDocumentHandle` to
`SharedStorageHeaderObserver::HeaderReceived()` instead of the
`RenderFrameHost`, and add a method
`NavigationOrDocumentHandle::GetTopFrameOrigin()`, to try to avoid
having to create a new opaque origin for the user profile preferences
check in the case when a `RenderFrameHost` is not available to help us
access the main frame's last committed origin.

We also add a couple of metrics related to the above.

Note that in "SharedStorageHeaderObserverTest", we swap out the
`ContentBrowserClient` for a derived `MockContentBrowserClient`
instance to control the return value of
`MockContentBrowserClient::IsSharedStorageAllowed()`.

Bug: 1434529,1218540
Change-Id: I7020626511215bbfc1972e6a3fddef5432b95cd1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4944272
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Reviewed-by: Yao Xiao <yaoxia@chromium.org>
Commit-Queue: Cammie Smith Barnes <cammie@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1239898}
2023-12-20 23:40:10 +00:00
Russ Hamilton
a383ea6f05 Fix Dangling reference in InterestGroupKAnonymityManager
Change the raw_ptr to the KAnonymityServiceDelegate to instead use a
repeating callback. This ensures the InterestGroupKAnonymity Manager
cannot reference the pointer after it has been freed.

Bug: 1506985
Change-Id: I1e2f99822d6063a0c76e887e25dddaabb0ef551c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5083205
Reviewed-by: Caleb Raitto <caraitto@chromium.org>
Commit-Queue: Ayu Ishii <ayui@chromium.org>
Reviewed-by: Ayu Ishii <ayui@chromium.org>
Auto-Submit: Russ Hamilton <behamilton@google.com>
Cr-Commit-Position: refs/heads/main@{#1233038}
2023-12-04 22:55:33 +00:00
Evan Stade
983fc08f8c Revert "IndexedDB: simplify IndexedDBControlWrapper"
This reverts commit 4a7009a1bd.

Reason: caused perf regression. Will investigate and re-land when time
permits.

Bug: 1506465
Change-Id: Ice2b8d46ac28de7032340fb43a82c8050742fe33
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5077710
Reviewed-by: Nathan Memmott <memmott@chromium.org>
Commit-Queue: Evan Stade <estade@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1231599}
2023-11-30 23:24:23 +00:00
Evan Stade
4a7009a1bd IndexedDB: simplify IndexedDBControlWrapper
IndexedDBControlWrapper was an IndexedDBControl implementation that
simply passed through all operations to an underlying IndexedDBControl
(IndexedDBContextImpl). The only functionality that it added was to
interact with the SpecialStoragePolicy whenever a new IndexedDBFactory
connection is established.

It's simpler and more idiomatic to accomplish this by being an
observer of the underlying IndexedDBContextImpl rather intercepting
messages meant for the IndexedDBContextImpl. Luckily, such an observer
interface already exists.

Bug: 717812
Change-Id: If7adf390cb34dc52e35fa4a27983f3d8a283fb00
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5069675
Reviewed-by: Nathan Memmott <memmott@chromium.org>
Commit-Queue: Evan Stade <estade@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1231011}
2023-11-30 00:08:13 +00:00
Jason Lin
7f2ec34903 Update some accessors of StoragePartition(Config)
... to be const or to return const reference.

Change-Id: I09c203edec4b093ad04c8a56edfbebb96f860d70
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5055979
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Commit-Queue: Jason Lin <lxj@google.com>
Auto-Submit: Jason Lin <lxj@google.com>
Cr-Commit-Position: refs/heads/main@{#1229697}
2023-11-28 03:02:56 +00:00
Matt Mueller
f783962d1b Reapply "Refactor how additional certificates are configured."
Originally landed in commit 264e35de52
and was reverted in commit 9192ea3942 due
to a test failure.

Updated with changes to policy_certs_browsertest.cc to
address possible sources of flake.

Original CL description:
Previously they were set through CertVerifier::Config and passed into
CertVerifyProc::Verify on every verification attempt. This also means
they needed to be passed from the browser to the network service on
configuration, and then passed back to the cert verifier service on
every verification attempt.

The new flow stores them in the CertVerifyProc instance and uses the
CertVerifierWithUpdatableProc interface to update them.

(this CL borrows some of the CertVerifierServiceUpdater parts from https://chromium-review.googlesource.com/c/chromium/src/+/4909292)

Bug: 1477317,1427326,978854
Change-Id: Ia64c2af672dc29b473eaa11ad1f5b663ffeaf3b7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5015687
Reviewed-by: Chris Thompson <cthomp@chromium.org>
Reviewed-by: Matthew Denton <mpdenton@chromium.org>
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Commit-Queue: Matt Mueller <mattm@chromium.org>
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Reviewed-by: Tsuyoshi Horo <horo@chromium.org>
Reviewed-by: David Trainor <dtrainor@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1223813}
2023-11-13 20:23:15 +00:00
Matt Mueller
9192ea3942 Revert "Refactor how additional certificates are configured."
This reverts commit 264e35de52.

Reason for revert: Builder  linux-lacros-tester-rel is failing, see
https://bugs.chromium.org/p/chromium/issues/detail?id=1500787

Original change's description:
> Refactor how additional certificates are configured.
>
> Previously they were set through CertVerifier::Config and passed into
> CertVerifyProc::Verify on every verification attempt. This also means
> they needed to be passed from the browser to the network service on
> configuration, and then passed back to the cert verifier service on
> every verification attempt.
>
> The new flow stores them in the CertVerifyProc instance and uses the
> CertVerifierWithUpdatableProc interface to update them.
>
> (this CL borrows some of the CertVerifierServiceUpdater parts from https://chromium-review.googlesource.com/c/chromium/src/+/4909292)
>
> Bug: 1477317,1427326,978854
> Change-Id: I802d1bb05e999b97bbbec2a80566ca7cf429b774
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4957815
> Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
> Reviewed-by: David Trainor <dtrainor@chromium.org>
> Commit-Queue: Matt Mueller <mattm@chromium.org>
> Reviewed-by: Matthew Denton <mpdenton@chromium.org>
> Reviewed-by: Ken Buchanan <kenrb@chromium.org>
> Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
> Cr-Commit-Position: refs/heads/main@{#1221751}

Bug: 1477317,1427326,978854, 1500719
Change-Id: I92e840223dea1298a4570ce7ddf1490add0d7986
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5014407
Auto-Submit: Sophia Lin <sophialin@google.com>
Reviewed-by: Sophia Lin <sophialin@google.com>
Owners-Override: Sophia Lin <sophialin@google.com>
Commit-Queue: Sophia Lin <sophialin@google.com>
Cr-Commit-Position: refs/heads/main@{#1221994}
2023-11-09 00:56:42 +00:00
Matt Mueller
264e35de52 Refactor how additional certificates are configured.
Previously they were set through CertVerifier::Config and passed into
CertVerifyProc::Verify on every verification attempt. This also means
they needed to be passed from the browser to the network service on
configuration, and then passed back to the cert verifier service on
every verification attempt.

The new flow stores them in the CertVerifyProc instance and uses the
CertVerifierWithUpdatableProc interface to update them.

(this CL borrows some of the CertVerifierServiceUpdater parts from https://chromium-review.googlesource.com/c/chromium/src/+/4909292)

Bug: 1477317,1427326,978854
Change-Id: I802d1bb05e999b97bbbec2a80566ca7cf429b774
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4957815
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Reviewed-by: David Trainor <dtrainor@chromium.org>
Commit-Queue: Matt Mueller <mattm@chromium.org>
Reviewed-by: Matthew Denton <mpdenton@chromium.org>
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1221751}
2023-11-08 18:28:48 +00:00
Evan Stade
fe1a3a3007 IndexedDB: remove fake clock from some tests
Use TaskEnvironment's mock time instead.

Bug: none

Change-Id: I8ec72945dcea18029e6a64e184244f5e083d76e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4974856
Commit-Queue: Evan Stade <estade@chromium.org>
Reviewed-by: Ayu Ishii <ayui@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1218266}
2023-11-01 16:44:43 +00:00
Scott Haseley
b9f433618d Revert "StoragePartition: Move shutdown to OnBrowserContextWillBeDestroyed"
This reverts commit 0e675843e1.

Reason for revert: this is causing some crashes, most likely due to
async OTR profile deletion.

Original change's description:
> StoragePartition: Move shutdown to OnBrowserContextWillBeDestroyed
>
> Follow-up from crrev.com/c/4869214. This moves shutting down of
> services in ~StoragePartitionImpl to OnBrowserContextWillBeDestroyed.
> Doing this earlier will prevent other dangling pointer issues related
> to browser context (including fixing one in StoragePartitionImpl), and
> it consolidates shutdown.
>
> Bug: 1492282
> Change-Id: I57e1e439ad715df6625ef011c1a99a76051fac2e
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4968658
> Commit-Queue: Scott Haseley <shaseley@chromium.org>
> Reviewed-by: Ayu Ishii <ayui@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1215818}

Bug: 1492282, 1497693
Change-Id: Id8b4fdc3989299886caa13277d1b7311cef79007
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4990213
Reviewed-by: Ayu Ishii <ayui@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Scott Haseley <shaseley@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1217729}
2023-10-31 17:56:09 +00:00
Scott Haseley
0e675843e1 StoragePartition: Move shutdown to OnBrowserContextWillBeDestroyed
Follow-up from crrev.com/c/4869214. This moves shutting down of
services in ~StoragePartitionImpl to OnBrowserContextWillBeDestroyed.
Doing this earlier will prevent other dangling pointer issues related
to browser context (including fixing one in StoragePartitionImpl), and
it consolidates shutdown.

Bug: 1492282
Change-Id: I57e1e439ad715df6625ef011c1a99a76051fac2e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4968658
Commit-Queue: Scott Haseley <shaseley@chromium.org>
Reviewed-by: Ayu Ishii <ayui@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1215818}
2023-10-26 23:27:10 +00:00
Ming-Ying Chung
322dd02a6c Reland "Allow in-browser keepalive req to survive longer after browser shutdown"
This is a reland of commit f4e9841129

This CL disables ReceiveResponseAfterBrowserShutdown browsertest on
macOS because browser shutdown is flaky on macOS (crbug.com/1259913).

Original change's description:
> Allow in-browser keepalive req to survive longer after browser shutdown
>
> As [1] points out, fetch keepalive requests should be able to
> survive from sudden browser shutdown.
>
> This CL utilizes the existing mechanism from [2] to let
> in-browser keepalive & fetchLater requests being able to complete
> by notifying browser for a 500ms delay [3]
>
> The same enterprise policy introduced in [4] should still work
> for this change.
>
> [1]: https://crbug.com/1465781#c50
> [2]: https://crrev.com/c/2494195/16/content/browser/renderer_host/keep_alive_handle_factory.cc
> [3]: https://docs.google.com/document/d/1cBfXgMdpE-vimXD1FGWeY78Dt_wPiixFcmPk9ksZfeI/edit?disco=AAAAI4jyqP4
> [4]: https://crrev.com/c/2703054
>
> Bug: 1465781,1356128
> Change-Id: Id888d6be621e2d0815469c1a64c465862d3c66a8
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4951005
> Reviewed-by: Tsuyoshi Horo <horo@chromium.org>
> Reviewed-by: Bo Liu <boliu@chromium.org>
> Reviewed-by: Scott Violet <sky@chromium.org>
> Commit-Queue: Ming-Ying Chung <mych@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1214598}

Bug: 1465781,1356128
Change-Id: I742f762660560b1960b239fc47e30a8aaaf0e52d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4975462
Reviewed-by: Bo Liu <boliu@chromium.org>
Reviewed-by: Tsuyoshi Horo <horo@chromium.org>
Commit-Queue: Ming-Ying Chung <mych@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1214785}
2023-10-25 12:52:25 +00:00
Jiewei Qian
643f73cc46 Revert "Allow in-browser keepalive req to survive longer after browser shutdown"
This reverts commit f4e9841129.

Reason for revert: Speculative revert for causing failures in
ChromeKeepAliveURLBrowserTest.ReceiveResponseAfterBrowserShutdown

Sample failure: https://ci.chromium.org/ui/b/8766293823566538369

Original change's description:
> Allow in-browser keepalive req to survive longer after browser shutdown
>
> As [1] points out, fetch keepalive requests should be able to
> survive from sudden browser shutdown.
>
> This CL utilizes the existing mechanism from [2] to let
> in-browser keepalive & fetchLater requests being able to complete
> by notifying browser for a 500ms delay [3]
>
> The same enterprise policy introduced in [4] should still work
> for this change.
>
> [1]: https://crbug.com/1465781#c50
> [2]: https://crrev.com/c/2494195/16/content/browser/renderer_host/keep_alive_handle_factory.cc
> [3]: https://docs.google.com/document/d/1cBfXgMdpE-vimXD1FGWeY78Dt_wPiixFcmPk9ksZfeI/edit?disco=AAAAI4jyqP4
> [4]: https://crrev.com/c/2703054
>
> Bug: 1465781,1356128
> Change-Id: Id888d6be621e2d0815469c1a64c465862d3c66a8
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4951005
> Reviewed-by: Tsuyoshi Horo <horo@chromium.org>
> Reviewed-by: Bo Liu <boliu@chromium.org>
> Reviewed-by: Scott Violet <sky@chromium.org>
> Commit-Queue: Ming-Ying Chung <mych@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1214598}

Bug: 1465781,1356128
Change-Id: I5e58ad716a0707c746d6fdb89f09b1e703ab92ec
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4975079
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Owners-Override: Jiewei Qian <qjw@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Jiewei Qian <qjw@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1214657}
2023-10-25 05:41:14 +00:00
Ming-Ying Chung
f4e9841129 Allow in-browser keepalive req to survive longer after browser shutdown
As [1] points out, fetch keepalive requests should be able to
survive from sudden browser shutdown.

This CL utilizes the existing mechanism from [2] to let
in-browser keepalive & fetchLater requests being able to complete
by notifying browser for a 500ms delay [3]

The same enterprise policy introduced in [4] should still work
for this change.

[1]: https://crbug.com/1465781#c50
[2]: https://crrev.com/c/2494195/16/content/browser/renderer_host/keep_alive_handle_factory.cc
[3]: https://docs.google.com/document/d/1cBfXgMdpE-vimXD1FGWeY78Dt_wPiixFcmPk9ksZfeI/edit?disco=AAAAI4jyqP4
[4]: https://crrev.com/c/2703054

Bug: 1465781,1356128
Change-Id: Id888d6be621e2d0815469c1a64c465862d3c66a8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4951005
Reviewed-by: Tsuyoshi Horo <horo@chromium.org>
Reviewed-by: Bo Liu <boliu@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Commit-Queue: Ming-Ying Chung <mych@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1214598}
2023-10-25 02:07:01 +00:00
Scott Haseley
2a05a493f8 Move SW service shutdown to StoragePartitionImpl
Follow-up from crrev.com/c/4869214. This moves shutting down of
ServiceWorkerContext and SharedWorkerService from
BrowserContextImpl::NotifyWillBeDestroyed to
StoragePartitionImpl::OnBrowserContextWillBeDestroyed.

Bug: 1492282
Change-Id: I74b8c88540771e4f11efc0cd8e8183b5998c6f30
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4961074
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Commit-Queue: Scott Haseley <shaseley@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1213569}
2023-10-23 16:59:32 +00:00
Vikram Pasupathy
e22a2e0b15 media: Hook up CdmStorage deletion code
This CL goes throughout the Chromium codebase and puts the deletion code
where necessary so that when kCdmStorageDatabase flag is enabled, the
BrowsingDataRemoverBrowser tests pass. This CL also tests that when
incognito, the CdmStorage.db is not written to disk.

Testing: I enabled kCdmStorageDatabase and ran browser_tests. Without
these changes, the
IncognitoBrowsingDataBrowserTest.StorageDoesntWriteToDisk and
BrowsingDataRemoverBrowserTest.StorageRemovedFromDisk would fail. These
changes now allow these tests to pass when the flag is enabled.

Bug: 1454512
Change-Id: Iadcc69781f7abd3a545f678519c28d6a51000d3a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4936193
Reviewed-by: John Rummell <jrummell@chromium.org>
Commit-Queue: Vikram Pasupathy <vpasupathy@chromium.org>
Reviewed-by: Bo Liu <boliu@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1210620}
2023-10-17 03:05:20 +00:00
Yifan Luo
4d98cd6999 [Private Network Access] Turn id and name into optional
`Private-Network-Access-Name` and `Private-Network-Access-Id` can be
optional. In this case, the IP address will be shown on the permission
prompt.

Bug: 1338439
Change-Id: Icd1fcd39b13de4e3a1d2c5415a2c516e4f4f594c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4919478
Commit-Queue: Yifan Luo <lyf@chromium.org>
Reviewed-by: Camille Lamy <clamy@chromium.org>
Commit-Queue: Camille Lamy <clamy@chromium.org>
Reviewed-by: Yifan Luo <lyf@chromium.org>
Auto-Submit: Yifan Luo <lyf@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1209322}
2023-10-13 10:22:43 +00:00
Scott Haseley
c3dde9c711 Add StoragePartitionImpl::OnBrowserContextWillBeDestroyed
StoragePartitionImpl::OnBrowserContextWillBeDestroyed is called by
BrowserContextImpl prior to destruction, which allows the partition to
shut down objects that hold raw pointers to about-to-be-destroyed
objects. This fixes dangling pointers in content_index and
FileSystemAccessManager** that result from objects being destroyed in
~ProfileImpl before shutting down all partitions.

**This CL also changes a couple browser tests to clear the testing
permission context to fix the remaining FileSystemAccessManager
dangling pointer causes.

Bug: 1471071, 1471072, 1471074
Change-Id: I569a2051f9e69e53f2d88d3ce4b6caeb4f74549f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4869214
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: Sergey Poromov <poromov@chromium.org>
Commit-Queue: Scott Haseley <shaseley@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1209101}
2023-10-12 21:47:32 +00:00
Vikram Pasupathy
786a06f946 media: Clean up *CHECKS around CdmStorage* code
This CL cleans up the checking logic around the CdmStorage* code.

This CL was tested with the existing unittests, but also by accessing
the video on this link https://integration.staging.widevine.com/player?contentUrl=https://storage.googleapis.com/wvtemp/hmchen/poc/tears_hd_cenc.mpd&proxyServerUrl=https://proxy.uat.widevine.com/proxy?video_id=GTS_CAN_PLAY_CLIENT_TOKEN%26provider=widevine_test%26full_response=true&persistentStateRequired=true

I tested it out by playing the video with both the kCdmStorageDatabase
flag enabled, and disabled since that would be the extent of our
experiment for migration. Both of them played fine and stored data w/out
any issue.

Bug: 1454512
Change-Id: I81ef7faa00e2e3919a253608e9f7b242a19697b3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4928191
Reviewed-by: John Rummell <jrummell@chromium.org>
Reviewed-by: Bo Liu <boliu@chromium.org>
Commit-Queue: Vikram Pasupathy <vpasupathy@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1208042}
2023-10-11 02:00:12 +00:00
Vikram Pasupathy
08c206ab32 media: Implement CdmStorageMigrationLogic
This CL implements the flag to introduce the CdmStorageDatabase to
media interface proxy, and implements the beginning of the migration
where in MediaLicense* code, we write and delete from both
databases to start to keep the MediaLicenseDatabase and the
CdmStorageDatabase in sync.

In a future CL, we will implement more logic in the Read in the
MediaLicense* code to complete the migration.

Testing:

1. Tested on the link without enabling the flag:
https://integration.staging.widevine.com/player?contentUrl=https://storage.googleapis.com/wvtemp/hmchen/poc/tears_hd_cenc.mpd&proxyServerUrl=https://proxy.uat.widevine.com/proxy?video_id=GTS_CAN_PLAY_CLIENT_TOKEN%26provider=widevine_test%26full_response=true&persistentStateRequired=true

2. Checked the log to make sure Writes were being done to the
CdmStorageDatabase as well.

3. Works properly by verifying EME Logger. UpdateSession works.

4. Tested on the same link with enabling the CdmStorageDatabase
flag and the CdmStorageDatabaseMigration flag.

5. Works properly, checked log, Update Session works.

Also added migration unittests.

Bug: 1454512
Change-Id: I23e69d3d7e9092ad584e1546a598217aeb757cfe
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4874970
Reviewed-by: Evan Liu <evliu@google.com>
Reviewed-by: John Rummell <jrummell@chromium.org>
Reviewed-by: Austin Sullivan <asully@chromium.org>
Commit-Queue: Vikram Pasupathy <vpasupathy@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1207810}
2023-10-10 18:48:54 +00:00
Nan Lin
b2d9a2d63d [3PCD] Rename enable_incognito feature param to enable_otr_profiles
The incognito and guest profiles are treated the same way in the cookie
deprecation experiment.

Bug: b/301477370
Change-Id: I414dfce96295297668717460e28135dd508728c2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4905083
Reviewed-by: Theodore Olsauskas-Warren <sauski@google.com>
Commit-Queue: Nan Lin <linnan@chromium.org>
Reviewed-by: Anthony Garant <anthonygarant@chromium.org>
Reviewed-by: Charlie Reis <creis@chromium.org>
Reviewed-by: Anton Maliev <amaliev@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1203363}
2023-09-29 17:57:48 +00:00
Nan Lin
7a6e116dc0 [3PCD] Add feature param to control experiments for incognito
This enables the ability to change the incognito behavior via Finch.

Bug: 1485124
Change-Id: Ie192b5a46dbddf014b31ac4fcb7f944e72232e3a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4879958
Reviewed-by: Charlie Reis <creis@chromium.org>
Commit-Queue: Nan Lin <linnan@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1199646}
2023-09-21 16:11:07 +00:00
Scott Haseley
997e048270 Fix dangling pointer in DevToolsBackgroundServicesContextImpl
DevToolsBackgroundServicesContextImpl can outlive its BrowserContext in
tests, which causes a dangling pointer. This CL fixes this by:
 - Fixing destruction order in ServiceWorkerUpdateJobTest, which was
   straightforward.

   Note: this also fixes an unrelated dangling pointer in one of the
   ServiceWorkerUpdateJobTest tests, which was straightforward and
   part of the same destruction sequence.

 - Making DevToolsBackgroundServicesContextImpl uniquely owned (no
   longer ref counted). The main interesting bits here were:
    - Get the DevToolsBackgroundServicesContextImpl directly rather
      than passing it across tasks (for service worker callbacks).
      This avoids a dangling pointer in the callback.

    - Plumb the Shutdown signal through BackgroundFetchContext to
      other objects that hold a raw_ptr to the devtools service. This
      can be further improved by making BackgroundFetchContext uniquely
      owned.

Bug: 1471073
Change-Id: I457c8492d21299dd60368711ed3814f3cf8fc3ec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4868640
Commit-Queue: Scott Haseley <shaseley@chromium.org>
Reviewed-by: Rouslan Solomakhin <rouslan@chromium.org>
Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1199589}
2023-09-21 14:52:04 +00:00
Nan Lin
dbfc369db7 [3PCD] Not sending labels in incognito mode
This CL also makes ContentBrowserClient to return false by default,
and override in ShellContentBrowserClient for testing.

Bug: 1485124
Change-Id: I676ed302464e9af9d6e37fe77c08983b9969a4d4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4876981
Reviewed-by: Anthony Garant <anthonygarant@chromium.org>
Reviewed-by: Charlie Reis <creis@chromium.org>
Commit-Queue: Nan Lin <linnan@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1199168}
2023-09-20 19:28:41 +00:00
Nan Lin
71b04b08d4 [3PCD] Use shared base::Feature for cookie deprecation mode A/B
experiments

Also removes the base::Feature check in net// layer, checking whether
the label exists is sufficient as it's only set when the feature is
enabled.

Change-Id: I67a642ebc1c076adb87635dee0f61edd8cc3d2a2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4869294
Commit-Queue: Nan Lin <linnan@chromium.org>
Reviewed-by: Robert Flack <flackr@chromium.org>
Reviewed-by: Kenichi Ishibashi <bashi@chromium.org>
Reviewed-by: Anton Maliev <amaliev@chromium.org>
Reviewed-by: Anthony Garant <anthonygarant@chromium.org>
Reviewed-by: David Bokan <bokan@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1198560}
2023-09-19 19:43:16 +00:00
Nan Lin
4a0c6b975c Implement network context interface to allow cookie deprecation label
to be updated

This CL also moves CookieDeprecationLabelManager to //content/public
to allow it to be accessed outside //content.

Bug: 1479121
Change-Id: I6fc8d410183b4e1f685e36a009878b00430a334b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4832711
Commit-Queue: Nan Lin <linnan@chromium.org>
Reviewed-by: Anthony Garant <anthonygarant@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1197929}
2023-09-18 18:46:08 +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
Andrew Paseltiner
8980f3bd9a Move Conversion Measurement blink feature to Attribution Reporting component
This feature will be needed in the //components/attribution_reporting
directory for future refactoring; moving it there prevents a dependency
cycle between it and blink. It is also more logically located there
anyway since it controls behavior in both blink and the browser.

Bug: 1479944
Change-Id: Iee7d71dc93888215a887ac0e49d8edc1c9c6c274
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4849148
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: John Delaney <johnidel@chromium.org>
Commit-Queue: Andrew Paseltiner <apaseltiner@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1193685}
2023-09-07 17:58:19 +00:00
Ming-Ying Chung
8f4626d6f0 [fetch-later] Fix incorrect flag guards
### Background:
- keepalive requests are a subset of Fetch requests.
- FetchLater request is a new type of Fetch request. Its keepalive
  flag is always true. When presents, `kFetchLaterAPI` must be true.

The [previous CL][1] replaces all occurrences of the feature flag
`kKeepAliveInBrowserMigration` with a function that checks additional
feature flag `kFetchLaterAPI`. However, it incorrectly enables the
migration path for non-fetchLater keepalive requests.

The correct paths looks like:

1. For a fetchLater keepalive request (generated from entirely new
   API), `kFetchLaterAPI` must be true. It should go through the code
   path after keepalive migration. content::KeepAliveURLLoaderService
   should handle the request.

2. For a non-fetchLater keepalive request:
   - if `kKeepAliveInBrowserMigration` is false, it should go through
     the existing & before migration path. Some checks lie in
     RenderProcessHost should apply to it.
   - if `kKeepAliveInBrowserMigration` is true, it should go through
     the after migration path. content::KeepAliveURLLoaderService
     should handle the request.

To summarize, content::KeepAliveURLLoaderService must be up if one of
the two features is enabled. But it should not handle the feature that
is not enabled.

This CL renames the `IsKeepAliveInBrowserMigrationEnabled()` function
to `IsKeepAliveURLLoaderServiceEnabled()`, which should only be used
in setting up KeepALiveURLLoaderService-related code path in content.

TODOs added by this CL is addressed in [another CL][2]. e2e tests are also added by that CL chain.

[1]: https://crrev.com/c/4752743
[2]: https://crrev.com/c/4803083/22..24

Bug: 1465781,1356128
Change-Id: I9a7c927ab1a248abf3415e126ea190b0b56833b4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4847647
Commit-Queue: Ming-Ying Chung <mych@chromium.org>
Reviewed-by: Nate Chapin <japhet@chromium.org>
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1193462}
2023-09-07 07:51:43 +00:00
Anthony Garant
824a4f65be Add cookie deprecation label header
https://developer.chrome.com/en/docs/privacy-sandbox/chrome-testing/#mode-a

This CL optionally adds the `Sec-Cookie-Deprecation` that includes
the per-partition label.

Adding the header is conditional to the presence of a special
partitioned cookie:

Set-Cookie: receive-cookie-deprecation=1; Secure; HttpOnly; Path=/; SameSite=None; Partitioned;

Bug: 1479071
Change-Id: I40ed70a0cfe2edfa671ac6d08f50e88afdac7a28
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4812461
Commit-Queue: Anthony Garant <anthonygarant@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Kenichi Ishibashi <bashi@chromium.org>
Reviewed-by: Nan Lin <linnan@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1192579}
2023-09-05 18:25:33 +00:00
Nan Lin
de1c2df6fa Implement CookieDeprecationLabelManager
https://developer.chrome.com/en/docs/privacy-sandbox/chrome-testing/#mode-a

This CL implements a per-partition label manager to be used for 3PCD
experimentation. The manager will be used in follow up CLs to allow
developers to receive experiment labels for server side testing without
cookies.

The base::feature is defined in services/network as it may be needed
for the header setting implementation (see crrev.com/c/4812461).

Change-Id: Id4eca843ffa61b0003e940e241d031326b0763c0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4807035
Reviewed-by: Anthony Garant <anthonygarant@chromium.org>
Reviewed-by: John Delaney <johnidel@chromium.org>
Commit-Queue: Nan Lin <linnan@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Theodore Olsauskas-Warren <sauski@google.com>
Reviewed-by: Kenichi Ishibashi <bashi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1192511}
2023-09-05 16:27:17 +00:00
Zelin Liu
fb01fe6661 iwa: StoragePartition::OnClearSiteData to pass StoragePartition along
When StoragePartition::OnClearSiteData() is called, the call
takes the follow route:
> StoragePartition::OnClearSiteData()
> ClearSiteDataHandler::HandleHeader()
> ClearSiteData()
> BrowsingDataRemoverImpl::RemoveWithFilterAndReply()
> StoragePartition::ClearData()

However, any StoragePartition calls OnClearSiteData() will eventually
result in default StoragePartition calling ClearData().

This chain of changes attempts to fix this by passing the
StoragePartition along to have the final ClearData() call called on the
correct StoragePartition.

We are also updating the definition of DATA_TYPE_ON_STORAGE_PARTITION
because only subsets of DATA_TYPE_ON_STORAGE_PARTITION are allowed by
BrowsingDataRemover to be the mask when a StoragePartition is specified
in the filter.

Bug: 1449362
Change-Id: I766d02a89ee636321625e30b80b1f38f15885e74
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4770335
Reviewed-by: Robbie McElrath <rmcelrath@chromium.org>
Reviewed-by: Joshua Bell <jsbell@chromium.org>
Commit-Queue: Zelin Liu <zelin@chromium.org>
Reviewed-by: Martin Šrámek <msramek@chromium.org>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1188471}
2023-08-25 19:36:56 +00:00
Tsuyoshi Horo
2c627550a5 Introduce CompressionDictionaryTransportEnabled policy
By disabling this policy, administrators can disable the Compression
Dictionary Transport feature. This is useful when they are using
firewalls which are decrypting TLS traffic using a private interception
certificate, because this feature may have interoperability issues with
such firewalls.

Bug: 1471795, 1413922
Change-Id: I582212a23046e905165c74f8123e94a2bb66d086
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4768717
Commit-Queue: Tsuyoshi Horo <horo@chromium.org>
Reviewed-by: Owen Min <zmin@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Patrick Meenan <pmeenan@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1183864}
2023-08-15 22:29:26 +00:00
Ming-Ying Chung
d9d172f3af [fetch-later] Replace kKeepAliveInBrowserMigration flag's usage with
a global function `IsKeepAliveInBrowserMigrationEnabled()`.

To support fetchLater API, the migration path also needs to be enabled
when kFetchLaterAPI is true.

Note that both of the flags are not yet launched.

This function will be used in https://crrev.com/c/4756243.

Design Doc: https://docs.google.com/document/d/1U8XSnICPY3j-fjzG35UVm6zjwL6LvX6ETU3T8WrzLyQ/edit

Bug: 1465781,1356128
Change-Id: Ic07c64b4a3640f6a968c0a1f8be24c571382c57e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4752743
Reviewed-by: Nate Chapin <japhet@chromium.org>
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Auto-Submit: Ming-Ying Chung <mych@chromium.org>
Commit-Queue: Nate Chapin <japhet@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1183235}
2023-08-14 19:04:55 +00:00