0
Commit Graph

38 Commits

Author SHA1 Message Date
Daniel Cheng
cb3ab647b4 Simplify BrowserContext::ForEachLoadedStoragePartition with FunctionRef.
base::RepeatingCallback is intended for asynchronous callbacks. In this
case, the callback is always synchronously invoked, so use
base::FunctionRef to make it easier to write adapter lambdas.

Change-Id: I77dba1bab5d95c4f44a2d62e51ceeb232493ba84
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5050415
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Owners-Override: Rakina Zata Amni <rakina@chromium.org>
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1227827}
2023-11-22 06:41:59 +00:00
Xiyuan Xia
b24ccf3670 Revert "cros: Dispose storage partition used for gaia sign-in"
This reverts commit 36ea585db1.

http://crrev.com/c/3691982 introduced DisposeStoragePartition
to ditch the one-time storage partition used in ChromeOS sign-in.
It turns out it is unsafe to dispose SPs because they could
referenced later, even after <webview> referencing them are
destroyed. We hit UAF like in http://crbug/1382971. This CL
removes the unsafe API.

The memory issue will be fixed in a different way.

Bug: 1308831, b:260522812
Change-Id: Ic6d1b219037f8424bc8031415b7cd2e2238336fa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4184936
Commit-Queue: Xiyuan Xia <xiyuan@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1095918}
2023-01-24 00:08:28 +00:00
Avi Drissman
adac219925 Update header includes for /base/functional in /content
bind.h, callback.h, callback_forward.h, and callback_helpers.h
moved into /base/functional/. Update the include paths to
directly include them in their new location.

Bug: 1364441
Change-Id: I32ec425b9c0e52ec4b50047bf3290fecc5c905ff
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4148554
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Auto-Submit: Avi Drissman <avi@chromium.org>
Owners-Override: Avi Drissman <avi@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1091567}
2023-01-11 23:46:39 +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
Xiyuan Xia
36ea585db1 cros: Dispose storage partition used for gaia sign-in
Each gaia sign-in attempt creates an in-memory storage partition.
After the sign-in attempt, the storage partition needs to be disposed.
Otherwise, they are kept around indefinite, which wastes memory.

Bug: 1308831
Cq-Include-Trybots: luci.chromium.try:linux_chromium_chromeos_msan_rel_ng
Change-Id: I4631a2b1630ce6d37b863e3ec0aebc635c6179c8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3691982
Reviewed-by: Achuith Bhandarkar <achuith@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Austin Sullivan <asully@chromium.org>
Commit-Queue: Xiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1016742}
2022-06-22 16:17:23 +00:00
Lei Zhang
3ea7594623 Simplify BrowserContext::GarbageCollectStoragePartitions().
Just pass a std::unordered_set around, and don't bother wrapping it
inside a std::unique_ptr. Along the way, modernize / clean up its caller
and callee.

Change-Id: Ie4c451faea7e513df33c2ecfc1d48f7d32f3e271
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3400550
Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: Charles Reis <creis@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#961489}
2022-01-20 16:57:03 +00:00
Keishi Hattori
0e45c020c4 Rewrite most Foo* field_ pointer fields to raw_ptr<Foo> field_.
DO NOT REVERT (unless absolutely necessary)! Report build breaks to keishi@(APAC)/glazunov@(EMEA)/sebmarchand@(NA) as soon as you see them. Fixes are expected to be trivial.

This commit was generated automatically, by running the following script: tools/clang/rewrite_raw_ptr_fields/rewrite-multiple-platforms.sh on commit fe74bc434e

For more information, see MiraclePtr One Pager [1], the PSA at chromium-dev@ [2], and the raw_ptr documentation in //base/memory/raw_ptr.md.

FYI This CL does not enable MiraclePtr protection and we expect no behavior change from this.

[1] https://docs.google.com/document/d/1pnnOAIz_DMWDI4oIOFoMAqLnf_MZ2GsrJNb_dbQ3ZBg/edit?usp=sharing
[2] https://groups.google.com/a/chromium.org/g/chromium-dev/c/vAEeVifyf78/m/SkBUc6PhBAAJ

Binary-Size: Increase of around 500kb was approved for MiraclePtr
Include-Ci-Only-Tests: true
No-Tree-Checks: true
No-Presubmit: true
Bug: 1272324, 1073933
Change-Id: I05c86a83bbb4b3f4b017f361dd7f4e7437697f69
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3305132
Commit-Queue: Keishi Hattori <keishi@chromium.org>
Reviewed-by: Bartek Nowierski <bartekn@chromium.org>
Owners-Override: Bartek Nowierski <bartekn@chromium.org>
Cr-Commit-Position: refs/heads/main@{#945735}
2021-11-27 09:25:52 +00:00
Lei Zhang
7ab31375dd Do IWYU for content_export.h
Headers that use CONTENT_EXPORT should include content_export.h.

Change-Id: I66b65c9c3a963d1f4677172b12ef0966448e1609
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3282640
Commit-Queue: Lei Zhang <thestig@chromium.org>
Auto-Submit: Lei Zhang <thestig@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Owners-Override: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#942394}
2021-11-17 01:26:00 +00:00
Peter Boström
1d6a095400 Remove unused "base/macros.h" in content/
Removes `#include "base/macros.h"` from files in content/ that do not
contain `ignore_result(`.

Bug: 1010217
No-Try: true
Change-Id: I887403408704241047e3bd66e953ff7df195368b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3274993
Commit-Queue: Peter Boström <pbos@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#940781}
2021-11-11 16:07:03 +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
Maria Petrisor
2d611d62e6 Add callback to extension uninstall
We added an optional callback to ExtensionService::UninstallExtension()
in order to be informed about when the extension data is safely deleted
(ExtensionService::UninstallExtensionOnFileThread() and
DataDeleter::StartDeleting()).

This is part of a bigger effort to create a data clean-up mechanism for
Chrome apps/extensions. Since Chrome apps/extensions don’t have a
built-in “reset” operation, we uninstall them to fully clear their state
(thus we need to wait for the data to be completely deleted) and
reinstall them back.

More details can be found here: go/imprivata-extension-data-cleanup

Bug: b:186737187
Change-Id: I49ef81af3b5573169ac681c137b3a00798817899
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3109967
Commit-Queue: Maria Petrisor <mpetrisor@chromium.org>
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Nate Fischer <ntfschr@chromium.org>
Reviewed-by: Alexander Hendrich <hendrich@chromium.org>
Cr-Commit-Position: refs/heads/main@{#917859}
2021-09-02 22:44:15 +00:00
Bret Sepulveda
566521534d Reland "Add StoragePartitionConfig class."
This reverts commit e16ff9f100.

Reason for revert: Bot was still red after revert: https://ci.chromium.org/p/chromium/builders/ci/WebKit%20Linux%20Leak/15944

Original change's description:
> Revert "Add StoragePartitionConfig class."
> 
> This reverts commit 225f6f4c82.
> 
> Reason for revert: I think this is causing failures in:
> virtual/omt-worker-fetch/external/wpt/workers/modules/dedicated-worker-import.any.worker.html
> http/tests/workers/worker-usecounter.html
> virtual/omt-worker-fetch/http/tests/workers/worker-usecounter.html
> and the "webkit_lint" step.
> See example failure: https://ci.chromium.org/p/chromium/builders/ci/Win10%20Tests%20x64/47132
> 
> Original change's description:
> > Add StoragePartitionConfig class.
> > 
> > Introducing StoragePartitionConfig to make it easier for code to
> > directly request the StoragePartition they need instead of having to
> > go through the indirection of site URLs. Grouping the 3 attributes of
> > a config into a class also makes several call sites simpler. This is
> > being done as part of an effort to reduce the amount of code that
> > depends on site URLs.
> > 
> > - Created class for storing the storage partition
> >   <domain, name, in_memory> tuple.
> > - Update GetStoragePartitionConfigForSite() and related code to use
> >   this new class.
> > - Create BrowserContest::GetStoragePartition() method that takes
> >   StoragePartitionConfig as a parameter so future callers do not need
> >   to construct a site URL to get a storage partition.
> > - Remove StoragePartitionImplMap::StoragePartitionConfig struct and
> >   convert StoragePartitionImplMap to use the new StoragePartitionConfig
> >   class.
> > 
> > Bug: 1085275
> > Change-Id: I6679ee79ce88cf7cbfdfeb2686452d0cfcc1a9c3
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2253240
> > Commit-Queue: Aaron Colwell <acolwell@chromium.org>
> > Reviewed-by: Aaron Colwell <acolwell@chromium.org>
> > Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
> > Reviewed-by: James MacLean <wjmaclean@chromium.org>
> > Reviewed-by: Karan Bhatia <karandeepb@chromium.org>
> > Auto-Submit: Aaron Colwell <acolwell@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#781691}
> 
> TBR=acolwell@chromium.org,alexmos@chromium.org,karandeepb@chromium.org,wjmaclean@chromium.org
> 
> Change-Id: Iec47df87cb66a779d2d569e825c9b4ecccf1f2ef
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: 1085275
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2263216
> Reviewed-by: Bret Sepulveda <bsep@chromium.org>
> Commit-Queue: Bret Sepulveda <bsep@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#781798}

TBR=acolwell@chromium.org,alexmos@chromium.org,bsep@chromium.org,karandeepb@chromium.org,wjmaclean@chromium.org

# Not skipping CQ checks because this is a reland.

Bug: 1085275
Change-Id: I6eaf4a96de9e08f93e450f708cf6eea5c33ec5b4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2264292
Reviewed-by: Bret Sepulveda <bsep@chromium.org>
Commit-Queue: Bret Sepulveda <bsep@chromium.org>
Cr-Commit-Position: refs/heads/master@{#781864}
2020-06-24 14:47:13 +00:00
Bret Sepulveda
e16ff9f100 Revert "Add StoragePartitionConfig class."
This reverts commit 225f6f4c82.

Reason for revert: I think this is causing failures in:
virtual/omt-worker-fetch/external/wpt/workers/modules/dedicated-worker-import.any.worker.html
http/tests/workers/worker-usecounter.html
virtual/omt-worker-fetch/http/tests/workers/worker-usecounter.html
and the "webkit_lint" step.
See example failure: https://ci.chromium.org/p/chromium/builders/ci/Win10%20Tests%20x64/47132

Original change's description:
> Add StoragePartitionConfig class.
> 
> Introducing StoragePartitionConfig to make it easier for code to
> directly request the StoragePartition they need instead of having to
> go through the indirection of site URLs. Grouping the 3 attributes of
> a config into a class also makes several call sites simpler. This is
> being done as part of an effort to reduce the amount of code that
> depends on site URLs.
> 
> - Created class for storing the storage partition
>   <domain, name, in_memory> tuple.
> - Update GetStoragePartitionConfigForSite() and related code to use
>   this new class.
> - Create BrowserContest::GetStoragePartition() method that takes
>   StoragePartitionConfig as a parameter so future callers do not need
>   to construct a site URL to get a storage partition.
> - Remove StoragePartitionImplMap::StoragePartitionConfig struct and
>   convert StoragePartitionImplMap to use the new StoragePartitionConfig
>   class.
> 
> Bug: 1085275
> Change-Id: I6679ee79ce88cf7cbfdfeb2686452d0cfcc1a9c3
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2253240
> Commit-Queue: Aaron Colwell <acolwell@chromium.org>
> Reviewed-by: Aaron Colwell <acolwell@chromium.org>
> Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
> Reviewed-by: James MacLean <wjmaclean@chromium.org>
> Reviewed-by: Karan Bhatia <karandeepb@chromium.org>
> Auto-Submit: Aaron Colwell <acolwell@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#781691}

TBR=acolwell@chromium.org,alexmos@chromium.org,karandeepb@chromium.org,wjmaclean@chromium.org

Change-Id: Iec47df87cb66a779d2d569e825c9b4ecccf1f2ef
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1085275
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2263216
Reviewed-by: Bret Sepulveda <bsep@chromium.org>
Commit-Queue: Bret Sepulveda <bsep@chromium.org>
Cr-Commit-Position: refs/heads/master@{#781798}
2020-06-24 10:48:36 +00:00
Aaron Colwell
225f6f4c82 Add StoragePartitionConfig class.
Introducing StoragePartitionConfig to make it easier for code to
directly request the StoragePartition they need instead of having to
go through the indirection of site URLs. Grouping the 3 attributes of
a config into a class also makes several call sites simpler. This is
being done as part of an effort to reduce the amount of code that
depends on site URLs.

- Created class for storing the storage partition
  <domain, name, in_memory> tuple.
- Update GetStoragePartitionConfigForSite() and related code to use
  this new class.
- Create BrowserContest::GetStoragePartition() method that takes
  StoragePartitionConfig as a parameter so future callers do not need
  to construct a site URL to get a storage partition.
- Remove StoragePartitionImplMap::StoragePartitionConfig struct and
  convert StoragePartitionImplMap to use the new StoragePartitionConfig
  class.

Bug: 1085275
Change-Id: I6679ee79ce88cf7cbfdfeb2686452d0cfcc1a9c3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2253240
Commit-Queue: Aaron Colwell <acolwell@chromium.org>
Reviewed-by: Aaron Colwell <acolwell@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: James MacLean <wjmaclean@chromium.org>
Reviewed-by: Karan Bhatia <karandeepb@chromium.org>
Auto-Submit: Aaron Colwell <acolwell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#781691}
2020-06-24 03:51:52 +00:00
Brandon Maslen
dd4ba9e02f Add GetStoragePartitionCount to BrowserContext
During another change/need to iterate over all storage
partitions it was noticed that other places in Chromium
have the same requirement. This change exposts a
GetStoragePartitionCount method off of

having to iterate over the collection of partitions to
achieve the same result. In addition the existing call
site of this method has been updated to call the
BrowserContext version.

content: :BrowserContext in order to avoid other classes
Change-Id: Ie60b726841f6955f7df5128cbe89955ea0e3a98d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2057808
Commit-Queue: Brandon Maslen <brandm@microsoft.com>
Reviewed-by: Matt Falkenhagen <falken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#742810}
2020-02-19 21:52:37 +00:00
danakj
151f8fdd0c Convert Callbacks to {Once,Repeating}Callback in content/browser/
Use OnceCallback where possible because the callback is only used once
and RepeatingCallback and BindRepeating otherwise.

Pass RepeatingCallback ownership by value instead of const ref.

R=avi@chromium.org

Bug: 1007760
Change-Id: I18ea04793d877ab91733dc3ecba363c2509ea68a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1961134
Commit-Queue: danakj <danakj@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Auto-Submit: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#723678}
2019-12-11 03:11:14 +00:00
danakj
6a28d7d586 Convert base::Bind to base::Bind{Once,Repeating} in content/public/.
Use OnceCallback where possible, otherwise rename to RepeatingCallback
and BindRepeating.

R=avi@chromium.org

Bug: 1007763
Change-Id: I06c210dafc3066d4b26da90e484d3099dcf28b4d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1958891
Commit-Queue: danakj <danakj@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#723401}
2019-12-10 18:56:29 +00:00
Aaron Colwell
dd0ae764d5 Replace site URL with partition_domain in BrowserContext::AsyncObliterateStoragePartition()
This change simply removes the need to wrap the extension ID in a site URL and then
immediately extract it to delete the partition. The partition_domain is always the
extension ID so I'm just making that fact explicit.

Bug: None
Change-Id: Ie138d70a3489d6bbdf927190ebb811664c47d398
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1947813
Commit-Queue: Aaron Colwell <acolwell@chromium.org>
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Auto-Submit: Aaron Colwell <acolwell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#722246}
2019-12-05 22:24:57 +00:00
Takuto Ikuta
fc262dcd40 Remove include of base/containers/hash_tables.h except base/
Added some unordered_map/unordered_set include instead to fix build.

Bug: 576864
TBR: thakis@chromium.org
Change-Id: I8a23d908af392ced8fb2df0073e64e8020acc5fd
Reviewed-on: https://chromium-review.googlesource.com/c/1398161
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#620639}
2019-01-08 06:26:58 +00:00
Takuto Ikuta
8332bf9da1 Replace base::hash_set with std::unordered_set
base::hash_set is alias of std::unordered_set now.

I applied following command to make this CL.

$ git grep -l 'base::hash_set' | fgrep -v base/ | xargs sed -i -e 's/base::hash_set/std::unordered_set/g' -e 's/\(#include <[a-z_]*>\)/\1\n#include <unordered_set>/' -e 's/BASE_HASH_NAMESPACE/std/'
$ git cl format

TBR: dcheng@chromium.org
Bug: 576864
Change-Id: I89535173626483c06989b4d8a99dc46c1d49ce7b
Reviewed-on: https://chromium-review.googlesource.com/c/1390887
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#620168}
2019-01-05 03:58:00 +00:00
Dan Elphick
6c0d84930d Avoid creating StoragePartitions unnecessarily
Instead check several conditions earlier to avoid getting (and thus creating)
StoragePartitions that are never used. Also adds a new parameter to
BrowserContext::GetStoragePartition to allow checking existence without
creating the StoragePartition.

Finally remove the hack in BackgroundFetchContext which preserved a
scoped_refptr to URLRequestContextGetter to ensure it was deleted on the UI
thread, now that the StoragePartition is not created and so won't create it.

Bug: 762960
Change-Id: I57055c19f485be706485477125d1434e5ae99181
Reviewed-on: https://chromium-review.googlesource.com/654874
Commit-Queue: Dan Elphick <delphick@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#501226}
2017-09-12 09:35:38 +00:00
avi
6f9a1d41f9 Remove use of stl_util's STLDeleteContainerPairSecondPointers from content/.
BUG=555865

Review-Url: https://codereview.chromium.org/2249473002
Cr-Commit-Position: refs/heads/master@{#412259}
2016-08-16 16:10:59 +00:00
dcheng
5971627d34 Convert //content/browser from scoped_ptr to std::unique_ptr
BUG=554298
R=avi@chromium.org

Review URL: https://codereview.chromium.org/1874893002

Cr-Commit-Position: refs/heads/master@{#386285}
2016-04-09 05:20:41 +00:00
tfarina
bccc34c725 Cleanup: Fix content header include guards.
The header include guards should match the file path from root.

These entries were found using a modified version of Eric's
fix-include-guards.py script found attached in
https://code.google.com/p/chromium/issues/detail?id=435361#c7.

BUG=435361
TEST=content_unittests
R=avi@chromium.org
TBR=avi@chromium.org

Review URL: https://codereview.chromium.org/942963003

Cr-Commit-Position: refs/heads/master@{#318520}
2015-02-27 21:33:13 +00:00
dcheng
c2282aa891 Standardize usage of virtual/override/final in content/browser/
This patch was automatically generated by applying clang fixit hints
generated by the plugin to the source tree.

BUG=417463
TBR=sky@chromium.org

Review URL: https://codereview.chromium.org/667943003

Cr-Commit-Position: refs/heads/master@{#300469}
2014-10-21 12:08:25 +00:00
tzik@chromium.org
995d058694 [Storage] Normalize storage partition path before garbage collection
Protect |active_paths| from garbage collection even when they are not direct subdirectories of |storage_root|.

BUG=328637

Review URL: https://codereview.chromium.org/314293003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275662 0039d316-1c4b-4281-b951-d872f2087c98
2014-06-07 09:03:00 +00:00
earthdok@chromium.org
33ad6ce948 Revert 219709 "Remove the Extensions URLRequestContext."
Reverted due to crashes under memory tools.
BUG=280138


> Remove the Extensions URLRequestContext.
> 
> Though chrome-extension: scheme URLs support cookies, they do not share
> a namespace with http: and https:. In particular, chrome-extension://a and
> http://a should not have the same set of cookies.
> 
> To enforce this, previously the code created a completely separate
> URLRequestContext for servicing chrome-extension: schemes. However,
> the code really only used this object as a method for conveying the
> correct cookie jar from Profile creation to a few spots where cookies
> were accessed; the rest of the URLRequestContext functionality was unused.
> 
> This CL removes the Extensions URLRequestContext code and replaces it
> with APIs that directly expose the needed net::CookieStore.
> 
> Lastly, CookieMonster::EnableFileScheme() is removed and 
> CookieMonster::Delegate is renamed CookieMonsterDelegate.
> 
> EnableFileScheme is an inherently racy API because 
> CookieMonsters are creatable on all threads and this 
> function sets an unprotected global flag. CookieMonsterDelegate
> is preferable to the nested interface because it can now be
> forward declared.
> 
> TBRing darin and sky to cover the rest of the mechanical unittest changes.
> 
> TBR=darin,sky
> BUG=158386,159193,57884
> 
> Review URL: https://chromiumcodereview.appspot.com/12546016

TBR=ajwong@chromium.org

Review URL: https://codereview.chromium.org/23551005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@219787 0039d316-1c4b-4281-b951-d872f2087c98
2013-08-27 14:39:08 +00:00
ajwong@chromium.org
44080e71f9 Remove the Extensions URLRequestContext.
Though chrome-extension: scheme URLs support cookies, they do not share
a namespace with http: and https:. In particular, chrome-extension://a and
http://a should not have the same set of cookies.

To enforce this, previously the code created a completely separate
URLRequestContext for servicing chrome-extension: schemes. However,
the code really only used this object as a method for conveying the
correct cookie jar from Profile creation to a few spots where cookies
were accessed; the rest of the URLRequestContext functionality was unused.

This CL removes the Extensions URLRequestContext code and replaces it
with APIs that directly expose the needed net::CookieStore.

Lastly, CookieMonster::EnableFileScheme() is removed and 
CookieMonster::Delegate is renamed CookieMonsterDelegate.

EnableFileScheme is an inherently racy API because 
CookieMonsters are creatable on all threads and this 
function sets an unprotected global flag. CookieMonsterDelegate
is preferable to the nested interface because it can now be
forward declared.

TBRing darin and sky to cover the rest of the mechanical unittest changes.

TBR=darin,sky
BUG=158386,159193,57884

Review URL: https://chromiumcodereview.appspot.com/12546016

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@219709 0039d316-1c4b-4281-b951-d872f2087c98
2013-08-27 05:56:17 +00:00
brettw@chromium.org
14c1c23d5a Rename base/hash_tables to base/containers/hash_tables.
Remove forwarding header

BUG=
R=avi@chromium.org

Review URL: https://codereview.chromium.org/16667019

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@205584 0039d316-1c4b-4281-b951-d872f2087c98
2013-06-11 17:52:44 +00:00
brettw@chromium.org
a3ef4830d5 Add FilePath to base namespace.
This updates headers that forward-declare it and a few random places to use the namespace explicitly. There us a using declaration in file_path.h that makes the rest compile, which we can do in future passes.
Review URL: https://codereview.chromium.org/12163003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180245 0039d316-1c4b-4281-b951-d872f2087c98
2013-02-02 05:12:33 +00:00
ajwong@chromium.org
399583b852 Garbage Collect the Storage directory on next profile start after an extension uninstall.
BUG=85127


Review URL: https://chromiumcodereview.appspot.com/11419307

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@172278 0039d316-1c4b-4281-b951-d872f2087c98
2012-12-11 09:33:42 +00:00
creis@chromium.org
14acc6453f Implement the ability to obliterate a storage partition from disk.
On the uninstall of an extension with isolated storage, we want to delete
all the data for the extension from disk as soon as possible. Because we
cannot know when various objects with state on disk 
(eg., FileSystemContext) have all been deleted, we do a best-effort delete
for any directory that we know isn't being used.

The way this gets projected into the content modulue is that each extension
defines one partition_domain. If an extension has a <webview> tag, it will
also have multiple StoragePartitions, each with a different partition_name.
If it doesn't have a <webview> tag, the partition_name is considered empty
which yields the default partition. The default partition, and all webview
partitions are peers inside the partition_domain's root directory.

This CL introduces a function that allows us to delete partiton domain.
Special care is taken to not accidentally instantiate a StoragePartition for
the domain if none current exists. This is necessary to allow us to actually
delete the whole partition domain directory.

(Patch by ajwong@chromium.org)

BUG=85127


Review URL: https://chromiumcodereview.appspot.com/11280030

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@168405 0039d316-1c4b-4281-b951-d872f2087c98
2012-11-17 12:20:10 +00:00
ajwong@chromium.org
b471cf41ed Fix on-disk structure for persistent storage in webview tags.
BUG=159464


Review URL: https://chromiumcodereview.appspot.com/11366140

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167334 0039d316-1c4b-4281-b951-d872f2087c98
2012-11-13 09:11:30 +00:00
nasko@chromium.org
1bc2831891 Webview tag creation should be using storage partitions.
BUG=145500,149726


Review URL: https://chromiumcodereview.appspot.com/11234032

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166639 0039d316-1c4b-4281-b951-d872f2087c98
2012-11-08 08:31:53 +00:00
ajwong@chromium.org
10eb2816fd continuing from http://http://codereview.chromium.org/10823241
This intentionally doesn't change the ChromeOS behavior at all.  They all still use the default FileSystemContext.

This code also exposes the normal and media URLRequestGetters via the StoragePartition, and cleans up a bit of code that was accessing the URLRequestGetter in odd ways.  Also, it makes Workers correctly use the Media Cache for Media fetches.

TBR=benjhyden,sky,davemoore,piman,mkwst,kalman
BUG=85121

Review URL: https://chromiumcodereview.appspot.com/10909182

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@157284 0039d316-1c4b-4281-b951-d872f2087c98
2012-09-18 03:04:09 +00:00
ajwong@chromium.org
71ace01735 Redo the Storage Partition directory layout to support guest tags and origin based partitions.
The new layout is
    (1) ProfileDir/Default/Storage Partitions/extensions/{ extension_id }/default/
    (2) ProfileDir/Default/Storage Partitions/extensions/{ extension_id }/{ hash(BrowserTag.partition) }/

In the future, after we add support for browser tags in webui or add support for server
administrators of websites to opt into storage isolation, we will also need:

    (3) ProfileDir/Default/Storage Partitions/origins/{ hash(origin) }/default/
    (4) ProfileDir/Default/Storage Partitions/origins/{ hash(origin) }/{ hash(BrowserTag.partition) }/

TBR=willchan
BUG=85121


Review URL: https://chromiumcodereview.appspot.com/10913265

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@157039 0039d316-1c4b-4281-b951-d872f2087c98
2012-09-16 04:01:08 +00:00
michaeln@chromium.org
55c0ecae62 AppCache and StoragePartition'ing
* Get rid of BrowserContext::GetAppCacheService and ResourceContext::GetAppCacheService as they've been replace by accessors on the StoragePartition and WorkerStoragePartition classes.

* Added a BrowsingContext::GetRequestContextForStoragePartition(id) accessor so the constellation of storage context + main request context can initialized properly. Implemented that method in chrome's Profile class in terms of the existing GetRequestContextForIsolatedApp(id) accessor.

* Hold references to the ChromeAppCacheService and ChromeBlobStorageContext inside of ResourceMessageFilter and provide accessors to them. These are for use by the ResourceDispatcherHost singleton which would otherwise not have enough context to get needed references to partitioned things.

* Widen the ResourceDispatcherHostDelegate::RequestBeginning method to also take an AppCacheService* parameter since that value can no longer be retrieved via the ResourceContext. Chrome's impl of this delegate interface needs that value to construct OfflineResourceThrottles.

* Poke at WorkerProcessHost to create ResourceMessageFilters and others to utlize the correct URLRequestContext so the right set of cookies are used in shared workers.

TBR=mihaip,sail,thakis
BUG=85121

Review URL: https://chromiumcodereview.appspot.com/10916132

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@156991 0039d316-1c4b-4281-b951-d872f2087c98
2012-09-15 05:12:34 +00:00
ajwong@chromium.org
4c3a235850 Move StoragePartition into content/public and remove BrowserContext::GetDOMStorageContext().
Eventually all the storage context accessors will be removed from BrowserContext. Instead, users should retrieve the storage context from the StoragePartition.

This also changes RenderProcessHost to take in a StoragePartition removing the need for a re-lookup its storage contexts.

BUG=85121,143486

Review URL: https://chromiumcodereview.appspot.com/10837230

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152251 0039d316-1c4b-4281-b951-d872f2087c98
2012-08-18 08:54:34 +00:00