| 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 scoped_refptr<BrowsingDataCookieHelper> cookie_helper, | 18 scoped_refptr<BrowsingDataCookieHelper> cookie_helper, |
| 19 scoped_refptr<BrowsingDataDatabaseHelper> database_helper, | 19 scoped_refptr<BrowsingDataDatabaseHelper> database_helper, |
| 20 scoped_refptr<BrowsingDataLocalStorageHelper> local_storage_helper, | 20 scoped_refptr<BrowsingDataLocalStorageHelper> local_storage_helper, |
| 21 scoped_refptr<BrowsingDataLocalStorageHelper> session_storage_helper, | 21 scoped_refptr<BrowsingDataLocalStorageHelper> session_storage_helper, |
| 22 scoped_refptr<BrowsingDataAppCacheHelper> appcache_helper, | 22 scoped_refptr<BrowsingDataAppCacheHelper> appcache_helper, |
| 23 scoped_refptr<BrowsingDataIndexedDBHelper> indexed_db_helper, | 23 scoped_refptr<BrowsingDataIndexedDBHelper> indexed_db_helper, |
| 24 scoped_refptr<BrowsingDataFileSystemHelper> file_system_helper, | 24 scoped_refptr<BrowsingDataFileSystemHelper> file_system_helper, |
| 25 scoped_refptr<BrowsingDataQuotaHelper> quota_helper, | 25 scoped_refptr<BrowsingDataQuotaHelper> quota_helper, |
| 26 scoped_refptr<BrowsingDataChannelIDHelper> channel_id_helper, | 26 scoped_refptr<BrowsingDataChannelIDHelper> channel_id_helper, |
| 27 scoped_refptr<BrowsingDataServiceWorkerHelper> service_worker_helper, | 27 scoped_refptr<BrowsingDataServiceWorkerHelper> service_worker_helper, |
| 28 scoped_refptr<BrowsingDataCacheStorageHelper> cache_storage_helper, | 28 scoped_refptr<BrowsingDataCacheStorageHelper> cache_storage_helper, |
| 29 scoped_refptr<BrowsingDataFlashLSOHelper> flash_lso_helper) | 29 scoped_refptr<BrowsingDataFlashLSOHelper> flash_lso_helper, |
| 30 scoped_refptr<BrowsingDataMediaLicenseHelper> media_license_helper) |
| 30 : appcache_helper_(std::move(appcache_helper)), | 31 : appcache_helper_(std::move(appcache_helper)), |
| 31 cookie_helper_(std::move(cookie_helper)), | 32 cookie_helper_(std::move(cookie_helper)), |
| 32 database_helper_(std::move(database_helper)), | 33 database_helper_(std::move(database_helper)), |
| 33 local_storage_helper_(std::move(local_storage_helper)), | 34 local_storage_helper_(std::move(local_storage_helper)), |
| 34 session_storage_helper_(std::move(session_storage_helper)), | 35 session_storage_helper_(std::move(session_storage_helper)), |
| 35 indexed_db_helper_(std::move(indexed_db_helper)), | 36 indexed_db_helper_(std::move(indexed_db_helper)), |
| 36 file_system_helper_(std::move(file_system_helper)), | 37 file_system_helper_(std::move(file_system_helper)), |
| 37 quota_helper_(std::move(quota_helper)), | 38 quota_helper_(std::move(quota_helper)), |
| 38 channel_id_helper_(std::move(channel_id_helper)), | 39 channel_id_helper_(std::move(channel_id_helper)), |
| 39 service_worker_helper_(std::move(service_worker_helper)), | 40 service_worker_helper_(std::move(service_worker_helper)), |
| 40 cache_storage_helper_(std::move(cache_storage_helper)), | 41 cache_storage_helper_(std::move(cache_storage_helper)), |
| 41 flash_lso_helper_(std::move(flash_lso_helper)), | 42 flash_lso_helper_(std::move(flash_lso_helper)), |
| 43 media_license_helper_(std::move(media_license_helper)), |
| 42 weak_ptr_factory_(this) {} | 44 weak_ptr_factory_(this) {} |
| 43 | 45 |
| 44 LocalDataContainer::~LocalDataContainer() {} | 46 LocalDataContainer::~LocalDataContainer() {} |
| 45 | 47 |
| 46 void LocalDataContainer::Init(CookiesTreeModel* model) { | 48 void LocalDataContainer::Init(CookiesTreeModel* model) { |
| 47 DCHECK(!model_); | 49 DCHECK(!model_); |
| 48 model_ = model; | 50 model_ = model; |
| 49 | 51 |
| 50 batches_started_ = 1; | 52 batches_started_ = 1; |
| 51 DCHECK(cookie_helper_.get()); | 53 DCHECK(cookie_helper_.get()); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 weak_ptr_factory_.GetWeakPtr())); | 127 weak_ptr_factory_.GetWeakPtr())); |
| 126 } | 128 } |
| 127 | 129 |
| 128 if (flash_lso_helper_.get()) { | 130 if (flash_lso_helper_.get()) { |
| 129 batches_started_++; | 131 batches_started_++; |
| 130 flash_lso_helper_->StartFetching( | 132 flash_lso_helper_->StartFetching( |
| 131 base::Bind(&LocalDataContainer::OnFlashLSOInfoLoaded, | 133 base::Bind(&LocalDataContainer::OnFlashLSOInfoLoaded, |
| 132 weak_ptr_factory_.GetWeakPtr())); | 134 weak_ptr_factory_.GetWeakPtr())); |
| 133 } | 135 } |
| 134 | 136 |
| 137 if (media_license_helper_.get()) { |
| 138 batches_started_++; |
| 139 media_license_helper_->StartFetching( |
| 140 base::Bind(&LocalDataContainer::OnMediaLicenseInfoLoaded, |
| 141 weak_ptr_factory_.GetWeakPtr())); |
| 142 } |
| 143 |
| 135 model_->SetBatchExpectation(batches_started_, true); | 144 model_->SetBatchExpectation(batches_started_, true); |
| 136 } | 145 } |
| 137 | 146 |
| 138 void LocalDataContainer::OnAppCacheModelInfoLoaded( | 147 void LocalDataContainer::OnAppCacheModelInfoLoaded( |
| 139 scoped_refptr<content::AppCacheInfoCollection> appcache_info) { | 148 scoped_refptr<content::AppCacheInfoCollection> appcache_info) { |
| 140 using content::AppCacheInfo; | 149 using content::AppCacheInfo; |
| 141 using content::AppCacheInfoCollection; | 150 using content::AppCacheInfoCollection; |
| 142 using content::AppCacheInfoVector; | 151 using content::AppCacheInfoVector; |
| 143 | 152 |
| 144 if (!appcache_info.get() || appcache_info->infos_by_origin.empty()) { | 153 if (!appcache_info.get() || appcache_info->infos_by_origin.empty()) { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 DCHECK(model_); | 236 DCHECK(model_); |
| 228 model_->PopulateCacheStorageUsageInfo(this); | 237 model_->PopulateCacheStorageUsageInfo(this); |
| 229 } | 238 } |
| 230 | 239 |
| 231 void LocalDataContainer::OnFlashLSOInfoLoaded( | 240 void LocalDataContainer::OnFlashLSOInfoLoaded( |
| 232 const FlashLSODomainList& domains) { | 241 const FlashLSODomainList& domains) { |
| 233 flash_lso_domain_list_ = domains; | 242 flash_lso_domain_list_ = domains; |
| 234 DCHECK(model_); | 243 DCHECK(model_); |
| 235 model_->PopulateFlashLSOInfo(this); | 244 model_->PopulateFlashLSOInfo(this); |
| 236 } | 245 } |
| 246 |
| 247 void LocalDataContainer::OnMediaLicenseInfoLoaded( |
| 248 const MediaLicenseInfoList& media_license_info) { |
| 249 media_license_info_list_ = media_license_info; |
| 250 DCHECK(model_); |
| 251 model_->PopulateMediaLicenseInfo(this); |
| 252 } |
| OLD | NEW |