OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/browsing_data/site_data_counter.h" |
| 6 |
| 7 #include "chrome/common/pref_names.h" |
| 8 |
| 9 SiteDataCounter::SiteDataCounter() : pref_name_(prefs::kDeleteCookies), |
| 10 weak_ptr_factory_(this) { |
| 11 } |
| 12 |
| 13 SiteDataCounter::~SiteDataCounter() { |
| 14 } |
| 15 |
| 16 const std::string& SiteDataCounter::GetPrefName() const { |
| 17 return pref_name_; |
| 18 } |
| 19 |
| 20 void SiteDataCounter::Count() { |
| 21 Profile* const profile = GetProfile(); |
| 22 content::StoragePartition* storage_partition = |
| 23 content::BrowserContext::GetDefaultStoragePartition(profile); |
| 24 content::IndexedDBContext* indexed_db_context = |
| 25 storage_partition->GetIndexedDBContext(); |
| 26 content::ServiceWorkerContext* service_worker_context = |
| 27 storage_partition->GetServiceWorkerContext(); |
| 28 content::CacheStorageContext* cache_storage_context = |
| 29 storage_partition->GetCacheStorageContext(); |
| 30 storage::FileSystemContext* file_system_context = |
| 31 storage_partition->GetFileSystemContext(); |
| 32 collector_.reset(new SiteDataSizeCollector( |
| 33 storage_partition->GetPath(), |
| 34 new BrowsingDataCookieHelper(profile->GetRequestContext()), |
| 35 new BrowsingDataDatabaseHelper(profile), |
| 36 new BrowsingDataLocalStorageHelper(profile), |
| 37 new BrowsingDataAppCacheHelper(profile), |
| 38 new BrowsingDataIndexedDBHelper(indexed_db_context), |
| 39 BrowsingDataFileSystemHelper::Create(file_system_context), |
| 40 BrowsingDataChannelIDHelper::Create(profile->GetRequestContext()), |
| 41 new BrowsingDataServiceWorkerHelper(service_worker_context), |
| 42 new BrowsingDataCacheStorageHelper(cache_storage_context), |
| 43 BrowsingDataFlashLSOHelper::Create(profile))); |
| 44 collector_->Fetch(base::Bind(&SiteDataCounter::OnSiteDataSizeFetched, |
| 45 weak_ptr_factory_.GetWeakPtr())); |
| 46 } |
| 47 |
| 48 void SiteDataCounter::OnSiteDataSizeFetched(int64_t size) { |
| 49 ReportResult(size); |
| 50 } |
OLD | NEW |