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}
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}
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}
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}
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}
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.ccTBR=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}
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}
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}
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}
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.orgR=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}
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}
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}
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}
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}
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}