| 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/local_data_container.h" | 5 #include "chrome/browser/browsing_data/local_data_container.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/linked_ptr.h" | 8 #include "base/memory/linked_ptr.h" |
| 9 #include "chrome/browser/browsing_data/browsing_data_channel_id_helper.h" | 9 #include "chrome/browser/browsing_data/browsing_data_channel_id_helper.h" |
| 10 #include "chrome/browser/browsing_data/browsing_data_flash_lso_helper.h" | 10 #include "chrome/browser/browsing_data/browsing_data_flash_lso_helper.h" |
| 11 #include "chrome/browser/browsing_data/cookies_tree_model.h" | 11 #include "chrome/browser/browsing_data/cookies_tree_model.h" |
| 12 #include "net/cookies/canonical_cookie.h" | 12 #include "net/cookies/canonical_cookie.h" |
| 13 | 13 |
| 14 /////////////////////////////////////////////////////////////////////////////// | 14 /////////////////////////////////////////////////////////////////////////////// |
| 15 // LocalDataContainer, public: | 15 // LocalDataContainer, public: |
| 16 | 16 |
| 17 LocalDataContainer::LocalDataContainer( | 17 LocalDataContainer::LocalDataContainer( |
| 18 BrowsingDataCookieHelper* cookie_helper, | 18 BrowsingDataCookieHelper* cookie_helper, |
| 19 BrowsingDataDatabaseHelper* database_helper, | 19 BrowsingDataDatabaseHelper* database_helper, |
| 20 BrowsingDataLocalStorageHelper* local_storage_helper, | 20 BrowsingDataLocalStorageHelper* local_storage_helper, |
| 21 BrowsingDataLocalStorageHelper* session_storage_helper, | 21 BrowsingDataLocalStorageHelper* session_storage_helper, |
| 22 BrowsingDataAppCacheHelper* appcache_helper, | 22 BrowsingDataAppCacheHelper* appcache_helper, |
| 23 BrowsingDataIndexedDBHelper* indexed_db_helper, | 23 BrowsingDataIndexedDBHelper* indexed_db_helper, |
| 24 BrowsingDataFileSystemHelper* file_system_helper, | 24 BrowsingDataFileSystemHelper* file_system_helper, |
| 25 BrowsingDataQuotaHelper* quota_helper, | 25 BrowsingDataQuotaHelper* quota_helper, |
| 26 BrowsingDataChannelIDHelper* channel_id_helper, | 26 BrowsingDataChannelIDHelper* channel_id_helper, |
| 27 BrowsingDataServiceWorkerHelper* service_worker_helper, | 27 BrowsingDataServiceWorkerHelper* service_worker_helper, |
| 28 BrowsingDataCacheStorageHelper* cache_storage_helper, |
| 28 BrowsingDataFlashLSOHelper* flash_lso_helper) | 29 BrowsingDataFlashLSOHelper* flash_lso_helper) |
| 29 : appcache_helper_(appcache_helper), | 30 : appcache_helper_(appcache_helper), |
| 30 cookie_helper_(cookie_helper), | 31 cookie_helper_(cookie_helper), |
| 31 database_helper_(database_helper), | 32 database_helper_(database_helper), |
| 32 local_storage_helper_(local_storage_helper), | 33 local_storage_helper_(local_storage_helper), |
| 33 session_storage_helper_(session_storage_helper), | 34 session_storage_helper_(session_storage_helper), |
| 34 indexed_db_helper_(indexed_db_helper), | 35 indexed_db_helper_(indexed_db_helper), |
| 35 file_system_helper_(file_system_helper), | 36 file_system_helper_(file_system_helper), |
| 36 quota_helper_(quota_helper), | 37 quota_helper_(quota_helper), |
| 37 channel_id_helper_(channel_id_helper), | 38 channel_id_helper_(channel_id_helper), |
| 38 service_worker_helper_(service_worker_helper), | 39 service_worker_helper_(service_worker_helper), |
| 40 cache_storage_helper_(cache_storage_helper), |
| 39 flash_lso_helper_(flash_lso_helper), | 41 flash_lso_helper_(flash_lso_helper), |
| 40 model_(NULL), | 42 model_(NULL), |
| 41 batches_started_(0), | 43 batches_started_(0), |
| 42 weak_ptr_factory_(this) { | 44 weak_ptr_factory_(this) {} |
| 43 } | |
| 44 | 45 |
| 45 LocalDataContainer::~LocalDataContainer() {} | 46 LocalDataContainer::~LocalDataContainer() {} |
| 46 | 47 |
| 47 void LocalDataContainer::Init(CookiesTreeModel* model) { | 48 void LocalDataContainer::Init(CookiesTreeModel* model) { |
| 48 DCHECK(!model_); | 49 DCHECK(!model_); |
| 49 model_ = model; | 50 model_ = model; |
| 50 | 51 |
| 51 batches_started_ = 1; | 52 batches_started_ = 1; |
| 52 DCHECK(cookie_helper_.get()); | 53 DCHECK(cookie_helper_.get()); |
| 53 cookie_helper_->StartFetching( | 54 cookie_helper_->StartFetching( |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 weak_ptr_factory_.GetWeakPtr())); | 113 weak_ptr_factory_.GetWeakPtr())); |
| 113 } | 114 } |
| 114 | 115 |
| 115 if (service_worker_helper_.get()) { | 116 if (service_worker_helper_.get()) { |
| 116 batches_started_++; | 117 batches_started_++; |
| 117 service_worker_helper_->StartFetching( | 118 service_worker_helper_->StartFetching( |
| 118 base::Bind(&LocalDataContainer::OnServiceWorkerModelInfoLoaded, | 119 base::Bind(&LocalDataContainer::OnServiceWorkerModelInfoLoaded, |
| 119 weak_ptr_factory_.GetWeakPtr())); | 120 weak_ptr_factory_.GetWeakPtr())); |
| 120 } | 121 } |
| 121 | 122 |
| 123 if (cache_storage_helper_.get()) { |
| 124 batches_started_++; |
| 125 cache_storage_helper_->StartFetching( |
| 126 base::Bind(&LocalDataContainer::OnCacheStorageModelInfoLoaded, |
| 127 weak_ptr_factory_.GetWeakPtr())); |
| 128 } |
| 129 |
| 122 if (flash_lso_helper_.get()) { | 130 if (flash_lso_helper_.get()) { |
| 123 batches_started_++; | 131 batches_started_++; |
| 124 flash_lso_helper_->StartFetching( | 132 flash_lso_helper_->StartFetching( |
| 125 base::Bind(&LocalDataContainer::OnFlashLSOInfoLoaded, | 133 base::Bind(&LocalDataContainer::OnFlashLSOInfoLoaded, |
| 126 weak_ptr_factory_.GetWeakPtr())); | 134 weak_ptr_factory_.GetWeakPtr())); |
| 127 } | 135 } |
| 128 | 136 |
| 129 model_->SetBatchExpectation(batches_started_, true); | 137 model_->SetBatchExpectation(batches_started_, true); |
| 130 } | 138 } |
| 131 | 139 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 model_->PopulateChannelIDInfo(this); | 220 model_->PopulateChannelIDInfo(this); |
| 213 } | 221 } |
| 214 | 222 |
| 215 void LocalDataContainer::OnServiceWorkerModelInfoLoaded( | 223 void LocalDataContainer::OnServiceWorkerModelInfoLoaded( |
| 216 const ServiceWorkerUsageInfoList& service_worker_info) { | 224 const ServiceWorkerUsageInfoList& service_worker_info) { |
| 217 service_worker_info_list_ = service_worker_info; | 225 service_worker_info_list_ = service_worker_info; |
| 218 DCHECK(model_); | 226 DCHECK(model_); |
| 219 model_->PopulateServiceWorkerUsageInfo(this); | 227 model_->PopulateServiceWorkerUsageInfo(this); |
| 220 } | 228 } |
| 221 | 229 |
| 230 void LocalDataContainer::OnCacheStorageModelInfoLoaded( |
| 231 const CacheStorageUsageInfoList& cache_storage_info) { |
| 232 cache_storage_info_list_ = cache_storage_info; |
| 233 DCHECK(model_); |
| 234 model_->PopulateCacheStorageUsageInfo(this); |
| 235 } |
| 236 |
| 222 void LocalDataContainer::OnFlashLSOInfoLoaded( | 237 void LocalDataContainer::OnFlashLSOInfoLoaded( |
| 223 const FlashLSODomainList& domains) { | 238 const FlashLSODomainList& domains) { |
| 224 flash_lso_domain_list_ = domains; | 239 flash_lso_domain_list_ = domains; |
| 225 DCHECK(model_); | 240 DCHECK(model_); |
| 226 model_->PopulateFlashLSOInfo(this); | 241 model_->PopulateFlashLSOInfo(this); |
| 227 } | 242 } |
| OLD | NEW |