Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Unified Diff: chrome/browser/browsing_data_remover.cc

Issue 7210006: AppCaches which belong to hosted apps are not protected from deletion (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Test beautification. Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/browsing_data_remover.cc
diff --git a/chrome/browser/browsing_data_remover.cc b/chrome/browser/browsing_data_remover.cc
index 70083fec65abd80c63ab05dcb2768e0dac006baf..01b0ce36e2fabd1b9dcc53f03e3976b1df23a29d 100644
--- a/chrome/browser/browsing_data_remover.cc
+++ b/chrome/browser/browsing_data_remover.cc
@@ -67,11 +67,8 @@ BrowsingDataRemover::BrowsingDataRemover(Profile* profile,
this, &BrowsingDataRemover::OnClearedDatabases)),
ALLOW_THIS_IN_INITIALIZER_LIST(cache_callback_(
this, &BrowsingDataRemover::DoClearCache)),
- ALLOW_THIS_IN_INITIALIZER_LIST(appcache_got_info_callback_(
- this, &BrowsingDataRemover::OnGotAppCacheInfo)),
- ALLOW_THIS_IN_INITIALIZER_LIST(appcache_deleted_callback_(
- this, &BrowsingDataRemover::OnAppCacheDeleted)),
- appcaches_to_be_deleted_count_(0),
+ ALLOW_THIS_IN_INITIALIZER_LIST(appcache_cleared_callback_(
+ this, &BrowsingDataRemover::OnClearedAppCache)),
next_cache_state_(STATE_NONE),
cache_(NULL),
main_context_getter_(profile->GetRequestContext()),
@@ -97,11 +94,8 @@ BrowsingDataRemover::BrowsingDataRemover(Profile* profile,
this, &BrowsingDataRemover::OnClearedDatabases)),
ALLOW_THIS_IN_INITIALIZER_LIST(cache_callback_(
this, &BrowsingDataRemover::DoClearCache)),
- ALLOW_THIS_IN_INITIALIZER_LIST(appcache_got_info_callback_(
- this, &BrowsingDataRemover::OnGotAppCacheInfo)),
- ALLOW_THIS_IN_INITIALIZER_LIST(appcache_deleted_callback_(
- this, &BrowsingDataRemover::OnAppCacheDeleted)),
- appcaches_to_be_deleted_count_(0),
+ ALLOW_THIS_IN_INITIALIZER_LIST(appcache_cleared_callback_(
+ this, &BrowsingDataRemover::OnClearedAppCache)),
next_cache_state_(STATE_NONE),
cache_(NULL),
main_context_getter_(profile->GetRequestContext()),
@@ -514,11 +508,11 @@ void BrowsingDataRemover::ClearDatabasesOnFILEThread() {
OnClearedDatabases(rv);
}
-void BrowsingDataRemover::OnClearedAppCache() {
+void BrowsingDataRemover::OnClearedAppCache(int rv) {
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
bool result = BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
- NewRunnableMethod(this, &BrowsingDataRemover::OnClearedAppCache));
+ NewRunnableMethod(this, &BrowsingDataRemover::OnClearedAppCache, rv));
DCHECK(result);
return;
}
@@ -529,40 +523,8 @@ void BrowsingDataRemover::OnClearedAppCache() {
void BrowsingDataRemover::ClearAppCacheOnIOThread() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DCHECK(waiting_for_clear_appcache_);
- appcache_info_ = new appcache::AppCacheInfoCollection;
- appcache_service_->GetAllAppCacheInfo(
- appcache_info_, &appcache_got_info_callback_);
- // continues in OnGotAppCacheInfo.
-}
-
-void BrowsingDataRemover::OnGotAppCacheInfo(int rv) {
- using appcache::AppCacheInfoVector;
- typedef std::map<GURL, AppCacheInfoVector> InfoByOrigin;
-
- for (InfoByOrigin::const_iterator origin =
- appcache_info_->infos_by_origin.begin();
- origin != appcache_info_->infos_by_origin.end(); ++origin) {
- if (special_storage_policy_->IsStorageProtected(origin->first))
- continue;
- for (AppCacheInfoVector::const_iterator info = origin->second.begin();
- info != origin->second.end(); ++info) {
- if (info->creation_time > delete_begin_) {
- ++appcaches_to_be_deleted_count_;
- appcache_service_->DeleteAppCacheGroup(
- info->manifest_url, &appcache_deleted_callback_);
- }
- }
- }
-
- if (!appcaches_to_be_deleted_count_)
- OnClearedAppCache();
- // else continues in OnAppCacheDeleted
-}
-
-void BrowsingDataRemover::OnAppCacheDeleted(int rv) {
- --appcaches_to_be_deleted_count_;
- if (!appcaches_to_be_deleted_count_)
- OnClearedAppCache();
+ appcache_service_->ClearAppCache(&appcache_cleared_callback_);
michaeln 2011/07/14 00:42:34 The code in this CL isn't looking at the delete_be
marja(google) 2011/07/14 10:31:59 Ah, indeed, that's a bug. Thanks for pointing it o
michaeln 2011/07/14 22:53:16 ...
+ // Continues in OnClearedAppCache.
}
void BrowsingDataRemover::ClearFileSystemsOnFILEThread() {

Powered by Google App Engine
This is Rietveld 408576698