#include "content/public/browser/notification_source.h"
#include "content/public/browser/notification_types.h"
#include "content/public/browser/render_process_host.h"
+#include "content/public/browser/session_storage_usage_info.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/browser/storage_usage_info.h"
-#include "net/base/completion_repeating_callback.h"
-#include "net/base/net_errors.h"
-#include "net/disk_cache/disk_cache.h"
-#include "net/http/http_cache.h"
-#include "net/url_request/url_request_context.h"
-#include "net/url_request/url_request_context_getter.h"
#include "storage/browser/quota/quota_manager.h"
using content::BrowserThread;
-// Static.
-BrowsingDataRemoverEfl* BrowsingDataRemoverEfl::CreateForUnboundedRange(content::BrowserContext* profile) {
- return new BrowsingDataRemoverEfl(profile, base::Time(), base::Time::Max());
+// static
+BrowsingDataRemoverEfl* BrowsingDataRemoverEfl::CreateForUnboundedRange(
+ content::BrowserContext* browser_context) {
+ return new BrowsingDataRemoverEfl(browser_context, base::Time(),
+ base::Time::Max());
}
-BrowsingDataRemoverEfl* BrowsingDataRemoverEfl::CreateForRange(content::BrowserContext* browser_context,
- base::Time start, base::Time end) {
+// static
+BrowsingDataRemoverEfl* BrowsingDataRemoverEfl::CreateForRange(
+ content::BrowserContext* browser_context,
+ base::Time start,
+ base::Time end) {
return new BrowsingDataRemoverEfl(browser_context, start, end);
}
-int BrowsingDataRemoverEfl::GenerateQuotaClientMask(int remove_mask) {
- int quota_client_mask = 0;
-#if !defined(EWK_BRINGUP) // FIXME: m85 bringup
+// static
+storage::QuotaClientTypes BrowsingDataRemoverEfl::GenerateQuotaClientTypes(
+ int remove_mask) {
+ storage::QuotaClientTypes quota_client_types;
if (remove_mask & BrowsingDataRemoverEfl::REMOVE_FILE_SYSTEMS)
- quota_client_mask |= storage::QuotaClient::kFileSystem;
+ quota_client_types.insert(storage::QuotaClientType::kFileSystem);
if (remove_mask & BrowsingDataRemoverEfl::REMOVE_WEBSQL)
- quota_client_mask |= storage::QuotaClient::kDatabase;
+ quota_client_types.insert(storage::QuotaClientType::kDatabase);
if (remove_mask & BrowsingDataRemoverEfl::REMOVE_INDEXEDDB)
- quota_client_mask |= storage::QuotaClient::kIndexedDatabase;
-#endif
- return quota_client_mask;
+ quota_client_types.insert(storage::QuotaClientType::kIndexedDatabase);
+ return quota_client_types;
}
BrowsingDataRemoverEfl::BrowsingDataRemoverEfl(
base::Time delete_begin,
base::Time delete_end)
: browser_context_(browser_context),
- app_cache_service_(nullptr),
- quota_manager_(nullptr),
- dom_storage_context_(nullptr),
delete_begin_(delete_begin),
- delete_end_(delete_end),
- next_cache_state_(STATE_NONE),
- cache_(nullptr),
- main_context_getter_(nullptr),
- media_context_getter_(nullptr),
- waiting_for_clear_cache_(false),
- waiting_for_clear_local_storage_(false),
- waiting_for_clear_quota_managed_data_(false),
- quota_managed_origins_to_delete_count_(0),
- quota_managed_storage_types_to_delete_count_(0),
- remove_mask_(0) {
-#if !defined(EWK_BRINGUP) // FIXME: m94 bringup
- if (browser_context_) {
- app_cache_service_ = browser_context->GetStoragePartition(browser_context_, NULL)->GetAppCacheService();
- main_context_getter_ =
- content::BrowserContext::GetDefaultStoragePartition(browser_context_)->GetURLRequestContext();
- media_context_getter_ = browser_context->CreateMediaRequestContext();
- }
-#endif
-}
+ delete_end_(delete_end) {}
BrowsingDataRemoverEfl::~BrowsingDataRemoverEfl() {
DCHECK(AllDone());
}
void BrowsingDataRemoverEfl::ClearNetworkCache() {
- waiting_for_clear_cache_ = true;
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
-
- base::ThreadPool::PostTask(
- FROM_HERE, {BrowserThread::IO},
- base::BindOnce(&BrowsingDataRemoverEfl::ClearNetworkCacheOnIOThread,
- base::Unretained(this)));
-}
-
-void BrowsingDataRemoverEfl::ClearNetworkCacheOnIOThread() {
- // This function should be called on the IO thread.
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
- DCHECK_EQ(STATE_NONE, next_cache_state_);
- DCHECK(main_context_getter_.get());
- DCHECK(media_context_getter_.get());
-
- next_cache_state_ = STATE_CREATE_MAIN;
- DoClearCache(net::OK);
-}
-
-// The expected state sequence is STATE_NONE --> STATE_CREATE_MAIN -->
-// STATE_DELETE_MAIN --> STATE_CREATE_MEDIA --> STATE_DELETE_MEDIA -->
-// STATE_DONE, and any errors are ignored.
-void BrowsingDataRemoverEfl::DoClearCache(int rv) {
- DCHECK_NE(STATE_NONE, next_cache_state_);
-
- while (rv != net::ERR_IO_PENDING && next_cache_state_ != STATE_NONE) {
- switch (next_cache_state_) {
- case STATE_CREATE_MAIN:
- case STATE_CREATE_MEDIA: {
- // Get a pointer to the cache.
- net::URLRequestContextGetter* getter = nullptr;
- if (next_cache_state_ == STATE_CREATE_MAIN) {
- if (main_context_getter_)
- getter = main_context_getter_.get();
- } else {
- if (media_context_getter_)
- getter = media_context_getter_.get();
- }
- if (getter && getter->GetURLRequestContext()) {
- net::HttpTransactionFactory* factory =
- getter->GetURLRequestContext()->http_transaction_factory();
- if (factory) {
- next_cache_state_ = (next_cache_state_ == STATE_CREATE_MAIN)
- ? STATE_DELETE_MAIN
- : STATE_DELETE_MEDIA;
- rv = factory->GetCache()->GetBackend(
- &cache_, base::BindOnce(&BrowsingDataRemoverEfl::DoClearCache,
- base::Unretained(this)));
- } else {
- LOG(ERROR) << "Could not get HttpTransactionFactory.";
- next_cache_state_ = STATE_NONE;
- }
- } else {
- LOG(ERROR) << "Could not get URLRequestContext.";
- next_cache_state_ = STATE_NONE;
- }
- break;
- }
- case STATE_DELETE_MAIN:
- case STATE_DELETE_MEDIA: {
- next_cache_state_ = (next_cache_state_ == STATE_DELETE_MAIN) ?
- STATE_CREATE_MEDIA : STATE_DONE;
-
- // |cache_| can be null if it cannot be initialized.
- if (cache_) {
- if (delete_begin_.is_null()) {
- rv = cache_->DoomAllEntries(base::BindOnce(
- &BrowsingDataRemoverEfl::DoClearCache, base::Unretained(this)));
- } else {
- rv = cache_->DoomEntriesBetween(
- delete_begin_, delete_end_,
- base::BindOnce(&BrowsingDataRemoverEfl::DoClearCache,
- base::Unretained(this)));
- }
- cache_ = NULL;
- }
- break;
- }
- case STATE_DONE: {
- cache_ = NULL;
- next_cache_state_ = STATE_NONE;
-
- // Notify the UI thread that we are done.
- base::ThreadPool::PostTask(
- FROM_HERE, {BrowserThread::UI},
- base::BindOnce(&BrowsingDataRemoverEfl::ClearedCache,
- base::Unretained(this)));
- return;
- }
- default: {
- NOTREACHED() << "bad state";
- next_cache_state_ = STATE_NONE; // Stop looping.
- return;
- }
- }
- }
-}
-
-void BrowsingDataRemoverEfl::ClearedCache() {
- waiting_for_clear_cache_ = false;
DeleteIfDone();
}
// just to keep same overall structure of Chrome::BrowsingDataRemover
bool BrowsingDataRemoverEfl::AllDone() {
- return !waiting_for_clear_cache_ &&
- !waiting_for_clear_local_storage_ &&
+ return !waiting_for_clear_local_storage_ &&
+ !waiting_for_clear_session_storage_ &&
!waiting_for_clear_quota_managed_data_;
}
base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this);
}
-typedef void (*Application_Cache_Origins_Get_Callback)(void* origins, void* user_data);
-#if !defined(EWK_BRINGUP) // FIXME: m108 bringup
-void OnGotOriginsWithApplicationCache(Application_Cache_Origins_Get_Callback callback,
- void* user_data,
- scoped_refptr<content::AppCacheInfoCollection> collection,
- int result){
- BrowsingDataRemoverEfl* bdre =
- static_cast<BrowsingDataRemoverEfl*>(user_data);
- // information about end of process is not needed so cb left empty
- net::CompletionRepeatingCallback cb;
- if (collection.get()) {
- for (const auto& origin : collection->infos_by_origin)
- bdre->DeleteAppCachesForOrigin(origin.first);
- }
-}
-#endif
void BrowsingDataRemoverEfl::RemoveImpl(int remove_mask,
const GURL& origin) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
remove_mask_ = remove_mask;
- remove_origin_ = origin;
+ remove_origin_ = url::Origin::Create(origin);
if (remove_mask & REMOVE_LOCAL_STORAGE) {
waiting_for_clear_local_storage_ = true;
-#if !defined(EWK_BRINGUP) // FIXME: m94 bringup
if (!dom_storage_context_) {
- dom_storage_context_ = content::BrowserContext::GetStoragePartition(browser_context_, NULL)->GetDOMStorageContext();
+ dom_storage_context_ =
+ browser_context_->GetStoragePartition(NULL)->GetDOMStorageContext();
}
-#endif
ClearLocalStorageOnUIThread();
}
+ if (remove_mask & REMOVE_SESSION_STORAGE) {
+ waiting_for_clear_session_storage_ = true;
+ if (!dom_storage_context_) {
+ dom_storage_context_ =
+ browser_context_->GetStoragePartition(NULL)->GetDOMStorageContext();
+ }
+ ClearSessionStorageOnUIThread();
+ }
+
if (remove_mask & REMOVE_INDEXEDDB || remove_mask & REMOVE_WEBSQL ||
- remove_mask & REMOVE_FILE_SYSTEMS) {
-#if !defined(EWK_BRINGUP) // FIXME: m94 bringup
+ remove_mask & REMOVE_FILE_SYSTEMS || remove_mask & REMOVE_APPCACHE) {
if (!quota_manager_) {
- quota_manager_ = content::BrowserContext::GetStoragePartition(browser_context_, NULL)->GetQuotaManager();
+ quota_manager_ =
+ browser_context_->GetStoragePartition(NULL)->GetQuotaManager();
}
-#endif
waiting_for_clear_quota_managed_data_ = true;
base::ThreadPool::PostTask(
FROM_HERE, {BrowserThread::IO},
base::BindOnce(&BrowsingDataRemoverEfl::ClearQuotaManagedDataOnIOThread,
base::Unretained(this)));
}
- if (remove_mask & REMOVE_APPCACHE) {
- DCHECK(app_cache_service_);
- if (!app_cache_service_) {
- return;
- }
-
- if (origin.is_valid()) {
- DeleteAppCachesForOrigin(url::Origin::Create(origin));
- }
- else {
-#if !defined(EWK_BRINGUP) // FIXME: m108 bringup
- //if origin is empty delete all app cache (actual deletion in OnGotOriginsWithApplicationCache)
- Application_Cache_Origins_Get_Callback cb = NULL;
- scoped_refptr<content::AppCacheInfoCollection> collection(new content::AppCacheInfoCollection());
- app_cache_service_->GetAllAppCacheInfo(
- collection.get(), base::BindOnce(&OnGotOriginsWithApplicationCache,
- cb, this, collection));
-#endif
- }
- }
-}
-
-void BrowsingDataRemoverEfl::DeleteAppCachesForOrigin(
- const url::Origin& origin) {
- if (BrowserThread::CurrentlyOn(BrowserThread::UI)) {
- // TODO: Using base::Unretained is not thread safe
- // It may happen that on IO thread this ptr will be already deleted
- base::ThreadPool::PostTask(
- FROM_HERE, {BrowserThread::IO},
- base::BindOnce(&BrowsingDataRemoverEfl::DeleteAppCachesForOrigin,
- base::Unretained(this), origin));
- return;
- }
-
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
-#if !defined(EWK_BRINGUP) // FIXME: m108 bringup
- net::CompletionRepeatingCallback rm_app_catche_cb;
- static_cast<content::AppCacheServiceImpl*>(app_cache_service_)->DeleteAppCachesForOrigin(origin, rm_app_catche_cb);
-#endif
}
void BrowsingDataRemoverEfl::ClearLocalStorageOnUIThread() {
DeleteIfDone();
}
+void BrowsingDataRemoverEfl::ClearSessionStorageOnUIThread() {
+ DCHECK(waiting_for_clear_session_storage_);
+ DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
+
+ dom_storage_context_->GetSessionStorageUsage(
+ base::BindOnce(&BrowsingDataRemoverEfl::OnGotSessionStorageUsageInfo,
+ base::Unretained(this)));
+}
+
+void BrowsingDataRemoverEfl::OnGotSessionStorageUsageInfo(
+ const std::vector<content::SessionStorageUsageInfo>& infos) {
+ DCHECK(waiting_for_clear_session_storage_);
+ DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
+
+ for (size_t i = 0; i < infos.size(); ++i)
+ dom_storage_context_->DeleteSessionStorage(infos[i], base::DoNothing());
+ waiting_for_clear_session_storage_ = false;
+ DeleteIfDone();
+}
+
void BrowsingDataRemoverEfl::ClearQuotaManagedDataOnIOThread() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
-#if !defined(EWK_BRINGUP) // FIXME: m67 bringup
// Ask the QuotaManager for all origins with temporary quota modified within
// the user-specified timeframe, and deal with the resulting set in
// OnGotQuotaManagedOrigins().
quota_managed_origins_to_delete_count_ = 0;
quota_managed_storage_types_to_delete_count_ = 0;
- if (delete_begin_ == base::Time()) {
- ++quota_managed_storage_types_to_delete_count_;
- quota_manager_->GetOriginsModifiedSince(
- storage::kStorageTypePersistent, delete_begin_,
- base::BindOnce(&BrowsingDataRemoverEfl::OnGotQuotaManagedOrigins,
- base::Unretained(this)));
- }
+ if (delete_begin_.is_null())
+ ClearQuotaManagedDataInternal(blink::mojom::StorageType::kPersistent);
// Do the same for temporary quota.
- ++quota_managed_storage_types_to_delete_count_;
- quota_manager_->GetOriginsModifiedSince(
- storage::kStorageTypeTemporary, delete_begin_,
- base::BindOnce(&BrowsingDataRemoverEfl::OnGotQuotaManagedOrigins,
- base::Unretained(this)));
+ ClearQuotaManagedDataInternal(blink::mojom::StorageType::kTemporary);
// Do the same for syncable quota.
+ ClearQuotaManagedDataInternal(blink::mojom::StorageType::kSyncable);
+}
+
+void BrowsingDataRemoverEfl::ClearQuotaManagedDataInternal(
+ blink::mojom::StorageType type) {
++quota_managed_storage_types_to_delete_count_;
- quota_manager_->GetOriginsModifiedSince(
- storage::kStorageTypeSyncable, delete_begin_,
- base::BindOnce(&BrowsingDataRemoverEfl::OnGotQuotaManagedOrigins,
+ quota_manager_->GetBucketsModifiedBetween(
+ type, delete_begin_, delete_end_,
+ base::BindOnce(&BrowsingDataRemoverEfl::OnGotQuotaManagedBuckets,
base::Unretained(this)));
-#endif
}
-#if !defined(EWK_BRINGUP) // FIXME: m67 bringup
-void BrowsingDataRemoverEfl::OnGotQuotaManagedOrigins(
- const std::set<GURL>& origins, storage::StorageType type) {
+void BrowsingDataRemoverEfl::OnGotQuotaManagedBuckets(
+ const std::set<storage::BucketLocator>& buckets,
+ blink::mojom::StorageType type) {
DCHECK_GT(quota_managed_storage_types_to_delete_count_, 0);
- // Walk through the origins passed in, delete quota of |type| from each that
- // matches the |origin_set_mask_|.
- std::set<GURL>::const_iterator origin;
- for (origin = origins.begin(); origin != origins.end(); ++origin) {
- if (!remove_origin_.is_empty()) { // delete all origins if remove_origin is empty
- if (remove_origin_ != origin->GetOrigin())
- continue;
- }
+ storage::QuotaClientTypes quota_client_types =
+ BrowsingDataRemoverEfl::GenerateQuotaClientTypes(remove_mask_);
+
+ for (const auto& bucket : buckets) {
+ // delete all origins if |remove_origin_| is opaque.
+ if (!remove_origin_.opaque() &&
+ remove_origin_ != bucket.storage_key.origin())
+ continue;
++quota_managed_origins_to_delete_count_;
- quota_manager_->DeleteOriginData(
- origin->GetOrigin(), type,
- BrowsingDataRemoverEfl::GenerateQuotaClientMask(remove_mask_),
- base::BindOnce(&BrowsingDataRemoverEfl::OnQuotaManagedOriginDeletion,
- base::Unretained(this), origin->GetOrigin(), type));
+ quota_manager_->DeleteBucketData(
+ bucket, quota_client_types,
+ base::BindOnce(&BrowsingDataRemoverEfl::OnQuotaManagedBucketDeleted,
+ base::Unretained(this), bucket));
}
--quota_managed_storage_types_to_delete_count_;
CheckQuotaManagedDataDeletionStatus();
}
-void BrowsingDataRemoverEfl::OnQuotaManagedOriginDeletion(
- const GURL& origin,
- storage::StorageType type,
- storage::QuotaStatusCode status) {
+void BrowsingDataRemoverEfl::OnQuotaManagedBucketDeleted( // LCOV_EXCL_LINE
+ const storage::BucketLocator& bucket,
+ blink::mojom::QuotaStatusCode status) {
DCHECK_GT(quota_managed_origins_to_delete_count_, 0);
- if (status != storage::kQuotaStatusOk)
- DLOG(ERROR) << "Couldn't remove data of type " << type << " for origin "
- << origin << ". Status: " << status;
+ if (status != blink::mojom::QuotaStatusCode::kOk) {
+ DLOG(ERROR) << "Couldn't remove data type " << static_cast<int>(bucket.type)
+ << " with storage key " << bucket.storage_key.GetDebugString()
+ << " and bucket id " << bucket.id
+ << ". Status: " << static_cast<int>(status);
+ }
--quota_managed_origins_to_delete_count_;
CheckQuotaManagedDataDeletionStatus();
}
-#endif
void BrowsingDataRemoverEfl::CheckQuotaManagedDataDeletionStatus() {
if (quota_managed_storage_types_to_delete_count_ != 0 ||
#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
#include "base/time/time.h"
+#include "components/services/storage/public/cpp/buckets/bucket_locator.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
+#include "storage/browser/quota/quota_client_type.h"
+#include "third_party/blink/public/mojom/quota/quota_types.mojom.h"
#include "url/gurl.h"
#include "url/origin.h"
-namespace net {
-class URLRequestContextGetter;
-}
namespace content {
-class AppCacheService;
class BrowserContext;
class DOMStorageContext;
+struct SessionStorageUsageInfo;
struct StorageUsageInfo;
-class StoragePartition;
-}
-namespace disk_cache {
-class Backend;
-}
+} // namespace content
+
namespace storage {
class QuotaManager;
+struct BucketLocator;
}
class BrowsingDataRemoverEfl {
public:
// Mask used for Remove.
enum RemoveDataMask {
- REMOVE_LOCAL_STORAGE = 1 << 0,
- REMOVE_INDEXEDDB = 1 << 1,
- REMOVE_WEBSQL = 1 << 2,
- REMOVE_FILE_SYSTEMS = 1 << 3,
- REMOVE_APPCACHE = 1 << 4,
+ REMOVE_LOCAL_STORAGE = 1 << 0,
+ REMOVE_INDEXEDDB = 1 << 1,
+ REMOVE_WEBSQL = 1 << 2,
+ REMOVE_FILE_SYSTEMS = 1 << 3,
+ REMOVE_APPCACHE = 1 << 4,
+ REMOVE_SESSION_STORAGE = 1 << 5,
};
- static BrowsingDataRemoverEfl* CreateForUnboundedRange(content::BrowserContext*);
- static BrowsingDataRemoverEfl* CreateForRange(content::BrowserContext*, base::Time, base::Time);
- void RemoveImpl(int, const GURL&);
+ static BrowsingDataRemoverEfl* CreateForUnboundedRange(
+ content::BrowserContext* browser_context);
+ static BrowsingDataRemoverEfl* CreateForRange(
+ content::BrowserContext* browser_context,
+ base::Time start,
+ base::Time end);
+ void RemoveImpl(int remove_mask, const GURL& origin);
virtual ~BrowsingDataRemoverEfl();
void ClearNetworkCache();
- // deletes app cache for given origin
- void DeleteAppCachesForOrigin(const url::Origin& origin);
+ BrowsingDataRemoverEfl(const BrowsingDataRemoverEfl&) = delete;
+ BrowsingDataRemoverEfl& operator=(const BrowsingDataRemoverEfl&) = delete;
protected:
- BrowsingDataRemoverEfl(content::BrowserContext*, base::Time start, base::Time end);
+ BrowsingDataRemoverEfl(content::BrowserContext* browser_context,
+ base::Time start,
+ base::Time end);
- // Quota managed data uses a different bitmask for types than
- // BrowsingDataRemover uses. This method generates that mask.
- static int GenerateQuotaClientMask(int);
+ // Quota managed data uses a different representation for storage types than
+ // BrowsingDataRemover uses. This method generates that representation.
+ static storage::QuotaClientTypes GenerateQuotaClientTypes(int remove_mask);
private:
- void ClearNetworkCacheOnIOThread();
-
- // Callback when the cache has been cleared.
- void DoClearCache(int);
-
// Invoked on the UI thread to delete local storage.
void ClearLocalStorageOnUIThread();
// Callback to deal with the list gathered in ClearLocalStorageOnUIThread.
void OnGotLocalStorageUsageInfo(
- const std::vector<content::StorageUsageInfo>&);
+ const std::vector<content::StorageUsageInfo>& infos);
+
+ // Invoked on the UI thread to delete session storage.
+ void ClearSessionStorageOnUIThread();
+
+ // Callback to deal with the list gathered in ClearSessionStorageOnUIThread.
+ void OnGotSessionStorageUsageInfo(
+ const std::vector<content::SessionStorageUsageInfo>& infos);
// Invoked on the IO thread to delete all storage types managed by the quota
// system: AppCache, Databases, FileSystems.
void ClearQuotaManagedDataOnIOThread();
- // Callback to respond to QuotaManager::GetOriginsModifiedSince, which is the
- // core of 'ClearQuotaManagedDataOnIOThread'.
-#if !defined(EWK_BRINGUP) // FIXME: m67 bringup
- void OnGotQuotaManagedOrigins(const std::set<GURL>&, storage::StorageType);
+ void ClearQuotaManagedDataInternal(blink::mojom::StorageType type);
+ // Callback to respond to QuotaManager::GetBucketsModifiedBetween,
+ // which is the core of 'ClearQuotaManagedDataOnIOThread'.
+ void OnGotQuotaManagedBuckets(const std::set<storage::BucketLocator>& buckets,
+ blink::mojom::StorageType type);
// Callback responding to deletion of a single quota managed origin's
// persistent data
- void OnQuotaManagedOriginDeletion(const GURL&, storage::StorageType, storage::QuotaStatusCode);
-#endif
+ void OnQuotaManagedBucketDeleted(const storage::BucketLocator& bucket,
+ blink::mojom::QuotaStatusCode status);
// Called to check whether all temporary and persistent origin data that
// should be deleted has been deleted. If everything's good to go, invokes
// OnQuotaManagedDataDeleted on the UI thread.
// deleted. Updates the waiting flag and invokes NotifyAndDeleteIfDone.
void OnQuotaManagedDataDeleted();
- void ClearedCache();
bool AllDone();
void DeleteIfDone();
content::BrowserContext* browser_context_;
- content::AppCacheService* app_cache_service_;
// The QuotaManager is owned by the profile; we can use a raw pointer here,
// and rely on the profile to destroy the object whenever it's reasonable.
- storage::QuotaManager* quota_manager_;
+ storage::QuotaManager* quota_manager_ = nullptr;
// The DOMStorageContext is owned by the profile; we'll store a raw pointer.
- content::DOMStorageContext* dom_storage_context_;
+ content::DOMStorageContext* dom_storage_context_ = nullptr;
// Start time to delete from.
base::Time delete_begin_;
// End time to delete to.
base::Time delete_end_;
- enum CacheState {
- STATE_NONE,
- STATE_CREATE_MAIN,
- STATE_CREATE_MEDIA,
- STATE_DELETE_MAIN,
- STATE_DELETE_MEDIA,
- STATE_DONE
- };
- CacheState next_cache_state_;
- disk_cache::Backend* cache_;
-
- content::NotificationRegistrar registrar_;
- std::set<int> renderers_;
-
- // Used to delete data from HTTP cache.
- scoped_refptr<net::URLRequestContextGetter> main_context_getter_;
- scoped_refptr<net::URLRequestContextGetter> media_context_getter_;
-
- bool waiting_for_clear_cache_;
- bool waiting_for_clear_local_storage_;
- bool waiting_for_clear_quota_managed_data_;
+ bool waiting_for_clear_local_storage_ = false;
+ bool waiting_for_clear_session_storage_ = false;
+ bool waiting_for_clear_quota_managed_data_ = false;
// Tracking how many origins need to be deleted, and whether we're finished
// gathering origins.
- int quota_managed_origins_to_delete_count_;
- int quota_managed_storage_types_to_delete_count_;
+ int quota_managed_origins_to_delete_count_ = 0;
+ int quota_managed_storage_types_to_delete_count_ = 0;
// The removal mask for the current removal operation.
- int remove_mask_;
+ int remove_mask_ = 0;
// The origin for the current removal operation.
- GURL remove_origin_;
+ url::Origin remove_origin_;
};
#endif