OLD | NEW |
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 Loading... |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |