0

81 Commits

Author SHA1 Message Date
edfd43fe49 Fix URLChecker DCHECK/segfaults
Fixes use-after-free issues in URLChecker and
KidsManagementURLCheckerClient.

Asynchronous callbacks passed to unowned objects should be bound with
weak pointers, so if `this` is destroyed, the callback won't fire.

Test:
* As a parent, set a child's Safe Site setting to "Allow all sites"
* Add the child to a Chromebook
This CL fixes DCHECKs and (in prod) potential use-after-free segfaults
that could otherwise occur when running the steps above.

Bug: 1159898
Change-Id: I67ba8f924ded3b6316813529e9b77a3d3735b483
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2597547
Reviewed-by: Aga Wronska <agawronska@chromium.org>
Reviewed-by: Toby Huang <tobyhuang@chromium.org>
Commit-Queue: Aga Wronska <agawronska@chromium.org>
Cr-Commit-Position: refs/heads/master@{#843171}
2021-01-13 20:33:50 +00:00
b0f448b560 Fix monorail component name for safe_search_api
The correct component name is FamilyExperiences.

Bug: 1165368
Change-Id: Ie206eb950cae0243baa5a655d8c12dff506a4066
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2625369
Commit-Queue: Marc Treib <treib@chromium.org>
Auto-Submit: Aga Wronska <agawronska@chromium.org>
Reviewed-by: Marc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#842922}
2021-01-13 07:58:39 +00:00
776a517dfb Add DIR_METADATA files to //components/safe...
Generate DIR_METADATA files and remove metadata from OWNERS files for
//components/safe...

Bug: 1113033
Change-Id: Ie90bfbec0faaa8b4287e71434511880e7386ff1d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2555697
Reviewed-by: Colin Blundell <blundell@chromium.org>
Commit-Queue: Norman Rosas <normando@google.com>
Cr-Commit-Position: refs/heads/master@{#831065}
2020-11-25 18:06:43 +00:00
9b341df640 Remove unnecessary net/url_request/ includes from components/.
With the advent of the network service, a lot fewer files use
net::URLRequest than before, but there are still a lot of left over
includes. This CL removes many such unused includes in components/.


Bug: 1103784, 1104380
Change-Id: I9f1bb518dca6d8c47bc955f3c1f521b510d1a5d8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2292779
Commit-Queue: Matt Menke <mmenke@chromium.org>
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#788633}
2020-07-15 15:17:07 +00:00
5bafbb9223 Include-what-you-use related to logging.h (components)
Add direct includes for things provided transitively by logging.h
(or by other headers including logging.h).

This is in preparation for cleaning up unnecessary includes of
logging.h in header files (so if something depends on logging.h,
it needs include it explicitly), and for when logging.h no longer
includes check.h, check_op.h, and notreached.h.

Bug: 1031540
Change-Id: I0ff3ce30d29dd57837e3c156940d11247a46d661
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2248688
Commit-Queue: Hans Wennborg <hans@chromium.org>
Auto-Submit: Hans Wennborg <hans@chromium.org>
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#779725}
2020-06-18 09:13:57 +00:00
32b1b5c71e Remove country from SafeSearchUrlCheckerClient, param that was only used by supervised users
Supervised users are not longer calling SafeSearchUrlCheckerClient (crbug/940454).

Bug: 936432
Change-Id: I34ae41f052a794d896262312c303fad88951a29f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2017003
Reviewed-by: Marc Treib <treib@chromium.org>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Commit-Queue: Vitor Carvalho <vtrmc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#753189}
2020-03-25 12:00:01 +00:00
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
c710874894 Reland "[TaskEnvironment] Complete migration with header rename"
This is a reland of 18947083c7

The move_source_file.py script's formatting rules incorrectly
formatted services/device/generic_sensor/platform_sensor_and_provider_unittest_win.cc
after all. But we also can't rely 100% on git cl format (crbug.com/997063)
so I ended up performing a git cl format && git add -up
(+interactive addition of missing blank line after foo.h when included
from top of foo.cc)

Also added
$ tools/git/move_source_file.py net/test/test_with_scoped_task_environment.h net/test/test_with_task_environment.h

Original change's description:
> [TaskEnvironment] Complete migration with header rename
>
> This is merely:
>
> $ tools/git/move_source_file.py base/test/scoped_task_environment.h base/test/task_environment.h
> $ tools/git/move_source_file.py base/test/scoped_task_environment.cc base/test/task_environment.cc
> $ tools/git/move_source_file.py base/test/scoped_task_environment_unittest.cc base/test/task_environment_unittest.cc
> $ tools/git/move_source_file.py content/public/test/test_browser_thread_bundle.h content/public/test/browser_task_environment.h
> $ tools/git/move_source_file.py content/public/test/test_browser_thread_bundle.cc content/public/test/browser_task_environment.cc
> $ tools/git/move_source_file.py content/public/test/test_browser_thread_bundle_unittest.cc content/public/test/browser_task_environment_unittest.cc
> $ tools/git/move_source_file.py ios/web/public/test/test_web_thread_bundle.h ios/web/public/test/web_task_environment.h
> $ tools/git/move_source_file.py ios/web/test/test_web_thread_bundle.cc ios/web/test/web_task_environment.cc
>
> and a few manual renames in DEPS files missed by the script
>
> This CL uses --bypass-hooks to avoid having to git cl format because
> many headers are being reordered by git cl format and it's too many to
> figure out in a no-op CL which ones are okay with it.
> windows.h for one should typically be first and another one of the
> reorderings in PS3 even caused a compile failure:
> https://chromium-review.googlesource.com/c/chromium/src/+/1764962/3/components/services/font/font_loader_unittest.cc
>
> TBR=dcheng@chromium.org
>
> Bug: 992483
> Change-Id: I32a4afd43ef779393c95d9873c157be2d3da1dd1
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1764962
> Reviewed-by: Gabriel Charette <gab@chromium.org>
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Commit-Queue: Gabriel Charette <gab@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#689778}

TBR=dcheng@chromium.org

Bug: 992483
Change-Id: I6179dd1329a4d30bf5c65450ea893537f31e6f85
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1767658
Reviewed-by: Gabriel Charette <gab@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#689794}
2019-08-23 03:31:40 +00:00
b69fcd4f6e Revert "[TaskEnvironment] Complete migration with header rename"
This reverts commit 18947083c7.

Reason for revert: broke Win

Original change's description:
> [TaskEnvironment] Complete migration with header rename
> 
> This is merely:
> 
> $ tools/git/move_source_file.py base/test/scoped_task_environment.h base/test/task_environment.h
> $ tools/git/move_source_file.py base/test/scoped_task_environment.cc base/test/task_environment.cc
> $ tools/git/move_source_file.py base/test/scoped_task_environment_unittest.cc base/test/task_environment_unittest.cc
> $ tools/git/move_source_file.py content/public/test/test_browser_thread_bundle.h content/public/test/browser_task_environment.h
> $ tools/git/move_source_file.py content/public/test/test_browser_thread_bundle.cc content/public/test/browser_task_environment.cc
> $ tools/git/move_source_file.py content/public/test/test_browser_thread_bundle_unittest.cc content/public/test/browser_task_environment_unittest.cc
> $ tools/git/move_source_file.py ios/web/public/test/test_web_thread_bundle.h ios/web/public/test/web_task_environment.h
> $ tools/git/move_source_file.py ios/web/test/test_web_thread_bundle.cc ios/web/test/web_task_environment.cc
> 
> and a few manual renames in DEPS files missed by the script
> 
> This CL uses --bypass-hooks to avoid having to git cl format because
> many headers are being reordered by git cl format and it's too many to
> figure out in a no-op CL which ones are okay with it.
> windows.h for one should typically be first and another one of the
> reorderings in PS3 even caused a compile failure:
> https://chromium-review.googlesource.com/c/chromium/src/+/1764962/3/components/services/font/font_loader_unittest.cc
> 
> TBR=dcheng@chromium.org
> 
> Bug: 992483
> Change-Id: I32a4afd43ef779393c95d9873c157be2d3da1dd1
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1764962
> Reviewed-by: Gabriel Charette <gab@chromium.org>
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Commit-Queue: Gabriel Charette <gab@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#689778}

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

Change-Id: I9aa8ff558d1ff78cebe0c25e559c017578ad4f53
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 992483
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1767657
Reviewed-by: Gabriel Charette <gab@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#689780}
2019-08-23 02:13:29 +00:00
18947083c7 [TaskEnvironment] Complete migration with header rename
This is merely:

$ tools/git/move_source_file.py base/test/scoped_task_environment.h base/test/task_environment.h
$ tools/git/move_source_file.py base/test/scoped_task_environment.cc base/test/task_environment.cc
$ tools/git/move_source_file.py base/test/scoped_task_environment_unittest.cc base/test/task_environment_unittest.cc
$ tools/git/move_source_file.py content/public/test/test_browser_thread_bundle.h content/public/test/browser_task_environment.h
$ tools/git/move_source_file.py content/public/test/test_browser_thread_bundle.cc content/public/test/browser_task_environment.cc
$ tools/git/move_source_file.py content/public/test/test_browser_thread_bundle_unittest.cc content/public/test/browser_task_environment_unittest.cc
$ tools/git/move_source_file.py ios/web/public/test/test_web_thread_bundle.h ios/web/public/test/web_task_environment.h
$ tools/git/move_source_file.py ios/web/test/test_web_thread_bundle.cc ios/web/test/web_task_environment.cc

and a few manual renames in DEPS files missed by the script

This CL uses --bypass-hooks to avoid having to git cl format because
many headers are being reordered by git cl format and it's too many to
figure out in a no-op CL which ones are okay with it.
windows.h for one should typically be first and another one of the
reorderings in PS3 even caused a compile failure:
https://chromium-review.googlesource.com/c/chromium/src/+/1764962/3/components/services/font/font_loader_unittest.cc

TBR=dcheng@chromium.org

Bug: 992483
Change-Id: I32a4afd43ef779393c95d9873c157be2d3da1dd1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1764962
Reviewed-by: Gabriel Charette <gab@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#689778}
2019-08-23 02:05:33 +00:00
dfa3604eca [TaskEnvironment] Mass-migrate away from ScopedTaskEnvironment
(second half of
 https://chromium-review.googlesource.com/c/chromium/src/+/1756247)

This is step  of the mass migration. Some of these will be
backported to SingleThreadTaskEnvironment in a later phase.

scoped_task_environment.h will also only move in a follow-up CL.

TBR=dcheng@chromium.org

Bug: 992483
Change-Id: Ie80f083eeeb209180ab3c2884f1b566f73549cc6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1756248
Reviewed-by: Gabriel Charette <gab@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#688142}
2019-08-19 17:30:11 +00:00
3d80498323 Reland "Unify allow_credentials and credentials_mode on network::ResourceRequest"
This is a reland of 1ccc5eeed0

Original change's description:
> Unify allow_credentials and credentials_mode on network::ResourceRequest
>
> Remove allow_credentials, map allow_credentials: false to
> credentials_mode: kOmit and map allow_credentials: true to
> credentials_mode: kInclude.
>
> network::URLLoader cannot handle kSameOrigin. This CL doesn't change
> that. CORSURLLoader translates the value to either kOmit or kInclude.
>
> This works correctly even when OOR-CORS is disabled because in that
> case load flags are set in the renderer. One caveat is we will not
> be able to remove the load flags until we remove the blink-side CORS
> code (M78? M79?) with this change.
>
> This CL removes a validity check for credentials related settings in
> CorsURLLoaderFactory. Originally the check was introduced to check the
> inconsistency between credentials_mode and load flags. After that
> allow_credentials was introduced, and at
> https://crrev.com/c/chromium/src/+/1443976 the logic was changed to
> check the inconsistency between credentials_mode and allow_credentials.
> Now they are merged and we don't need the check.
>
> Bug: 799935
> Change-Id: Ic05b2d41456d91fd3f48416a3a3e8fc98e235756
> Tbr: bsimonnet@chromium.org, dimich@chromium.org, groby@chromium.org, markusheintz@chromium.org, olka@chromium.org, satorux@chromium.org, tbansal@chromium.org
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1695341
> Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
> Reviewed-by: Tom Sepez <tsepez@chromium.org>
> Reviewed-by: Greg Levin <glevin@chromium.org>
> Reviewed-by: Nico Weber <thakis@chromium.org>
> Reviewed-by: Nicolas Ouellet-Payeur <nicolaso@chromium.org>
> Reviewed-by: Friedrich [CET] <fhorschig@chromium.org>
> Reviewed-by: Marc Treib <treib@chromium.org>
> Reviewed-by: Sylvain Defresne <sdefresne@chromium.org>
> Reviewed-by: Vasilii Sukhanov <vasilii@chromium.org>
> Reviewed-by: Alexei Svitkine <asvitkine@chromium.org>
> Reviewed-by: Matt Menke <mmenke@chromium.org>
> Reviewed-by: Kyle Milka <kmilka@chromium.org>
> Reviewed-by: Wei-Yin Chen (陳威尹) <wychen@chromium.org>
> Reviewed-by: Mark Pearson <mpearson@chromium.org>
> Reviewed-by: Rebekah Potter <rbpotter@chromium.org>
> Reviewed-by: Emily Stark <estark@chromium.org>
> Reviewed-by: John Rummell <jrummell@chromium.org>
> Reviewed-by: Ganggui Tang <gogerald@chromium.org>
> Reviewed-by: Michael Martis <martis@chromium.org>
> Reviewed-by: Mathias Carlen <mcarlen@chromium.org>
> Reviewed-by: Tsuyoshi Horo <horo@chromium.org>
> Reviewed-by: Patrick Noland <pnoland@chromium.org>
> Reviewed-by: Tommy Nyquist <nyquist@chromium.org>
> Reviewed-by: Matt Reynolds <mattreynolds@chromium.org>
> Reviewed-by: Scott Violet <sky@chromium.org>
> Reviewed-by: Roman Sorokin [CET] <rsorokin@chromium.org>
> Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org>
> Reviewed-by: Takashi Toyoshima <toyoshim@chromium.org>
> Reviewed-by: David Benjamin <davidben@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#681698}

TBR=sky@chromium.org,horo@chromium.org,mpearson@chromium.org,davidben@chromium.org,thakis@chromium.org,toyoshim@chromium.org,nyquist@chromium.org,markusheintz@chromium.org,vasilii@chromium.org,jrummell@chromium.org,asvitkine@chromium.org,groby@chromium.org,bsimonnet@chromium.org,noel@chromium.org,rsorokin@chromium.org,glevin@chromium.org,yhirano@chromium.org,dimich@chromium.org,mmenke@chromium.org,nhiroki@chromium.org,sdefresne@chromium.org,tsepez@chromium.org,treib@chromium.org,estark@chromium.org,tbansal@chromium.org,gogerald@chromium.org,mattreynolds@chromium.org,wychen@chromium.org,olka@chromium.org,satorux@chromium.org,rbpotter@chromium.org,pnoland@chromium.org,fhorschig@chromium.org,martis@chromium.org,kmilka@chromium.org,jselover@chromium.org,nicolaso@chromium.org,mcarlen@chromium.org

Bug: 799935
Change-Id: Iec8067b3fed29bd6845077f5dc9c564d6640b6ff
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1722274
Reviewed-by: Yutaka Hirano <yhirano@chromium.org>
Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#681719}
2019-07-29 06:41:34 +00:00
ae8f183fc9 Revert "Unify allow_credentials and credentials_mode on network::ResourceRequest"
This reverts commit 1ccc5eeed0.

Reason for revert: causing compile failures on the
linux-chromeos-google-rel builder.

https://ci.chromium.org/p/chrome/builders/ci/linux-chromeos-google-rel/5042



Original change's description:
> Unify allow_credentials and credentials_mode on network::ResourceRequest
> 
> Remove allow_credentials, map allow_credentials: false to
> credentials_mode: kOmit and map allow_credentials: true to
> credentials_mode: kInclude.
> 
> network::URLLoader cannot handle kSameOrigin. This CL doesn't change
> that. CORSURLLoader translates the value to either kOmit or kInclude.
> 
> This works correctly even when OOR-CORS is disabled because in that
> case load flags are set in the renderer. One caveat is we will not
> be able to remove the load flags until we remove the blink-side CORS
> code (M78? M79?) with this change.
> 
> This CL removes a validity check for credentials related settings in
> CorsURLLoaderFactory. Originally the check was introduced to check the
> inconsistency between credentials_mode and load flags. After that
> allow_credentials was introduced, and at
> https://crrev.com/c/chromium/src/+/1443976 the logic was changed to
> check the inconsistency between credentials_mode and allow_credentials.
> Now they are merged and we don't need the check.
> 
> Bug: 799935
> Change-Id: Ic05b2d41456d91fd3f48416a3a3e8fc98e235756
> Tbr: bsimonnet@chromium.org, dimich@chromium.org, groby@chromium.org, markusheintz@chromium.org, olka@chromium.org, satorux@chromium.org, tbansal@chromium.org
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1695341
> Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
> Reviewed-by: Tom Sepez <tsepez@chromium.org>
> Reviewed-by: Greg Levin <glevin@chromium.org>
> Reviewed-by: Nico Weber <thakis@chromium.org>
> Reviewed-by: Nicolas Ouellet-Payeur <nicolaso@chromium.org>
> Reviewed-by: Friedrich [CET] <fhorschig@chromium.org>
> Reviewed-by: Marc Treib <treib@chromium.org>
> Reviewed-by: Sylvain Defresne <sdefresne@chromium.org>
> Reviewed-by: Vasilii Sukhanov <vasilii@chromium.org>
> Reviewed-by: Alexei Svitkine <asvitkine@chromium.org>
> Reviewed-by: Matt Menke <mmenke@chromium.org>
> Reviewed-by: Kyle Milka <kmilka@chromium.org>
> Reviewed-by: Wei-Yin Chen (陳威尹) <wychen@chromium.org>
> Reviewed-by: Mark Pearson <mpearson@chromium.org>
> Reviewed-by: Rebekah Potter <rbpotter@chromium.org>
> Reviewed-by: Emily Stark <estark@chromium.org>
> Reviewed-by: John Rummell <jrummell@chromium.org>
> Reviewed-by: Ganggui Tang <gogerald@chromium.org>
> Reviewed-by: Michael Martis <martis@chromium.org>
> Reviewed-by: Mathias Carlen <mcarlen@chromium.org>
> Reviewed-by: Tsuyoshi Horo <horo@chromium.org>
> Reviewed-by: Patrick Noland <pnoland@chromium.org>
> Reviewed-by: Tommy Nyquist <nyquist@chromium.org>
> Reviewed-by: Matt Reynolds <mattreynolds@chromium.org>
> Reviewed-by: Scott Violet <sky@chromium.org>
> Reviewed-by: Roman Sorokin [CET] <rsorokin@chromium.org>
> Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org>
> Reviewed-by: Takashi Toyoshima <toyoshim@chromium.org>
> Reviewed-by: David Benjamin <davidben@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#681698}

TBR=sky@chromium.org,horo@chromium.org,mpearson@chromium.org,davidben@chromium.org,thakis@chromium.org,toyoshim@chromium.org,nyquist@chromium.org,markusheintz@chromium.org,vasilii@chromium.org,jrummell@chromium.org,asvitkine@chromium.org,groby@chromium.org,bsimonnet@chromium.org,rsorokin@chromium.org,glevin@chromium.org,yhirano@chromium.org,dimich@chromium.org,mmenke@chromium.org,nhiroki@chromium.org,sdefresne@chromium.org,tsepez@chromium.org,treib@chromium.org,estark@chromium.org,tbansal@chromium.org,gogerald@chromium.org,mattreynolds@chromium.org,wychen@chromium.org,olka@chromium.org,satorux@chromium.org,rbpotter@chromium.org,pnoland@chromium.org,fhorschig@chromium.org,martis@chromium.org,kmilka@chromium.org,jselover@chromium.org,nicolaso@chromium.org,mcarlen@chromium.org

Change-Id: I60b04dc48cd24370db18211d2870fae2f598c9d1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 799935
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1724029
Reviewed-by: Noel Gordon <noel@chromium.org>
Commit-Queue: Noel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#681706}
2019-07-29 05:30:53 +00:00
1ccc5eeed0 Unify allow_credentials and credentials_mode on network::ResourceRequest
Remove allow_credentials, map allow_credentials: false to
credentials_mode: kOmit and map allow_credentials: true to
credentials_mode: kInclude.

network::URLLoader cannot handle kSameOrigin. This CL doesn't change
that. CORSURLLoader translates the value to either kOmit or kInclude.

This works correctly even when OOR-CORS is disabled because in that
case load flags are set in the renderer. One caveat is we will not
be able to remove the load flags until we remove the blink-side CORS
code (M78? M79?) with this change.

This CL removes a validity check for credentials related settings in
CorsURLLoaderFactory. Originally the check was introduced to check the
inconsistency between credentials_mode and load flags. After that
allow_credentials was introduced, and at
https://crrev.com/c/chromium/src/+/1443976 the logic was changed to
check the inconsistency between credentials_mode and allow_credentials.
Now they are merged and we don't need the check.

Bug: 799935
Change-Id: Ic05b2d41456d91fd3f48416a3a3e8fc98e235756
Tbr: bsimonnet@chromium.org, dimich@chromium.org, groby@chromium.org, markusheintz@chromium.org, olka@chromium.org, satorux@chromium.org, tbansal@chromium.org
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1695341
Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Greg Levin <glevin@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Nicolas Ouellet-Payeur <nicolaso@chromium.org>
Reviewed-by: Friedrich [CET] <fhorschig@chromium.org>
Reviewed-by: Marc Treib <treib@chromium.org>
Reviewed-by: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: Vasilii Sukhanov <vasilii@chromium.org>
Reviewed-by: Alexei Svitkine <asvitkine@chromium.org>
Reviewed-by: Matt Menke <mmenke@chromium.org>
Reviewed-by: Kyle Milka <kmilka@chromium.org>
Reviewed-by: Wei-Yin Chen (陳威尹) <wychen@chromium.org>
Reviewed-by: Mark Pearson <mpearson@chromium.org>
Reviewed-by: Rebekah Potter <rbpotter@chromium.org>
Reviewed-by: Emily Stark <estark@chromium.org>
Reviewed-by: John Rummell <jrummell@chromium.org>
Reviewed-by: Ganggui Tang <gogerald@chromium.org>
Reviewed-by: Michael Martis <martis@chromium.org>
Reviewed-by: Mathias Carlen <mcarlen@chromium.org>
Reviewed-by: Tsuyoshi Horo <horo@chromium.org>
Reviewed-by: Patrick Noland <pnoland@chromium.org>
Reviewed-by: Tommy Nyquist <nyquist@chromium.org>
Reviewed-by: Matt Reynolds <mattreynolds@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Roman Sorokin [CET] <rsorokin@chromium.org>
Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org>
Reviewed-by: Takashi Toyoshima <toyoshim@chromium.org>
Reviewed-by: David Benjamin <davidben@chromium.org>
Cr-Commit-Position: refs/heads/master@{#681698}
2019-07-29 03:54:15 +00:00
f54b63324b OWNERS files updated with latest COMPONENT and TEAMS.
This is CL is generated by a script. Data is pulled from
review conducted in Q2 2019. See https://tinyurl.com/yxau5sc4
for context.

Please review and LGTM before July 16th or the CL will be
submitted as-is.

TBR=michaelpg@chromium.org
NOTRY=true

Bug: 977050
Change-Id: Ie7ca3cfa8d13a7248f98608ba26c42d176b7c217
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1700780
Reviewed-by: Michael Giuffrida <michaelpg@chromium.org>
Commit-Queue: Michael Giuffrida <michaelpg@chromium.org>
Auto-Submit: Eric Foo <efoo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#677859}
2019-07-16 17:36:24 +00:00
591e041241 Remove LOAD_DO_NOT_* credentials flags and replace them with
allow_credentials, removing HTTP authentication data.

This CL is part of a larger project to remove the LOAD_DO_NOT_* privacy load
flags and replace them with the allow_credentials setting. See
https://crbug.com/799935,
https://docs.google.com/document/d/1ntn9N7Ce2jozvvpWI0XbzJ7lJdwUjJXK07wp7rxrIN4,
and
go/allow-credentials-tracker
for the motivation and progress of this change.

This CL handles a third of cases where LOAD_DO_NOT_SEND_COOKIES and
LOAD_DO_NOT_SAVE_COOKIES were set, but LOAD_DO_NOT_SEND_AUTH_DATA was not.
This CL will set allow_credentials = false instead, which will make two
changes to the requests:
- The request will no longer participate in HTTP auth if the server requests
  it. HTTP auth credentials identify the user, so private requests should
  not send them. Note this only affects server auth, not proxy auth. Unless
  the server your feature speaks to requests HTTP auth, this is a no-op.
- The request will be pooled with sockets used for uncredentialed requests,
  rather than credentialed requests. This is not expected to meaningfully
  change behavior.

If your code requires HTTP authentication, let me know. You may need to
allow credentials for your request.

Bug: 799935
Change-Id: Iaa33d56644b53f77701a8254fe7eb2b952eb0f18
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1580589
Reviewed-by: David Benjamin <davidben@chromium.org>
Reviewed-by: Patrick Noland <pnoland@chromium.org>
Reviewed-by: Cait Phillips <caitkp@chromium.org>
Reviewed-by: Ahmed Fakhry <afakhry@chromium.org>
Reviewed-by: rajendrant <rajendrant@chromium.org>
Reviewed-by: Jian Li <jianli@chromium.org>
Commit-Queue: Jesse Selover <jselover@chromium.org>
Cr-Commit-Position: refs/heads/master@{#660170}
2019-05-15 22:19:58 +00:00
a957f14a87 Replace or remove many TODO(treib)s
Several of the TODOs assigned to me have corresponding bugs, and are
updated to refer to those instead. Some others are obsolete or
irrelevant and are simply removed.

TBR=treib

Bug: none
Change-Id: I5f79759f208a8c19f8c6a14fd64f9c42f4991ce4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1552804
Reviewed-by: Marc Treib <treib@chromium.org>
Commit-Queue: Marc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#647701}
2019-04-04 12:24:19 +00:00
ccae107adb Separate URLChecker synchronous and asynchronous logic.
Create interface URLCheckerClient to request server and check URL.
Create SafeSearchURLCheckerClient to check url using safesearch.
Leave only the synchronous logic in URLChecker.

BUG=934444

Change-Id: I53106ead0a478227960b49faa27a5d5c9d5c982e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1479971
Commit-Queue: Caio Lima <caiol@google.com>
Reviewed-by: Maksim Ivanov <emaxx@chromium.org>
Reviewed-by: Michael Giuffrida <michaelpg@chromium.org>
Reviewed-by: Marc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#638554}
2019-03-07 13:46:54 +00:00
c203e31e94 Add michaelpg to components/safe_search_api/OWNERS
Bug: none
Change-Id: I0e231db489533fc8b981ad64e68e0bed2cdfb3b2
Reviewed-on: https://chromium-review.googlesource.com/c/1482983
Reviewed-by: Michael Giuffrida <michaelpg@chromium.org>
Commit-Queue: Michael Giuffrida <michaelpg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#634783}
2019-02-22 19:42:52 +00:00
db28ad35e3 Use base::JSONReader::ReadDeprecated() in components/.
This is part of the process to help migrate base::JSONReader::Read() to
return base::Optional<base::Value>.

Do the same for ReadAndReturnError() and ReadToValue().

BUG=925165
TBR=sdefresne@chromium.org

Change-Id: I3a6b5b5d581ece4771f1525e465aae7af20afddf
Reviewed-on: https://chromium-review.googlesource.com/c/1476093
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#632876}
2019-02-16 02:31:55 +00:00
53801a30c6 Include base/bind.h in the files that use it (in //component).
Gab/Francois, I've used your refactoring script for this, the rule is:
  matches = re.compile(r'(\n *[^/\n][^/\n]*base::Bind(Once|Repeating)?\b[^*])', re.DOTALL).findall(content)

  if not matches:
    return False

  updated_content = refactor_lib.AddInclude(file_path, content, "base/bind.h")

  if updated_content == content:
    return False

  # Write updated file
  refactor_lib.WriteFile(file_path, updated_content)

TBR=fdoray@chromium.org

Change-Id: I5c6805a75e4e11d0d30bf7dd62fb49963f922acb
Reviewed-on: https://chromium-review.googlesource.com/c/1437062
Reviewed-by: Sébastien Marchand <sebmarchand@chromium.org>
Reviewed-by: François Doray <fdoray@chromium.org>
Commit-Queue: Sébastien Marchand <sebmarchand@chromium.org>
Cr-Commit-Position: refs/heads/master@{#626093}
2019-01-25 16:26:11 +00:00
877cd81110 [scheduling] Use ScopedTaskEnvironment instead of MessageLoop in safe_search_api
MessageLoop will go away, eventually.

BUG=891670

Change-Id: Icd3016627e9c59f8e16e7f8031131b17b3d44eaa
Reviewed-on: https://chromium-review.googlesource.com/c/1352765
Reviewed-by: Marc Treib <treib@chromium.org>
Commit-Queue: Carlos Caballero <carlscab@google.com>
Cr-Commit-Position: refs/heads/master@{#611707}
2018-11-28 15:46:59 +00:00
4f9c35c363 [message_loop] Remove message_loop_forward.h
As a final step, replace all includes back:
- mv message_loop_current.h message_loop.h
- s/message_loop_forward.h/message_loop.h/ in all includes.
- s/message_loop_forward.h/message_loop.h/ in base/BUILD.gn
- Remove message_loop_forward.h from third_party/DEPS.

TBR=gab@chromium.org
R=gab@chromium.org
BUG=891670

Change-Id: I623077025701459ddb7045cbcfdad138aa90a9e4
Reviewed-on: https://chromium-review.googlesource.com/c/1313110
Reviewed-by: Alexander Timin <altimin@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#604690}
2018-11-01 20:15:20 +00:00
c643d0e146 [message_loop] Temporary introduce message_loop_forward.h.
To facilitate splitting MessageLoop into MessageLoop and MessageLoopImpl
introduce message_loop_forward.h and use it everywhere.

- s/message_loop.h/message_loop_forward.h/ in all includes.
- Add message_loop_forward.h to base/BUILD.gn.
- Add message_loop_forward.h to third_party/DEPS.

TBR=gab@chromium.org
BUG=891670

Change-Id: Ibac3a24f5bd4291c9d57dd32c627477e4e6ef324
Reviewed-on: https://chromium-review.googlesource.com/c/1313108
Reviewed-by: Gabriel Charette <gab@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#604672}
2018-11-01 19:43:28 +00:00
cecd9afbd7 Allow safe search component to use custom API key
Currently the safe search component always uses the API key gotten from
google_apis. This limits the usage of the safe search component for
projects using content shell but not Chrome directly.

This patch allows the URL checker to take a custom API key so projects
other than Chrome could also benefits from the safe search component.

Bug: b/110951484
Change-Id: Ic2aa3fea758b4dc6d43d54a582c460df1b892b91
Reviewed-on: https://chromium-review.googlesource.com/c/1309557
Reviewed-by: Marc Treib <treib@chromium.org>
Commit-Queue: Mao Huang <littlecvr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#604498}
2018-11-01 02:57:51 +00:00
98c0de04d9 Remove bauerb@ from OWNERS files
Context: http://shortn/_Yfz0RFm2Gt

Bug: It's a feature
Change-Id: I22985dbdef6d47ef2e83f697b1d9ea8bb68b1e17
Reviewed-on: https://chromium-review.googlesource.com/1208524
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Reviewed-by: Peter Conn <peconn@chromium.org>
Reviewed-by: Michael van Ouwerkerk <mvanouwerkerk@chromium.org>
Commit-Queue: Bernhard Bauer <bauerb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#590024}
2018-09-10 19:32:23 +00:00
01d7b5dfa3 Check SafeSearch API in PolicyBlacklistNavigationThrottle
When the SafeSitesFilterBehavior policy is enabled, filter top-level
HTTP[S] navigations using Google's SafeSearch API (porn classifier).

The SafeSites check is skipped if the URL is blacklisted or whitelisted
by policy.

This check is added to the existing PolicyBlacklistNavigationThrottle
instead of creating a standalone navigation throttle because it depends
on the blacklist/whitelist check that's already there, and conceptually
serves a similar purpose (determining if a URL should be blocked by
policy).

Bug: 819405
Change-Id: Ica243fdbf44b06a2fc4148fb68f47a11d9b79a6b
Reviewed-on: https://chromium-review.googlesource.com/1119102
Commit-Queue: Michael Giuffrida <michaelpg@chromium.org>
Reviewed-by: Ramin Halavati <rhalavati@chromium.org>
Reviewed-by: Julian Pastarmov <pastarmovj@chromium.org>
Reviewed-by: Marc Treib <treib@chromium.org>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584681}
2018-08-21 07:55:54 +00:00
9cf3d7f024 Move google_util from components/google/browser to components/google/common so that it can be called in the renderer.
Bug: 841313
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I751bf47bf452e6dc365939131fd1e95ceee64d50
Reviewed-on: https://chromium-review.googlesource.com/1152502
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#578523}
2018-07-27 02:40:39 +00:00
c4efa79a1c Provide user's region code for Safe Search API.
Bug: 857533
Change-Id: I1aa1d88ba50f179fa73b1d563f7e3bc45d1176e4
Reviewed-on: https://chromium-review.googlesource.com/1122637
Commit-Queue: Bruno Kim Medeiros Cesar <brunokim@chromium.org>
Reviewed-by: Marc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#575298}
2018-07-16 16:33:57 +00:00
3095bafd9f Disable Safe Search whitelist for Google properties with feature flag.
We plan to remove this code in the next release, but for now we'll keep
it behind a "live switch" so that we may re-enable in the server if
necessary.

Bug: 859097
Change-Id: I6c86e92de4b79c1a622a559b30840b9442f76716
Reviewed-on: https://chromium-review.googlesource.com/1122636
Commit-Queue: Bruno Kim Medeiros Cesar <brunokim@chromium.org>
Reviewed-by: Marc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#572554}
2018-07-04 14:02:04 +00:00
2cc3a9cef0 Move safe_search_api to //components
The SafeSearchURLChecker didn't depend on //chrome. Move it to a new
safe_search_api component.

We will reuse safe_search_api::URLChecker in a later CL for filtering
URLs based on the SafeSearch API (a generalization of
SupervisedUserURLFilter).

Because we're creating a namespace, we can drop the SafeSearch prefix
and move the Classification enum out of the URLChecker class. Also clean
up presubmit issues in changed lines.

Bug: 819405
Change-Id: Iaf411b1232eb937f93056d8e3553435fb7779bee
Reviewed-on: https://chromium-review.googlesource.com/1081892
Reviewed-by: Bernhard Bauer <bauerb@chromium.org>
Reviewed-by: Ilya Sherman <isherman@chromium.org>
Reviewed-by: Matt Menke <mmenke@chromium.org>
Reviewed-by: Cait Phillips <caitkp@chromium.org>
Reviewed-by: Roger Tawa <rogerta@chromium.org>
Commit-Queue: Michael Giuffrida <michaelpg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#565486}
2018-06-08 00:33:11 +00:00