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

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: Rebasing. Grrr. 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
« no previous file with comments | « no previous file | chrome/browser/browsing_data_remover_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/browsing_data_remover_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698