summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browsing_data_remover.cc
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-14 19:09:10 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-14 19:09:10 +0000
commit6828b596c4aa6fa0376125c6a8f97dbfeafe23f3 (patch)
tree81a1149af045a79f04ea8bcc4a19bd87371da73e /chrome/browser/browsing_data_remover.cc
parent24f98bbac219f4fe06cf445b36b17cd35a74c66f (diff)
downloadchromium_src-6828b596c4aa6fa0376125c6a8f97dbfeafe23f3.zip
chromium_src-6828b596c4aa6fa0376125c6a8f97dbfeafe23f3.tar.gz
chromium_src-6828b596c4aa6fa0376125c6a8f97dbfeafe23f3.tar.bz2
Clear media cache when clearing browsing data
BUG=24765 BUG=24813 TEST=run Chromium with --enable-byte-range-support, watch a movie, clear browsing data, Media Cache folder shouldn't have the cache files. Clear media cache when clearing browsing data. What's missing in this patch is that disk_cache in HttpCache is lazily initialized, so it has to be used at least once before we can clear it. Review URL: http://codereview.chromium.org/275013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28992 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browsing_data_remover.cc')
-rw-r--r--chrome/browser/browsing_data_remover.cc17
1 files changed, 15 insertions, 2 deletions
diff --git a/chrome/browser/browsing_data_remover.cc b/chrome/browser/browsing_data_remover.cc
index fb48c53..e6e2071 100644
--- a/chrome/browser/browsing_data_remover.cc
+++ b/chrome/browser/browsing_data_remover.cc
@@ -230,8 +230,21 @@ void BrowsingDataRemover::ClearCacheOnIOThread(base::Time delete_begin,
profile_->GetRequestContext()->http_transaction_factory();
disk_cache::Backend* cache = factory->GetCache()->disk_cache();
- // The cache can be empty, for example on startup, in which case |cache| will
- // be null and we don't need to do anything.
+ // |cache| can be null since it is lazily initialized, in this case we do
+ // nothing.
+ if (cache) {
+ if (delete_begin.is_null())
+ cache->DoomAllEntries();
+ else
+ cache->DoomEntriesBetween(delete_begin, delete_end);
+ }
+
+ // Get a pointer to the media cache.
+ factory = profile_->GetRequestContextForMedia()->http_transaction_factory();
+ cache = factory->GetCache()->disk_cache();
+
+ // |cache| can be null since it is lazily initialized, in this case we do
+ // nothing.
if (cache) {
if (delete_begin.is_null())
cache->DoomAllEntries();