Certain requests may request, but not require, a client cert. Today,
this will result in one of three things happening if there isn't a
client cert available (either from a previous request or from
enterprise policy):
1) The request will fail
2) The user will be shown a cert picker dialog
3) The request will continue without a certificate
On desktop platforms for WebContents-based requesting contexts:
* If there are no certs to choose from, the request will continue
without a cert.
* If there are client certs and the WebContents supports showing
dialogs, the cert picker will be shown.
* If there are certs and the WebContents does not support showing
dialogs, the request will fail.
On Android for WebContents-based requesting contexts:
* We will always call out to the native cert-picker, which may or
may not show a dialog (depending on other device configurations
which Chrome doesn't know about).
On desktop and Android platforms for service worker requesting
contexts:
* The request will always fail.
This CL changes this behavior to allow requests from extension
background service workers to proceed without a client cert if there
are no certs to choose from; this then matches the behavior for
extension background and offscreen WebContents (which do not support
showing dialogs).
Bug: 333954429
Change-Id: Ia6111f3bd499998d6244945daa13ac67774804bf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5455480
Reviewed-by: Emily Stark <estark@chromium.org>
Reviewed-by: David Benjamin <davidben@chromium.org>
Reviewed-by: Richard (Torne) Coles <torne@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: Luke Halliwell <halliwell@chromium.org>
Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
Commit-Queue: Devlin Cronin <rdevlin.cronin@chromium.org>
Reviewed-by: Wez <wez@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1322530}
This change deprecates the existing `GetCallback`, in order to allow
progressive changes to remove the deprecated use of
`std::unique_ptr<std::string>` along with SimpleURLLoader. Eventually
all deprecated functions will be removed.
Bug: 1420528
Change-Id: Ic29faf4c015a45a409a346fb3601a57fdedabc4c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5040763
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Claudio DeSouza <cdesouza@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1227281}
Certain requests may require client certs to proceed. The default
behavior for this is to show the user a certificate picker, from which
they can select one. There is also an enterprise policy to allow for
auto-selecting certificates for different URLs.
We only want to show the certificate picker to the user if the request
is made by a web page (something that has a corresponding WebContents);
otherwise, the UI is alarming and confusing. Because of this, we
auto-cancel any client cert selection for requestors that don't have a
WebContents. However, this means that requests from service workers
will never succeed, even if the certificate for the request would have
been auto-selected by policy.
Fix this by instead allowing requests from service workers to check if
there is an auto-selected certificate, and using that if so. Otherwise,
we continue with the old flow of requiring a WebContents to select a
certificate.
Add an end-to-end browser test for the same.
Bug: 1417601
Change-Id: Ied08067ff56295031df61b8f26caa3303edb0c98
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4622260
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: Peter Beverloo <peter@chromium.org>
Reviewed-by: Sergey Ulanov <sergeyu@chromium.org>
Commit-Queue: Devlin Cronin <rdevlin.cronin@chromium.org>
Reviewed-by: Chris Thompson <cthomp@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1171500}
Some times tests need to replace the ContentBrowserClient. This
is often done by subclassing ContentBrowserClient and replacing
ContentBrowserClient during test execution. This is problematic
as certain things (such as RegisterBrowserInterfaceBindersForFrame)
are provided by ShellContentBrowserClient, and if not present
result in bad behavior (killing the renderer), which leads to flake.
To fix this problem this patch does the following:
. Moves ContentBrowserTestShellContentBrowserClient to its own
header and renames it to
ContentBrowserTestContentBrowserClient.
. makes SetBrowserClientForTesting() CHECK in content_browsertests.
. changes all browsertests to use
ContentBrowserTestContentBrowserClient.
. Changes ShellContentBrowserClient so that it sets the browser
client when called the second time (effectively what
SetBrowserClientForTesting() does).
Bug: 1406282
Change-Id: Ieaa7cfa09a53e9618b963d6cc4b931226d2c799e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4222392
Commit-Queue: Scott Violet <sky@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1102490}
Turns out there's a lot of includes, so these will have to be removed
before deleting the implementation of the task runner handles.
To allow the deletion of the task runner handle headers, add
the sequenced/thread task runner handles where they are used in
the codebase with scripts.
This was done with an automated change, with a few touchups afterwards.
The code for the mass-refactor changes are here:
python:
https://paste.googleplex.com/5534570878337024
shell:
https://paste.googleplex.com/6466750748033024
In terms of touchups:
- add sequenced/thread task runner handles to
the third_party/blink/public/DEPS, because multiple files were using
it transitively anyways.
- rewrite certain parts of the codebase which used
ThreadTaskRunnerHandles instead of CurrentDefaultHandles.
- fix a compile issue with forward-declaration in
extensions/browser/extension_file_task_runner.h.
AX-Relnotes: n/a.
Bug: 1026641
Change-Id: I737ef32aee4e77c21eaa3a2bdc403a28322cf1b7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4133323
Owners-Override: Gabriel Charette <gab@chromium.org>
Commit-Queue: Sean Maher <spvw@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1090532}
Normally, `ContentClient` never outlives `ContentBrowserClient`, because
the latter is owned by `ContentMainDelegate`, and this latter is
destroyed last in a normal session. This was only due to a test letting
this pointer dangling at destruction.
Bug: 1291138
Change-Id: I938a7fa0d75e923f82f7f5f00199b8ef50600da7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3779878
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Joshua Bell <jsbell@chromium.org>
Commit-Queue: Paul Semel <paulsemel@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1026829}
This replaces DISALLOW_COPY_AND_ASSIGN with explicit constructor deletes
where a local script is able to detect its insertion place (~Foo() is
public => insert before this line).
This is incomplete as not all classes have a public ~Foo() declared, so
not all DISALLOW_COPY_AND_ASSIGN occurrences are replaced.
IWYU cleanup is left as a separate pass that is easier when these macros
go away.
Bug: 1010217
Change-Id: Iea478401b7580682c7b9f195f7af9cbbdb6ce315
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3167292
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#923194}
This CL refactors non-overridable (i.e. implemented only within
//content) methods of `BrowserContext`, so that they are implemented as
instance methods (rather than as `static` methods taking a `self`
argument). This particular CL refactors the following methods:
- GetStoragePartition
- GetStoragePartitionForUrl
- ForEachStoragePartition
- GetStoragePartitionCount
- AsyncObliterateStoragePartition
- GarbageCollectStoragePartitions
- GetDefaultStoragePartition
Using instance methods (e.g. modifying all the callsites to use
instance method invocation syntax) is a prerequisite for splitting
BrowserContext into BrowserContextImpl+BrowserContextDelegate. In
particular, in the long-term, the refactored methods should be
pure-virtual methods of BrowserContext that are overriden/implemented by
BrowserContextImpl. Such virtual methods would be *instance* methods -
this is what the current CL helps with.
Bug: 1179776
AX-Relnotes: n/a.
Change-Id: I6effd1da5c17f27579251d41051b6ea08f689faf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2725732
Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: Charlie Reis <creis@chromium.org>
Auto-Submit: Łukasz Anforowicz <lukasza@chromium.org>
Commit-Queue: Charlie Reis <creis@chromium.org>
Owners-Override: Charlie Reis <creis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#877482}
This is a step towards doing full IWYU of browser_test.h, which will
have other benefits.
Completely mechanical and already R+ed as part of r765923.
Tbr: sky
Bug: none
Change-Id: Icb7ab728098a6cf29c0920da4b524e96a7c024c2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2186411
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#766361}
Include this directly in relevant test files. This lets us convert the
HAS_OUT_OF_PROC_TEST_RUNNER checks in this file and
view_event_test_base.h into #errors, and force people to not even
include this file in files that can't use it.
Bug: none
Tbr: sky
Change-Id: I86626099eb047eb53e8b3611de38ba6bebc01a0b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2136117
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#765923}
This class was used by content_shell to enable network logging, however that is now handled by the Network Service.
After this change:
* content_shell no longer supports --log-net-log when Network Service is disabled
* content_shell properly handles --log-net-log when Network Service is enabled (crbug.com/979841)
The same applies goes for the ash_shell_with_content executable.
Bug: 934009,767450,979841
TBR: jam@chromium.org
Change-Id: I14ccb736773f46cf4af8ef62b6ef749cd2e7ff8b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1682792
Commit-Queue: Eric Roman <eroman@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Mike West <mkwst@chromium.org>
Cr-Commit-Position: refs/heads/master@{#674117}
As part of the effort to move to the network service, changing the
GaiaAuthFetcher to use network::SimpleURLLoader instead of using
net::URLRequest.
This changes the API to take in a SharedURLLoaderFactory instead of a
net::URLRequestContextGetter and affects many callers.
Many tests also had to be changed, as it is common to mock a URLRequest
and this is now done using a TestURLLoaderFactory.
Bug: 840396
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;luci.chromium.try:linux_mojo;master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: Ib93075b06855a0a5ba9349ae64e2ad43b02e0c6f
Reviewed-on: https://chromium-review.googlesource.com/1091533
Commit-Queue: Jay Civelli <jcivelli@chromium.org>
Reviewed-by: Maksim Ivanov <emaxx@chromium.org>
Reviewed-by: Roger Tawa <rogerta@chromium.org>
Reviewed-by: David Roger <droger@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Reviewed-by: Alexander Alekseev <alemate@chromium.org>
Cr-Commit-Position: refs/heads/master@{#575332}
Ensure we recreate the SharedURLLoaderFactory used by StoragePartition
whenever SetGetURLLoaderFactoryForBrowserProcessCallbackForTesting() is
called. This makes the URLLoaderInterceptor work properly with the
SharedURLLoaderFactory returned by
StoragePartition::GetURLLoaderFactoryForBrowserProcess().
Bug: 857250
Change-Id: Id913ba93322dc62c2c03d8acd4c31b53fc8d436e
Reviewed-on: https://chromium-review.googlesource.com/1117822
Commit-Queue: Jay Civelli <jcivelli@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#570995}
The original tests pass non-thread-safe objects across threads which
could easily break.
This CL:
1. Adds 'storage_partition_test_utils.h/cc'.
2. Adds |IOThreadSharedURLLoaderFactoryOwner| which lives on UI thread
and owns a |SharedURLLoaderFactory| on IO thread.
3. Moves related tests into 'storage_partition_impl_browsertest.cc' to
make sure they run w/ and w/o Network Service.
This patch doesn't have behavior change.
Bug: 826869
Change-Id: I23d636b079d72627f8944dd61892d72f175e0c7d
Reviewed-on: https://chromium-review.googlesource.com/1033806
Commit-Queue: Chong Zhang <chongz@chromium.org>
Reviewed-by: Matt Menke <mmenke@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#556136}
And any struct_traits => mojom_traits
Brought to you by grep and sed
TBR=dcheng@chromium.orgTBR=jam@chromium.org
Bug: 806965
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_mojo;master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I3782b0e0fbfe438678a9aeeaefd2922fbd19d0eb
Reviewed-on: https://chromium-review.googlesource.com/912511
Reviewed-by: Ken Rockot <rockot@chromium.org>
Commit-Queue: Ken Rockot <rockot@chromium.org>
Cr-Commit-Position: refs/heads/master@{#535985}
This is a reland of [1] which got reverted because of some link errors.
This change moves some features defined in
/content/public/common/content_features.h to
/services/network/public/cpp/features. They need to be defined in
/services/network in order to move /content/network files to
/services/network.
1: https://chromium-review.googlesource.com/c/chromium/src/+/874980
Bug: 754918, 804769
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_mojo
Change-Id: Id2aec8ec1e000eb2542a89d1788d46adab476087
Reviewed-on: https://chromium-review.googlesource.com/890898
Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#532827}
Some features defined in content/public/common/content_features.h
prevented us moving files from content/network to services/network. This
CL unblocks that by defining such features in services/network.
Bug: 754918, 804769
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_mojo
Change-Id: I378bef8d314003530019c9e4aab01bdb2f91a2b7
Reviewed-on: https://chromium-review.googlesource.com/874980
Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#531829}
This will allow code to use NetworkContexts both when the network
service is disabled, and when it's enabled, so the same code works with
and without the network service.
This CL also makes it so the StoragePartition always owns the
NetworkContext, even if the context is created by the embedder.
Bug: 751119
Change-Id: If63e9f3ba75671c3fb24ce8d956e8ea2d98177dc
Reviewed-on: https://chromium-review.googlesource.com/596229
Commit-Queue: Matt Menke <mmenke@chromium.org>
Reviewed-by: Randy Smith <rdsmith@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#492204}