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

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: QuotaManager tests. Created 8 years, 11 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 BrowsingDataRemover::~BrowsingDataRemover() { 130 BrowsingDataRemover::~BrowsingDataRemover() {
131 DCHECK(all_done()); 131 DCHECK(all_done());
132 } 132 }
133 133
134 // Static. 134 // Static.
135 void BrowsingDataRemover::set_removing(bool removing) { 135 void BrowsingDataRemover::set_removing(bool removing) {
136 DCHECK(removing_ != removing); 136 DCHECK(removing_ != removing);
137 removing_ = removing; 137 removing_ = removing;
138 } 138 }
139 139
140 // Static.
141 int BrowsingDataRemover::GenerateQuotaClientMask(int remove_mask) {
142 int quota_client_mask = 0;
143 if (remove_mask & BrowsingDataRemover::REMOVE_FILE_SYSTEMS)
144 quota_client_mask |= quota::QuotaClient::kFileSystem;
145 if (remove_mask & BrowsingDataRemover::REMOVE_WEBSQL)
146 quota_client_mask |= quota::QuotaClient::kDatabase;
147 if (remove_mask & BrowsingDataRemover::REMOVE_APPCACHE)
148 quota_client_mask |= quota::QuotaClient::kAppcache;
149 if (remove_mask & BrowsingDataRemover::REMOVE_INDEXEDDB)
150 quota_client_mask |= quota::QuotaClient::kIndexedDatabase;
151
152 return quota_client_mask;
153 }
154
140 void BrowsingDataRemover::Remove(int remove_mask) { 155 void BrowsingDataRemover::Remove(int remove_mask) {
141 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 156 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
142 set_removing(true); 157 set_removing(true);
143 remove_mask_ = remove_mask; 158 remove_mask_ = remove_mask;
144 159
145 if (remove_mask & REMOVE_HISTORY) { 160 if (remove_mask & REMOVE_HISTORY) {
146 HistoryService* history_service = 161 HistoryService* history_service =
147 profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); 162 profile_->GetHistoryService(Profile::EXPLICIT_ACCESS);
148 if (history_service) { 163 if (history_service) {
149 std::set<GURL> restrict_urls; 164 std::set<GURL> restrict_urls;
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 DCHECK_GT(quota_managed_storage_types_to_delete_count_, 0); 560 DCHECK_GT(quota_managed_storage_types_to_delete_count_, 0);
546 // Walk through the origins passed in, delete quota of |type| from each that 561 // Walk through the origins passed in, delete quota of |type| from each that
547 // isn't protected. 562 // isn't protected.
548 std::set<GURL>::const_iterator origin; 563 std::set<GURL>::const_iterator origin;
549 for (origin = origins.begin(); origin != origins.end(); ++origin) { 564 for (origin = origins.begin(); origin != origins.end(); ++origin) {
550 if (special_storage_policy_->IsStorageProtected(origin->GetOrigin())) 565 if (special_storage_policy_->IsStorageProtected(origin->GetOrigin()))
551 continue; 566 continue;
552 ++quota_managed_origins_to_delete_count_; 567 ++quota_managed_origins_to_delete_count_;
553 quota_manager_->DeleteOriginData( 568 quota_manager_->DeleteOriginData(
554 origin->GetOrigin(), type, 569 origin->GetOrigin(), type,
570 BrowsingDataRemover::GenerateQuotaClientMask(remove_mask_),
555 base::Bind(&BrowsingDataRemover::OnQuotaManagedOriginDeletion, 571 base::Bind(&BrowsingDataRemover::OnQuotaManagedOriginDeletion,
556 base::Unretained(this))); 572 base::Unretained(this)));
557 } 573 }
558 574
559 --quota_managed_storage_types_to_delete_count_; 575 --quota_managed_storage_types_to_delete_count_;
560 CheckQuotaManagedDataDeletionStatus(); 576 CheckQuotaManagedDataDeletionStatus();
561 } 577 }
562 578
563 void BrowsingDataRemover::OnQuotaManagedOriginDeletion( 579 void BrowsingDataRemover::OnQuotaManagedOriginDeletion(
564 quota::QuotaStatusCode status) { 580 quota::QuotaStatusCode status) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 void BrowsingDataRemover::ClearCookiesOnIOThread( 629 void BrowsingDataRemover::ClearCookiesOnIOThread(
614 net::URLRequestContextGetter* rq_context) { 630 net::URLRequestContextGetter* rq_context) {
615 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 631 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
616 net::CookieStore* cookie_store = rq_context-> 632 net::CookieStore* cookie_store = rq_context->
617 GetURLRequestContext()->cookie_store(); 633 GetURLRequestContext()->cookie_store();
618 cookie_store->DeleteAllCreatedBetweenAsync( 634 cookie_store->DeleteAllCreatedBetweenAsync(
619 delete_begin_, delete_end_, 635 delete_begin_, delete_end_,
620 base::Bind(&BrowsingDataRemover::OnClearedCookies, 636 base::Bind(&BrowsingDataRemover::OnClearedCookies,
621 base::Unretained(this))); 637 base::Unretained(this)));
622 } 638 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698