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

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

Issue 7533013: Quota: Add quota::StorageType to the GetOriginsCallback definition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebasing onto today's ToT. Created 9 years, 4 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/callback.h" 10 #include "base/callback.h"
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 quota_managed_origins_to_delete_count_ = 0; 458 quota_managed_origins_to_delete_count_ = 0;
459 quota_managed_storage_types_to_delete_count_ = 2; 459 quota_managed_storage_types_to_delete_count_ = 2;
460 460
461 if (delete_begin_ == base::Time()) { 461 if (delete_begin_ == base::Time()) {
462 // If we're deleting since the beginning of time, ask the QuotaManager for 462 // If we're deleting since the beginning of time, ask the QuotaManager for
463 // all origins with persistent quota modified within the user-specified 463 // all origins with persistent quota modified within the user-specified
464 // timeframe, and deal with the resulting set in 464 // timeframe, and deal with the resulting set in
465 // OnGotPersistentQuotaManagedOrigins. 465 // OnGotPersistentQuotaManagedOrigins.
466 profile_->GetQuotaManager()->GetOriginsModifiedSince( 466 profile_->GetQuotaManager()->GetOriginsModifiedSince(
467 quota::kStorageTypePersistent, delete_begin_, NewCallback(this, 467 quota::kStorageTypePersistent, delete_begin_, NewCallback(this,
468 &BrowsingDataRemover::OnGotPersistentQuotaManagedOrigins)); 468 &BrowsingDataRemover::OnGotQuotaManagedOrigins));
469 } else { 469 } else {
470 // Otherwise, we don't need to deal with persistent storage. 470 // Otherwise, we don't need to deal with persistent storage.
471 --quota_managed_storage_types_to_delete_count_; 471 --quota_managed_storage_types_to_delete_count_;
472 } 472 }
473 473
474 // Do the same for temporary quota, regardless, passing the resulting set into 474 // Do the same for temporary quota, regardless, passing the resulting set into
475 // OnGotTemporaryQuotaManagedOrigins. 475 // OnGotTemporaryQuotaManagedOrigins.
476 profile_->GetQuotaManager()->GetOriginsModifiedSince( 476 profile_->GetQuotaManager()->GetOriginsModifiedSince(
477 quota::kStorageTypeTemporary, delete_begin_, NewCallback(this, 477 quota::kStorageTypeTemporary, delete_begin_, NewCallback(this,
478 &BrowsingDataRemover::OnGotTemporaryQuotaManagedOrigins)); 478 &BrowsingDataRemover::OnGotQuotaManagedOrigins));
479 } 479 }
480 480
481 void BrowsingDataRemover::OnGotTemporaryQuotaManagedOrigins( 481 void BrowsingDataRemover::OnGotQuotaManagedOrigins(
482 const std::set<GURL>& origins) { 482 const std::set<GURL>& origins, quota::StorageType type) {
483 DCHECK_GT(quota_managed_storage_types_to_delete_count_, 0); 483 DCHECK_GT(quota_managed_storage_types_to_delete_count_, 0);
484 // Walk through the origins passed in, delete temporary quota from each that 484 // Walk through the origins passed in, delete quota of |type| from each that
485 // isn't protected. 485 // isn't protected.
486 std::set<GURL>::const_iterator origin; 486 std::set<GURL>::const_iterator origin;
487 for (origin = origins.begin(); origin != origins.end(); ++origin) { 487 for (origin = origins.begin(); origin != origins.end(); ++origin) {
488 if (special_storage_policy_->IsStorageProtected(origin->GetOrigin())) 488 if (special_storage_policy_->IsStorageProtected(origin->GetOrigin()))
489 continue; 489 continue;
490 ++quota_managed_origins_to_delete_count_; 490 ++quota_managed_origins_to_delete_count_;
491 quota_manager_->DeleteOriginData(origin->GetOrigin(), 491 quota_manager_->DeleteOriginData(origin->GetOrigin(),
492 quota::kStorageTypeTemporary, NewCallback(this, 492 type, NewCallback(this,
493 &BrowsingDataRemover::OnQuotaManagedOriginDeletion)); 493 &BrowsingDataRemover::OnQuotaManagedOriginDeletion));
494 } 494 }
495 495
496 --quota_managed_storage_types_to_delete_count_; 496 --quota_managed_storage_types_to_delete_count_;
497 if (quota_managed_storage_types_to_delete_count_ == 0 &&
498 quota_managed_origins_to_delete_count_ == 0)
499 CheckQuotaManagedDataDeletionStatus();
500 }
501
502 void BrowsingDataRemover::OnGotPersistentQuotaManagedOrigins(
503 const std::set<GURL>& origins) {
504 DCHECK_GT(quota_managed_storage_types_to_delete_count_, 0);
505 // Walk through the origins passed in, delete persistent quota from each that
506 // isn't protected.
507 std::set<GURL>::const_iterator origin;
508 for (origin = origins.begin(); origin != origins.end(); ++origin) {
509 if (special_storage_policy_->IsStorageProtected(origin->GetOrigin()))
510 continue;
511 ++quota_managed_origins_to_delete_count_;
512 quota_manager_->DeleteOriginData(origin->GetOrigin(),
513 quota::kStorageTypePersistent, NewCallback(this,
514 &BrowsingDataRemover::OnQuotaManagedOriginDeletion));
515 }
516
517 --quota_managed_storage_types_to_delete_count_;
518 if (quota_managed_storage_types_to_delete_count_ == 0 && 497 if (quota_managed_storage_types_to_delete_count_ == 0 &&
519 quota_managed_origins_to_delete_count_ == 0) 498 quota_managed_origins_to_delete_count_ == 0)
520 CheckQuotaManagedDataDeletionStatus(); 499 CheckQuotaManagedDataDeletionStatus();
521 } 500 }
522 501
523 void BrowsingDataRemover::OnQuotaManagedOriginDeletion( 502 void BrowsingDataRemover::OnQuotaManagedOriginDeletion(
524 quota::QuotaStatusCode status) { 503 quota::QuotaStatusCode status) {
525 DCHECK_GT(quota_managed_origins_to_delete_count_, 0); 504 DCHECK_GT(quota_managed_origins_to_delete_count_, 0);
526 if (status != quota::kQuotaStatusOk) { 505 if (status != quota::kQuotaStatusOk) {
527 // TODO(mkwst): We should add the GURL to StatusCallback; this is a pretty 506 // TODO(mkwst): We should add the GURL to StatusCallback; this is a pretty
(...skipping 18 matching lines...) Expand all
546 NewRunnableMethod( 525 NewRunnableMethod(
547 this, 526 this,
548 &BrowsingDataRemover::NotifyAndDeleteIfDone)); 527 &BrowsingDataRemover::NotifyAndDeleteIfDone));
549 } 528 }
550 529
551 void BrowsingDataRemover::OnWaitableEventSignaled( 530 void BrowsingDataRemover::OnWaitableEventSignaled(
552 base::WaitableEvent* waitable_event) { 531 base::WaitableEvent* waitable_event) {
553 waiting_for_clear_lso_data_ = false; 532 waiting_for_clear_lso_data_ = false;
554 NotifyAndDeleteIfDone(); 533 NotifyAndDeleteIfDone();
555 } 534 }
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data_remover.h ('k') | content/browser/in_process_webkit/indexed_db_quota_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698