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

Side by Side Diff: chrome/browser/browsing_data_remover.cc

Issue 9358050: BrowsingDataRemover: Enable origin-based deletion for quota-managed data. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to ToT. Created 8 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/browsing_data_remover.h" 5 #include "chrome/browser/browsing_data_remover.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 // Remove data such as local databases, STS state, etc. These only can 282 // Remove data such as local databases, STS state, etc. These only can
283 // be removed if a WEBKIT thread exists, so check that first: 283 // be removed if a WEBKIT thread exists, so check that first:
284 if (BrowserThread::IsMessageLoopValid(BrowserThread::WEBKIT_DEPRECATED)) { 284 if (BrowserThread::IsMessageLoopValid(BrowserThread::WEBKIT_DEPRECATED)) {
285 // We assume the end time is now. 285 // We assume the end time is now.
286 profile_->GetWebKitContext()->DeleteDataModifiedSince(delete_begin_); 286 profile_->GetWebKitContext()->DeleteDataModifiedSince(delete_begin_);
287 } 287 }
288 } 288 }
289 289
290 if (remove_mask & REMOVE_INDEXEDDB || remove_mask & REMOVE_WEBSQL || 290 if (remove_mask & REMOVE_INDEXEDDB || remove_mask & REMOVE_WEBSQL ||
291 remove_mask & REMOVE_APPCACHE || remove_mask & REMOVE_FILE_SYSTEMS) { 291 remove_mask & REMOVE_APPCACHE || remove_mask & REMOVE_FILE_SYSTEMS) {
292 // TODO(mkwst): At the moment, we don't have the ability to pass a mask into
293 // QuotaManager. Until then, we'll clear all quota-managed data types if any
294 // ought to be cleared.
295 quota_manager_ = profile_->GetQuotaManager(); 292 quota_manager_ = profile_->GetQuotaManager();
296 if (quota_manager_) { 293 if (quota_manager_) {
297 waiting_for_clear_quota_managed_data_ = true; 294 waiting_for_clear_quota_managed_data_ = true;
298 BrowserThread::PostTask( 295 BrowserThread::PostTask(
299 BrowserThread::IO, FROM_HERE, 296 BrowserThread::IO, FROM_HERE,
300 base::Bind(&BrowsingDataRemover::ClearQuotaManagedDataOnIOThread, 297 base::Bind(&BrowsingDataRemover::ClearQuotaManagedDataOnIOThread,
301 base::Unretained(this))); 298 base::Unretained(this)));
302 } 299 }
303 } 300 }
304 301
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 585
589 void BrowsingDataRemover::OnGotQuotaManagedOrigins( 586 void BrowsingDataRemover::OnGotQuotaManagedOrigins(
590 const std::set<GURL>& origins, quota::StorageType type) { 587 const std::set<GURL>& origins, quota::StorageType type) {
591 DCHECK_GT(quota_managed_storage_types_to_delete_count_, 0); 588 DCHECK_GT(quota_managed_storage_types_to_delete_count_, 0);
592 // Walk through the origins passed in, delete quota of |type| from each that 589 // Walk through the origins passed in, delete quota of |type| from each that
593 // isn't protected. 590 // isn't protected.
594 std::set<GURL>::const_iterator origin; 591 std::set<GURL>::const_iterator origin;
595 for (origin = origins.begin(); origin != origins.end(); ++origin) { 592 for (origin = origins.begin(); origin != origins.end(); ++origin) {
596 if (special_storage_policy_->IsStorageProtected(origin->GetOrigin())) 593 if (special_storage_policy_->IsStorageProtected(origin->GetOrigin()))
597 continue; 594 continue;
595 if (!remove_origin_.is_empty() && remove_origin_ != origin->GetOrigin())
596 continue;
598 ++quota_managed_origins_to_delete_count_; 597 ++quota_managed_origins_to_delete_count_;
599 quota_manager_->DeleteOriginData( 598 quota_manager_->DeleteOriginData(
600 origin->GetOrigin(), type, 599 origin->GetOrigin(), type,
601 BrowsingDataRemover::GenerateQuotaClientMask(remove_mask_), 600 BrowsingDataRemover::GenerateQuotaClientMask(remove_mask_),
602 base::Bind(&BrowsingDataRemover::OnQuotaManagedOriginDeletion, 601 base::Bind(&BrowsingDataRemover::OnQuotaManagedOriginDeletion,
603 base::Unretained(this))); 602 base::Unretained(this)));
604 } 603 }
605 604
606 --quota_managed_storage_types_to_delete_count_; 605 --quota_managed_storage_types_to_delete_count_;
607 CheckQuotaManagedDataDeletionStatus(); 606 CheckQuotaManagedDataDeletionStatus();
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 BrowserThread::UI, FROM_HERE, 678 BrowserThread::UI, FROM_HERE,
680 base::Bind(&BrowsingDataRemover::OnClearedOriginBoundCerts, 679 base::Bind(&BrowsingDataRemover::OnClearedOriginBoundCerts,
681 base::Unretained(this))); 680 base::Unretained(this)));
682 } 681 }
683 682
684 void BrowsingDataRemover::OnClearedOriginBoundCerts() { 683 void BrowsingDataRemover::OnClearedOriginBoundCerts() {
685 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 684 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
686 waiting_for_clear_origin_bound_certs_ = false; 685 waiting_for_clear_origin_bound_certs_ = false;
687 NotifyAndDeleteIfDone(); 686 NotifyAndDeleteIfDone();
688 } 687 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/browsing_data_remover_unittest.cc » ('j') | chrome/browser/browsing_data_remover_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698