| 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 // be removed if a WEBKIT thread exists, so check that first: | 284 // be removed if a WEBKIT thread exists, so check that first: |
| 285 if (BrowserThread::IsMessageLoopValid(BrowserThread::WEBKIT_DEPRECATED)) { | 285 if (BrowserThread::IsMessageLoopValid(BrowserThread::WEBKIT_DEPRECATED)) { |
| 286 // We assume the end time is now. | 286 // We assume the end time is now. |
| 287 BrowserContext::GetWebKitContext(profile_)-> | 287 BrowserContext::GetWebKitContext(profile_)-> |
| 288 DeleteDataModifiedSince(delete_begin_); | 288 DeleteDataModifiedSince(delete_begin_); |
| 289 } | 289 } |
| 290 } | 290 } |
| 291 | 291 |
| 292 if (remove_mask & REMOVE_INDEXEDDB || remove_mask & REMOVE_WEBSQL || | 292 if (remove_mask & REMOVE_INDEXEDDB || remove_mask & REMOVE_WEBSQL || |
| 293 remove_mask & REMOVE_APPCACHE || remove_mask & REMOVE_FILE_SYSTEMS) { | 293 remove_mask & REMOVE_APPCACHE || remove_mask & REMOVE_FILE_SYSTEMS) { |
| 294 // TODO(mkwst): At the moment, we don't have the ability to pass a mask into | |
| 295 // QuotaManager. Until then, we'll clear all quota-managed data types if any | |
| 296 // ought to be cleared. | |
| 297 if (!quota_manager_) | 294 if (!quota_manager_) |
| 298 quota_manager_ = content::BrowserContext::GetQuotaManager(profile_); | 295 quota_manager_ = content::BrowserContext::GetQuotaManager(profile_); |
| 299 waiting_for_clear_quota_managed_data_ = true; | 296 waiting_for_clear_quota_managed_data_ = true; |
| 300 BrowserThread::PostTask( | 297 BrowserThread::PostTask( |
| 301 BrowserThread::IO, FROM_HERE, | 298 BrowserThread::IO, FROM_HERE, |
| 302 base::Bind(&BrowsingDataRemover::ClearQuotaManagedDataOnIOThread, | 299 base::Bind(&BrowsingDataRemover::ClearQuotaManagedDataOnIOThread, |
| 303 base::Unretained(this))); | 300 base::Unretained(this))); |
| 304 } | 301 } |
| 305 | 302 |
| 306 if (remove_mask & REMOVE_PLUGIN_DATA) { | 303 if (remove_mask & REMOVE_PLUGIN_DATA) { |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 | 591 |
| 595 void BrowsingDataRemover::OnGotQuotaManagedOrigins( | 592 void BrowsingDataRemover::OnGotQuotaManagedOrigins( |
| 596 const std::set<GURL>& origins, quota::StorageType type) { | 593 const std::set<GURL>& origins, quota::StorageType type) { |
| 597 DCHECK_GT(quota_managed_storage_types_to_delete_count_, 0); | 594 DCHECK_GT(quota_managed_storage_types_to_delete_count_, 0); |
| 598 // Walk through the origins passed in, delete quota of |type| from each that | 595 // Walk through the origins passed in, delete quota of |type| from each that |
| 599 // isn't protected. | 596 // isn't protected. |
| 600 std::set<GURL>::const_iterator origin; | 597 std::set<GURL>::const_iterator origin; |
| 601 for (origin = origins.begin(); origin != origins.end(); ++origin) { | 598 for (origin = origins.begin(); origin != origins.end(); ++origin) { |
| 602 if (special_storage_policy_->IsStorageProtected(origin->GetOrigin())) | 599 if (special_storage_policy_->IsStorageProtected(origin->GetOrigin())) |
| 603 continue; | 600 continue; |
| 601 if (!remove_origin_.is_empty() && remove_origin_ != origin->GetOrigin()) |
| 602 continue; |
| 604 ++quota_managed_origins_to_delete_count_; | 603 ++quota_managed_origins_to_delete_count_; |
| 605 quota_manager_->DeleteOriginData( | 604 quota_manager_->DeleteOriginData( |
| 606 origin->GetOrigin(), type, | 605 origin->GetOrigin(), type, |
| 607 BrowsingDataRemover::GenerateQuotaClientMask(remove_mask_), | 606 BrowsingDataRemover::GenerateQuotaClientMask(remove_mask_), |
| 608 base::Bind(&BrowsingDataRemover::OnQuotaManagedOriginDeletion, | 607 base::Bind(&BrowsingDataRemover::OnQuotaManagedOriginDeletion, |
| 609 base::Unretained(this))); | 608 base::Unretained(this))); |
| 610 } | 609 } |
| 611 | 610 |
| 612 --quota_managed_storage_types_to_delete_count_; | 611 --quota_managed_storage_types_to_delete_count_; |
| 613 CheckQuotaManagedDataDeletionStatus(); | 612 CheckQuotaManagedDataDeletionStatus(); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 BrowserThread::UI, FROM_HERE, | 684 BrowserThread::UI, FROM_HERE, |
| 686 base::Bind(&BrowsingDataRemover::OnClearedOriginBoundCerts, | 685 base::Bind(&BrowsingDataRemover::OnClearedOriginBoundCerts, |
| 687 base::Unretained(this))); | 686 base::Unretained(this))); |
| 688 } | 687 } |
| 689 | 688 |
| 690 void BrowsingDataRemover::OnClearedOriginBoundCerts() { | 689 void BrowsingDataRemover::OnClearedOriginBoundCerts() { |
| 691 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 690 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 692 waiting_for_clear_origin_bound_certs_ = false; | 691 waiting_for_clear_origin_bound_certs_ = false; |
| 693 NotifyAndDeleteIfDone(); | 692 NotifyAndDeleteIfDone(); |
| 694 } | 693 } |
| OLD | NEW |