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 weak_ptr_factory_(this) {} | 42 weak_ptr_factory_(this) {} |
41 | 43 |
42 LocalDataContainer::~LocalDataContainer() {} | 44 LocalDataContainer::~LocalDataContainer() {} |
43 | 45 |
44 void LocalDataContainer::Init(CookiesTreeModel* model) { | 46 void LocalDataContainer::Init(CookiesTreeModel* model) { |
45 DCHECK(!model_); | 47 DCHECK(!model_); |
46 model_ = model; | 48 model_ = model; |
47 | 49 |
48 batches_started_ = 1; | 50 batches_started_ = 1; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 weak_ptr_factory_.GetWeakPtr())); | 111 weak_ptr_factory_.GetWeakPtr())); |
110 } | 112 } |
111 | 113 |
112 if (service_worker_helper_.get()) { | 114 if (service_worker_helper_.get()) { |
113 batches_started_++; | 115 batches_started_++; |
114 service_worker_helper_->StartFetching( | 116 service_worker_helper_->StartFetching( |
115 base::Bind(&LocalDataContainer::OnServiceWorkerModelInfoLoaded, | 117 base::Bind(&LocalDataContainer::OnServiceWorkerModelInfoLoaded, |
116 weak_ptr_factory_.GetWeakPtr())); | 118 weak_ptr_factory_.GetWeakPtr())); |
117 } | 119 } |
118 | 120 |
| 121 if (cache_storage_helper_.get()) { |
| 122 batches_started_++; |
| 123 cache_storage_helper_->StartFetching( |
| 124 base::Bind(&LocalDataContainer::OnCacheStorageModelInfoLoaded, |
| 125 weak_ptr_factory_.GetWeakPtr())); |
| 126 } |
| 127 |
119 if (flash_lso_helper_.get()) { | 128 if (flash_lso_helper_.get()) { |
120 batches_started_++; | 129 batches_started_++; |
121 flash_lso_helper_->StartFetching( | 130 flash_lso_helper_->StartFetching( |
122 base::Bind(&LocalDataContainer::OnFlashLSOInfoLoaded, | 131 base::Bind(&LocalDataContainer::OnFlashLSOInfoLoaded, |
123 weak_ptr_factory_.GetWeakPtr())); | 132 weak_ptr_factory_.GetWeakPtr())); |
124 } | 133 } |
125 | 134 |
126 model_->SetBatchExpectation(batches_started_, true); | 135 model_->SetBatchExpectation(batches_started_, true); |
127 } | 136 } |
128 | 137 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 model_->PopulateChannelIDInfo(this); | 215 model_->PopulateChannelIDInfo(this); |
207 } | 216 } |
208 | 217 |
209 void LocalDataContainer::OnServiceWorkerModelInfoLoaded( | 218 void LocalDataContainer::OnServiceWorkerModelInfoLoaded( |
210 const ServiceWorkerUsageInfoList& service_worker_info) { | 219 const ServiceWorkerUsageInfoList& service_worker_info) { |
211 service_worker_info_list_ = service_worker_info; | 220 service_worker_info_list_ = service_worker_info; |
212 DCHECK(model_); | 221 DCHECK(model_); |
213 model_->PopulateServiceWorkerUsageInfo(this); | 222 model_->PopulateServiceWorkerUsageInfo(this); |
214 } | 223 } |
215 | 224 |
| 225 void LocalDataContainer::OnCacheStorageModelInfoLoaded( |
| 226 const CacheStorageUsageInfoList& cache_storage_info) { |
| 227 cache_storage_info_list_ = cache_storage_info; |
| 228 DCHECK(model_); |
| 229 model_->PopulateCacheStorageUsageInfo(this); |
| 230 } |
| 231 |
216 void LocalDataContainer::OnFlashLSOInfoLoaded( | 232 void LocalDataContainer::OnFlashLSOInfoLoaded( |
217 const FlashLSODomainList& domains) { | 233 const FlashLSODomainList& domains) { |
218 flash_lso_domain_list_ = domains; | 234 flash_lso_domain_list_ = domains; |
219 DCHECK(model_); | 235 DCHECK(model_); |
220 model_->PopulateFlashLSOInfo(this); | 236 model_->PopulateFlashLSOInfo(this); |
221 } | 237 } |
OLD | NEW |