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

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

Issue 7839029: QuotaManager::DeleteOriginData now allows deletion of specific QuotaClients (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Kinuko's feedback (modulo kMockStart) 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 BrowsingDataRemover::~BrowsingDataRemover() { 134 BrowsingDataRemover::~BrowsingDataRemover() {
135 DCHECK(all_done()); 135 DCHECK(all_done());
136 } 136 }
137 137
138 // Static. 138 // Static.
139 void BrowsingDataRemover::set_removing(bool removing) { 139 void BrowsingDataRemover::set_removing(bool removing) {
140 DCHECK(removing_ != removing); 140 DCHECK(removing_ != removing);
141 removing_ = removing; 141 removing_ = removing;
142 } 142 }
143 143
144 // Static.
145 int BrowsingDataRemover::GenerateQuotaClientMask(int remove_mask) {
146 int quota_client_mask = 0;
147 if (remove_mask & BrowsingDataRemover::REMOVE_FILE_SYSTEMS)
148 quota_client_mask |= quota::QuotaClient::kFileSystem;
149 if (remove_mask & BrowsingDataRemover::REMOVE_WEBSQL)
150 quota_client_mask |= quota::QuotaClient::kDatabase;
151 if (remove_mask & BrowsingDataRemover::REMOVE_APPCACHE)
152 quota_client_mask |= quota::QuotaClient::kAppcache;
153 if (remove_mask & BrowsingDataRemover::REMOVE_INDEXEDDB)
154 quota_client_mask |= quota::QuotaClient::kIndexedDatabase;
155
156 return quota_client_mask;
157 }
158
144 void BrowsingDataRemover::Remove(int remove_mask) { 159 void BrowsingDataRemover::Remove(int remove_mask) {
145 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 160 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
146 set_removing(true); 161 set_removing(true);
147 remove_mask_ = remove_mask; 162 remove_mask_ = remove_mask;
148 163
149 if (remove_mask & REMOVE_HISTORY) { 164 if (remove_mask & REMOVE_HISTORY) {
150 HistoryService* history_service = 165 HistoryService* history_service =
151 profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); 166 profile_->GetHistoryService(Profile::EXPLICIT_ACCESS);
152 if (history_service) { 167 if (history_service) {
153 std::set<GURL> restrict_urls; 168 std::set<GURL> restrict_urls;
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 DCHECK_GT(quota_managed_storage_types_to_delete_count_, 0); 578 DCHECK_GT(quota_managed_storage_types_to_delete_count_, 0);
564 // Walk through the origins passed in, delete quota of |type| from each that 579 // Walk through the origins passed in, delete quota of |type| from each that
565 // isn't protected. 580 // isn't protected.
566 std::set<GURL>::const_iterator origin; 581 std::set<GURL>::const_iterator origin;
567 for (origin = origins.begin(); origin != origins.end(); ++origin) { 582 for (origin = origins.begin(); origin != origins.end(); ++origin) {
568 if (special_storage_policy_->IsStorageProtected(origin->GetOrigin())) 583 if (special_storage_policy_->IsStorageProtected(origin->GetOrigin()))
569 continue; 584 continue;
570 ++quota_managed_origins_to_delete_count_; 585 ++quota_managed_origins_to_delete_count_;
571 quota_manager_->DeleteOriginData( 586 quota_manager_->DeleteOriginData(
572 origin->GetOrigin(), type, 587 origin->GetOrigin(), type,
588 BrowsingDataRemover::GenerateQuotaClientMask(remove_mask_),
573 base::Bind(&BrowsingDataRemover::OnQuotaManagedOriginDeletion, 589 base::Bind(&BrowsingDataRemover::OnQuotaManagedOriginDeletion,
574 base::Unretained(this))); 590 base::Unretained(this)));
575 } 591 }
576 592
577 --quota_managed_storage_types_to_delete_count_; 593 --quota_managed_storage_types_to_delete_count_;
578 CheckQuotaManagedDataDeletionStatus(); 594 CheckQuotaManagedDataDeletionStatus();
579 } 595 }
580 596
581 void BrowsingDataRemover::OnQuotaManagedOriginDeletion( 597 void BrowsingDataRemover::OnQuotaManagedOriginDeletion(
582 quota::QuotaStatusCode status) { 598 quota::QuotaStatusCode status) {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 BrowserThread::UI, FROM_HERE, 666 BrowserThread::UI, FROM_HERE,
651 base::Bind(&BrowsingDataRemover::OnClearedOriginBoundCerts, 667 base::Bind(&BrowsingDataRemover::OnClearedOriginBoundCerts,
652 base::Unretained(this))); 668 base::Unretained(this)));
653 } 669 }
654 670
655 void BrowsingDataRemover::OnClearedOriginBoundCerts() { 671 void BrowsingDataRemover::OnClearedOriginBoundCerts() {
656 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 672 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
657 waiting_for_clear_origin_bound_certs_ = false; 673 waiting_for_clear_origin_bound_certs_ = false;
658 NotifyAndDeleteIfDone(); 674 NotifyAndDeleteIfDone();
659 } 675 }
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data_remover.h ('k') | chrome/browser/browsing_data_remover_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698