0
Commit Graph

45 Commits

Author SHA1 Message Date
Chris Fredrickson
5dcd503d13 Migrate some callers to optional-based GetNormalizedHeader overload
This doesn't migrate every callsite; it just migrates the ones where
the optional-based overload is clearly more ergonomic.

Change-Id: I01feb24e5bde8f48ff57e5f963b0ea2f4eef40c8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5935252
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Maks Orlovich <morlovich@chromium.org>
Commit-Queue: Chris Fredrickson <cfredric@chromium.org>
Reviewed-by: Ryan Sultanem <rsult@google.com>
Cr-Commit-Position: refs/heads/main@{#1369953}
2024-10-17 13:00:34 +00:00
Devlin Cronin
df260f5e98 [Extensions] Allow service worker requests to continue without a cert
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}
2024-07-03 02:13:39 +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
Claudio DeSouza
a3f01e1106 Provide optional-based SimpleURLLoaderTestHelper callback
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}
2023-11-21 09:14:55 +00:00
Devlin Cronin
9459117465 [Service Workers] Allow fetches from workers to use auto-picked certs
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}
2023-07-18 00:46:07 +00:00
Scott Violet
9986199c3c content: makes content browsertests subclass test ContentBrowserClient
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}
2023-02-08 01:20:12 +00:00
Sean Maher
e672a665ff task posting v3: remove includes of runner handles and IWYU task runners
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}
2023-01-09 21:42:28 +00:00
Avi Drissman
4e1b7bc33d Update copyright headers in content/
The methodology used to generate this CL is documented in
https://crbug.com/1098010#c34.

No-Try: true
No-Presubmit: true
Bug: 1098010
Change-Id: I8c0f009d16350271f07d8e5e561085822cc9dd27
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3895935
Owners-Override: Avi Drissman <avi@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
Auto-Submit: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1047456}
2022-09-15 14:03:50 +00:00
Paul Semel
3e957659ba DanglingPtr: Fix dangling ptr in ContentClient
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}
2022-07-21 17:08:13 +00:00
Peter Boström
828b902994 Replace DISALLOW_COPY_AND_ASSIGN in content/
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}
2021-09-21 02:28:43 +00:00
Lukasz Anforowicz
b9a969a2ce Real instance methods for BrowserContext: StoragePartition methods.
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}
2021-04-29 15:26:25 +00:00
Dave Tapuska
28226d0410 Remove routing_id from CreateLoaderAndStart
The routing_id parameter represented the view's routing ID for the
associated load. It is unused now so it can be removed.

BUG=1173710

Change-Id: Icdab0441f78530e468392e2f0261e4153959b666
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2762858
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Matt Falkenhagen <falken@chromium.org>
Owners-Override: Kinuko Yasuda <kinuko@chromium.org>
Owners-Override: Matt Falkenhagen <falken@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/master@{#863748}
2021-03-17 14:21:29 +00:00
Guido Urdaneta
ef4e919472 Reland "Move base/test/bind_test_util.h to base/test/bind.h"
This reverts commit 8bd07a6cf9.

Reason for revert: This revert was incorrect and breaks the build.

Original change's description:
> Revert "Move base/test/bind_test_util.h to base/test/bind.h"
>
> This reverts commit a4493a6f80.
>
> Reason for revert: This CL breaks internal builds (e.g. /chrome/browser/media/kaleidoscope/internal/kaleidoscope_browsertest.cc).
>
> Original change's description:
> > Move base/test/bind_test_util.h to base/test/bind.h
> >
> > Stop relying on us to remember arcane file names when writing tests,
> > and repeating the directory hierarchy into the file name.
> >
> > R=​dcheng@chromium.org
> > TBR=
> > NOPRESUBMIT=true
> >
> > Change-Id: I49c951162939c7dcef44883bee740f94b2f49e09
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2523099
> > Commit-Queue: danakj <danakj@chromium.org>
> > Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#825145}
>
> TBR=danakj@chromium.org,dcheng@chromium.org
>
> # Not skipping CQ checks because original CL landed > 1 day ago.
>
> Change-Id: If165b8443662baa564895e994ea0d772348e6da6
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2526102
> Reviewed-by: Denis Kuznetsov [CET] <antrim@chromium.org>
> Commit-Queue: Denis Kuznetsov [CET] <antrim@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#825328}

TBR=danakj@chromium.org,dcheng@chromium.org,antrim@chromium.org

# Not skipping CQ checks because this is a reland.
NOPRESUBMIT=true
NOTREECHECK=true

No-Try: True
Change-Id: I6a8c0c8bbb1c8f87cc7f2df7a8b3388971292975
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2526683
Commit-Queue: Guido Urdaneta <guidou@chromium.org>
Reviewed-by: Guido Urdaneta <guidou@chromium.org>
Cr-Commit-Position: refs/heads/master@{#825329}
2020-11-09 15:06:24 +00:00
Denis Kuznetsov [CET]
8bd07a6cf9 Revert "Move base/test/bind_test_util.h to base/test/bind.h"
This reverts commit a4493a6f80.

Reason for revert: This CL breaks internal builds (e.g. /chrome/browser/media/kaleidoscope/internal/kaleidoscope_browsertest.cc).

Original change's description:
> Move base/test/bind_test_util.h to base/test/bind.h
>
> Stop relying on us to remember arcane file names when writing tests,
> and repeating the directory hierarchy into the file name.
>
> R=​dcheng@chromium.org
> TBR=
> NOPRESUBMIT=true
>
> Change-Id: I49c951162939c7dcef44883bee740f94b2f49e09
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2523099
> Commit-Queue: danakj <danakj@chromium.org>
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#825145}

TBR=danakj@chromium.org,dcheng@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: If165b8443662baa564895e994ea0d772348e6da6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2526102
Reviewed-by: Denis Kuznetsov [CET] <antrim@chromium.org>
Commit-Queue: Denis Kuznetsov [CET] <antrim@chromium.org>
Cr-Commit-Position: refs/heads/master@{#825328}
2020-11-09 14:21:28 +00:00
danakj
a4493a6f80 Move base/test/bind_test_util.h to base/test/bind.h
Stop relying on us to remember arcane file names when writing tests,
and repeating the directory hierarchy into the file name.

R=dcheng@chromium.org
TBR=
NOPRESUBMIT=true

Change-Id: I49c951162939c7dcef44883bee740f94b2f49e09
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2523099
Commit-Queue: danakj <danakj@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#825145}
2020-11-07 01:53:08 +00:00
Matt Menke
ee10f041eb Add logic to use a default IsolationInfo for certain URLLoaderFactories.
Also make IsolationInfo mandatory for requests using a profile's main
NetworkContext.  In the future this will be extended to other APIs that
take NIKs (WebSockets, DNS lookups, etc).

Bug: 1082280
Change-Id: I630f501cfaf57ea01af8af05c37c9bd79bda20ed
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2180542
Commit-Queue: Matt Menke <mmenke@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Karan Bhatia <karandeepb@chromium.org>
Reviewed-by: Shivani Sharma <shivanisha@chromium.org>
Cr-Commit-Position: refs/heads/master@{#768749}
2020-05-14 14:16:03 +00:00
Peter Kasting
919ce657e4 Add missing #includes of browser_test.h.
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}
2020-05-07 10:22:36 +00:00
Balazs Engedy
683d2c7a8f Revert "IWYU for browser_test.h."
This reverts commit 66a53c909a.

Reason for revert: Breaks compile on official branded builders.

Original change's description:
> IWYU for browser_test.h.
> 
> 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}

TBR=sky@chromium.org,pkasting@chromium.org,thestig@chromium.org

Change-Id: I4583916602404c310a93f571dd2c78645c6bd567
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: none
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2184132
Reviewed-by: Balazs Engedy <engedy@chromium.org>
Commit-Queue: Balazs Engedy <engedy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#765931}
2020-05-06 10:36:40 +00:00
Peter Kasting
66a53c909a IWYU for browser_test.h.
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}
2020-05-06 09:38:56 +00:00
danakj
2c1d50b9fe Rename storage_partition_test_utils.h to io_thread_shared_url_loader_factory_owner.h
The file contains one class and should represent the name of that class.

R=nasko@chromium.org

Bug: 866140
Change-Id: I7fe53fd31c593ac5053883480e2a274527d97542
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2113437
Commit-Queue: danakj <danakj@chromium.org>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#752575}
2020-03-23 22:06:37 +00:00
Daniel McArdle
15311a9723 Invalidate SSLClientAuthHandler's WeakPtrs in destructor
Bug: 1049319
Change-Id: Iab4b89cce79b8e764081295fd73dcffd6661cbec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2042295
Auto-Submit: Dan McArdle <dmcardle@chromium.org>
Reviewed-by: Emily Stark <estark@chromium.org>
Reviewed-by: Daniel Murphy <dmurph@chromium.org>
Reviewed-by: David Benjamin <davidben@chromium.org>
Commit-Queue: Dan McArdle <dmcardle@chromium.org>
Cr-Commit-Position: refs/heads/master@{#739474}
2020-02-07 18:17:41 +00:00
Dominic Farolino
bc280d2c91 Rename loading classes given new mojo types
Renamed classes:
 - SharedURLLoaderFactoryInfo => PendingSharedURLLoaderFactory
 - URLLoaderFactoryBundleInfo => PendingURLLoaderFactoryBundle

Renamed variables:
 - script_loader_factory_info => pending_script_loader_factory
 - shared_url_loader_info => pending_shared_url_loader_factory
 - network_factory_info => pending_network_factory
 - network_loader_factory_info => pending_network_loader_factory
 - url_loader_factory_info => pending_url_loader_factory
 - loader_factory_info => pending_loader_factory
 - fallback_factory_info => pending_fallback_factory
 - factory_info => pending_factory
 - subresource_loader_factory_bundle_info =>
     pending_subresource_loader_factory_bundle

Renamed files:
 - cross_thread_shared_url_loader_factory_info.{h,cc} =>
     cross_thread_pending_shared_url_loader_factory.{h,cc}
 - network_download_url_loader_factory_info.{h,cc} =>
     network_download_pending_url_loader_factory.{h,cc}

Bug: 955171
Change-Id: I62f9babca56eb1257ccb6e1a14b28d39b159cb75
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1945987
Commit-Queue: Dominic Farolino <dom@chromium.org>
Reviewed-by: Michael Spang <spang@chromium.org>
Reviewed-by: Matt Falkenhagen <falken@chromium.org>
Reviewed-by: Colin Blundell <blundell@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Tao Wu <wutao@chromium.org>
Reviewed-by: Rohit Rao <rohitrao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#721879}
2019-12-05 05:49:24 +00:00
Julie Jeongeun Kim
917c19790f Convert network::mojom::URLLoaderPtr to new Mojo types
This CL converts network::mojom::URLLoaderPtr to new Mojo types using
PendingRemote and Remote.

It also update |url_loader| of FetchEventPreloadHandle in
dispatch_fetch_event_params.mojom and |url_loader| of
TransferrableURLLoader in transferrable_url_loader.mojom with
pending_remote.

Bug: 955171
Change-Id: Ib457d18eb4b2dfe9f4a11f059b1674669c18e565
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1921594
Commit-Queue: Julie Kim <jkim@igalia.com>
Reviewed-by: Ken Rockot <rockot@google.com>
Reviewed-by: David Roger <droger@chromium.org>
Reviewed-by: Sami Kyöstilä <skyostil@chromium.org>
Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
Reviewed-by: Sam McNally <sammc@chromium.org>
Reviewed-by: Colin Blundell <blundell@chromium.org>
Reviewed-by: Luke Halliwell (slow) <halliwell@chromium.org>
Reviewed-by: Tim Volodine <timvolodine@chromium.org>
Reviewed-by: Matt Falkenhagen <falken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#718980}
2019-11-26 03:36:14 +00:00
Julie Jeongeun Kim
6dd4c7b45e Convert network::mojom::URLLoaderClientPtr to new Mojo types
This CL converts network::mojom::URLLoaderClientPtr to new Mojo
types using PendingRemote and Remote.
It also uses pending_remote for URLLoaderClient parameter from
mojom::URLLoaderFactory::CreateLoaderAndStart() and updates its
implementations with new Mojo types.

Bug: 955171
Change-Id: Ie93e96885628488df2d8a88929224cb43ad1ab53
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1901010
Commit-Queue: Julie Kim <jkim@igalia.com>
Reviewed-by: David Roger <droger@chromium.org>
Reviewed-by: Ken Rockot <rockot@google.com>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Luke Halliwell (slow) <halliwell@chromium.org>
Reviewed-by: Tim Volodine <timvolodine@chromium.org>
Reviewed-by: Sami Kyöstilä <skyostil@chromium.org>
Reviewed-by: Colin Blundell <blundell@chromium.org>
Reviewed-by: Wez <wez@chromium.org>
Reviewed-by: Matt Falkenhagen <falken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#716076}
2019-11-18 05:56:30 +00:00
Julie Jeongeun Kim
2811b95e9e Convert URLLoaderFactory from //content to new Mojo types
This CL converts URLLoaderFactory from //content
to new Mojo types using PendingRemote and Remote.

Bug: 955171
Change-Id: I106caf8803c9897d6a671042bbc94d3f90a8450a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1863933
Reviewed-by: Oksana Zhuravlova <oksamyt@chromium.org>
Reviewed-by: Matt Falkenhagen <falken@chromium.org>
Commit-Queue: Julie Kim <jkim@igalia.com>
Cr-Commit-Position: refs/heads/master@{#708859}
2019-10-24 00:36:12 +00:00
Lucas Furukawa Gadani
0690260b7c Convert services/network/test/ to use URLResponseHead mojom types.
This CL converts files in services/network/test to use the
mojom::URLResponseHead type instead of the native ResourceResponseHead
struct.

Bug: 984550
Change-Id: I59e3900f9b3865b29e5b976226a249e8d47f2dad
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1808489
Reviewed-by: Tim Volodine <timvolodine@chromium.org>
Reviewed-by: Filip Gorski <fgorski@chromium.org>
Reviewed-by: Sorin Jianu <sorin@chromium.org>
Reviewed-by: Roger McFarlane <rogerm@chromium.org>
Reviewed-by: David Trainor <dtrainor@chromium.org>
Reviewed-by: Istiaque Ahmed <lazyboy@chromium.org>
Reviewed-by: Alexei Svitkine <asvitkine@chromium.org>
Reviewed-by: Mihai Sardarescu <msarda@chromium.org>
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Ben Greenstein <bengr@chromium.org>
Reviewed-by: Jamie Walch <jamiewalch@chromium.org>
Reviewed-by: J Kardatzke <jkardatzke@chromium.org>
Reviewed-by: Nathan Parker <nparker@chromium.org>
Reviewed-by: Michael Giuffrida <michaelpg@chromium.org>
Reviewed-by: Marc Treib <treib@chromium.org>
Reviewed-by: Vadym Doroshenko <dvadym@chromium.org>
Reviewed-by: Drew Wilson <atwilson@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Rohit Rao <rohitrao@chromium.org>
Commit-Queue: Lucas Gadani <lfg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#700847}
2019-09-27 20:44:27 +00:00
John Abd-El-Malek
c134dd8ab3 Remove some dead code that's not used with network service path.
Bug: 934009
Change-Id: I03a76ea596efb01600c8ad622933c5bec911fac2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1729059
Reviewed-by: Clark DuVall <cduvall@chromium.org>
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#682909}
2019-07-31 20:51:44 +00:00
Eric Roman
b56d0efda5 Remove ShellNetLog.
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}
2019-07-02 17:36:06 +00:00
Victor Costan
aa7b61fdc4 test: Replace _TEST_CASE_ with _TEST_SUITE_ in /content.
Googletest is (at last) converging with industry-standard terminology
[1]. We previously called test suites "test cases", which was rather
confusing for folks coming from any other testing framework.

Chrome now has a googletest version that supports _TEST_SUITE_ macros
instead of _TEST_CASE_, so this CL cleans up some of the outdated usage.

[1] https://github.com/google/googletest/blob/master/googletest/docs/primer.md#beware-of-the-nomenclature

Bug: 925652
Change-Id: Id6f209a71ef005b068b2dbe4308291af444544ec
Reviewed-on: https://chromium-review.googlesource.com/c/1469525
Auto-Submit: Victor Costan <pwnall@chromium.org>
Commit-Queue: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#631597}
2019-02-13 07:57:57 +00:00
Jay Civelli
1ba1157299 Make GaiaAuthFetcher use the network::SimpleURLLoader
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}
2018-07-16 17:41:01 +00:00
Jay Civelli
3dcf99fc0e Fix for URLLoaderInterceptor with StoragePartition
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}
2018-06-28 01:26:47 +00:00
Lukasz Anforowicz
0b05f082f3 Introduce URLLoaderFactoryParams.
This CL introduces URLLoaderFactoryParams which encapsulates all
input parameters of NetworkContext::CreateURLLoaderFactory.

Bug: 792546
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: I5ba5348aa49c2de958ecef8ab34a0103ec98aa4f
Reviewed-on: https://chromium-review.googlesource.com/1064881
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Cr-Commit-Position: refs/heads/master@{#560087}
2018-05-18 23:04:00 +00:00
Chong Zhang
83d0e4f0ee Move tests for StoragePartitition and fix potential threading issue
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}
2018-05-04 18:55:09 +00:00
Ken Rockot
54311e6115 services/network/public/{interfaces => mojom}
And any struct_traits => mojom_traits

Brought to you by grep and sed

TBR=dcheng@chromium.org
TBR=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}
2018-02-10 19:01:52 +00:00
Yutaka Hirano
d8789f93d0 Move some content features to /services/network
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}
2018-01-30 09:59:51 +00:00
John Abd-El-Malek
d0cd7c5ceb Move TestURLLoaderClient to services/network/test.
This, together with cl 892292, unblocks moving url_loader_test.cc to services/network.

Bug: 753658
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_mojo
Change-Id: Iba9cc4f07e2f8a4d2c6617c4c69bd1c74e03ab65
Reviewed-on: https://chromium-review.googlesource.com/892698
Reviewed-by: Yutaka Hirano <yhirano@chromium.org>
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#532801}
2018-01-30 07:20:02 +00:00
Takashi Sakamoto
9030bb3ea9 Revert "Introduce services/network/public/cpp/features.h"
This reverts commit 1f1519bdfc.

Because this causes Mac Retina Debug bot failure, e.g.
https://ci.chromium.org/buildbot/chromium.gpu/Mac%20Retina%20Debug%20%28AMD%29/18470

[18936:47619:0124/230505.322884:FATAL:feature_list.cc(328)] Check failed: CheckFeatureIdentity(feature). NetworkService
0   libbase.dylib                       0x00000001029659be base::debug::StackTrace::StackTrace(unsigned long) + 174
1   libbase.dylib                       0x0000000102965a7d base::debug::StackTrace::StackTrace(unsigned long) + 29
2   libbase.dylib                       0x0000000102963efc base::debug::StackTrace::StackTrace() + 28
3   libbase.dylib                       0x00000001029fd0ef logging::LogMessage::~LogMessage() + 479
4   libbase.dylib                       0x00000001029fae25 logging::LogMessage::~LogMessage() + 21
5   libbase.dylib                       0x000000010297598c base::FeatureList::IsFeatureEnabled(base::Feature const&) + 748
6   libbase.dylib                       0x0000000102975687 base::FeatureList::IsEnabled(base::Feature const&) + 71
7   libcontent.dylib                    0x000000011fb99e44 content::GetNetworkServiceImpl() + 180
8   libchrome_dll.dylib                 0x0000000106dd0831 IOThread::ConstructSystemRequestContext() + 8257
9   libchrome_dll.dylib                 0x0000000106dcce1a IOThread::Init() + 10666
10  libcontent.dylib                    0x000000011ef901e6 content::BrowserThreadImpl::Init() + 854
11  libcontent.dylib                    0x000000011ef8cfd7 content::BrowserProcessSubThread::Init() + 231
12  libbase.dylib                       0x0000000102c5daa3 base::Thread::ThreadMain() + 2419
13  libbase.dylib                       0x0000000102c350da base::(anonymous namespace)::ThreadFunc(void*) + 682
14  libsystem_pthread.dylib             0x00007fff924ed93b _pthread_body + 180

Change-Id: I72025f9801ac640627a4098073b448657f2deca2
Reviewed-on: https://chromium-review.googlesource.com/886163
Reviewed-by: Takashi Sakamoto <tasak@google.com>
Cr-Commit-Position: refs/heads/master@{#531850}
2018-01-25 08:53:18 +00:00
Yutaka Hirano
1f1519bdfc Introduce services/network/public/cpp/features.h
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}
2018-01-25 06:32:00 +00:00
John Abd-El-Malek
53670ddf8a Move network_service.mojom and network_service_test.mojom to services/network.
Bug: 753658
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_mojo
Change-Id: Ida11d6dc98e31a6a09f8ea260dd2e5da2507ac81
Reviewed-on: https://chromium-review.googlesource.com/874551
Reviewed-by: Yuzhu Shen <yzshen@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#530291}
2018-01-18 22:07:21 +00:00
John Abd-El-Malek
b165dc5211 Move url_loader.mojom and url_loader_factory.mojom to services/network.
TBR=nasko

Bug: 753658
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_mojo
Change-Id: I275cafb2676007dc49d90435dd0be525601089de
Reviewed-on: https://chromium-review.googlesource.com/871663
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Ken Rockot <rockot@chromium.org>
Cr-Commit-Position: refs/heads/master@{#530175}
2018-01-18 17:12:18 +00:00
John Abd-El-Malek
4624803682 Move resource_response.h to //services/network/public/cpp.
Bug: 753658
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_mojo
Change-Id: Iae4c394b7c33b17746f7cb17c65446ccf49cffcd
Reviewed-on: https://chromium-review.googlesource.com/865664
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#529839}
2018-01-17 19:11:23 +00:00
Randy Smith
ff094aa1ff Move ResourceResponseInfo to //services/network.
Bug: 753658
Change-Id: If4f9a3f05aee311ec614e98e1c72aaf8dc6c87ad
Reviewed-on: https://chromium-review.googlesource.com/860263
Commit-Queue: Randy Smith <rdsmith@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#529811}
2018-01-17 18:21:27 +00:00
John Abd-El-Malek
1df61797e3 Move ResourceRequest to services/network in preparation of moving content/network.
TBR=nasko for ipc changes

Bug: 753658
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_mojo
Change-Id: I26cd2721b1894e81cb4f121ab39ad5e2e0dd735a
Reviewed-on: https://chromium-review.googlesource.com/865102
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Ken Rockot <rockot@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#529053}
2018-01-12 20:40:45 +00:00
Matt Menke
b83ae72e4b Make StoragePartition always create a NetworkContext.
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}
2017-08-05 01:04:49 +00:00