| 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_flash_lso_helper.h" | 9 #include "chrome/browser/browsing_data/browsing_data_flash_lso_helper.h" |
| 10 #include "chrome/browser/browsing_data/browsing_data_server_bound_cert_helper.h" | 10 #include "chrome/browser/browsing_data/browsing_data_server_bound_cert_helper.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 flash_lso_helper_(flash_lso_helper), | 38 flash_lso_helper_(flash_lso_helper), |
| 39 model_(NULL), | 39 model_(NULL), |
| 40 weak_ptr_factory_(this) {} | 40 weak_ptr_factory_(this) {} |
| 41 | 41 |
| 42 LocalDataContainer::~LocalDataContainer() {} | 42 LocalDataContainer::~LocalDataContainer() {} |
| 43 | 43 |
| 44 void LocalDataContainer::Init(CookiesTreeModel* model) { | 44 void LocalDataContainer::Init(CookiesTreeModel* model) { |
| 45 DCHECK(!model_); | 45 DCHECK(!model_); |
| 46 model_ = model; | 46 model_ = model; |
| 47 | 47 |
| 48 DCHECK(cookie_helper_); | 48 DCHECK(cookie_helper_.get()); |
| 49 cookie_helper_->StartFetching( | 49 cookie_helper_->StartFetching( |
| 50 base::Bind(&LocalDataContainer::OnCookiesModelInfoLoaded, | 50 base::Bind(&LocalDataContainer::OnCookiesModelInfoLoaded, |
| 51 weak_ptr_factory_.GetWeakPtr())); | 51 weak_ptr_factory_.GetWeakPtr())); |
| 52 | 52 |
| 53 if (database_helper_) { | 53 if (database_helper_.get()) { |
| 54 database_helper_->StartFetching( | 54 database_helper_->StartFetching( |
| 55 base::Bind(&LocalDataContainer::OnDatabaseModelInfoLoaded, | 55 base::Bind(&LocalDataContainer::OnDatabaseModelInfoLoaded, |
| 56 weak_ptr_factory_.GetWeakPtr())); | 56 weak_ptr_factory_.GetWeakPtr())); |
| 57 } | 57 } |
| 58 | 58 |
| 59 if (local_storage_helper_) { | 59 if (local_storage_helper_.get()) { |
| 60 local_storage_helper_->StartFetching( | 60 local_storage_helper_->StartFetching( |
| 61 base::Bind(&LocalDataContainer::OnLocalStorageModelInfoLoaded, | 61 base::Bind(&LocalDataContainer::OnLocalStorageModelInfoLoaded, |
| 62 weak_ptr_factory_.GetWeakPtr())); | 62 weak_ptr_factory_.GetWeakPtr())); |
| 63 } | 63 } |
| 64 | 64 |
| 65 if (session_storage_helper_) { | 65 if (session_storage_helper_.get()) { |
| 66 session_storage_helper_->StartFetching( | 66 session_storage_helper_->StartFetching( |
| 67 base::Bind(&LocalDataContainer::OnSessionStorageModelInfoLoaded, | 67 base::Bind(&LocalDataContainer::OnSessionStorageModelInfoLoaded, |
| 68 weak_ptr_factory_.GetWeakPtr())); | 68 weak_ptr_factory_.GetWeakPtr())); |
| 69 } | 69 } |
| 70 | 70 |
| 71 // TODO(michaeln): When all of the UI implementations have been updated, make | 71 // TODO(michaeln): When all of the UI implementations have been updated, make |
| 72 // this a required parameter. | 72 // this a required parameter. |
| 73 if (appcache_helper_) { | 73 if (appcache_helper_.get()) { |
| 74 appcache_helper_->StartFetching( | 74 appcache_helper_->StartFetching( |
| 75 base::Bind(&LocalDataContainer::OnAppCacheModelInfoLoaded, | 75 base::Bind(&LocalDataContainer::OnAppCacheModelInfoLoaded, |
| 76 weak_ptr_factory_.GetWeakPtr())); | 76 weak_ptr_factory_.GetWeakPtr())); |
| 77 } | 77 } |
| 78 | 78 |
| 79 if (indexed_db_helper_) { | 79 if (indexed_db_helper_.get()) { |
| 80 indexed_db_helper_->StartFetching( | 80 indexed_db_helper_->StartFetching( |
| 81 base::Bind(&LocalDataContainer::OnIndexedDBModelInfoLoaded, | 81 base::Bind(&LocalDataContainer::OnIndexedDBModelInfoLoaded, |
| 82 weak_ptr_factory_.GetWeakPtr())); | 82 weak_ptr_factory_.GetWeakPtr())); |
| 83 } | 83 } |
| 84 | 84 |
| 85 if (file_system_helper_) { | 85 if (file_system_helper_.get()) { |
| 86 file_system_helper_->StartFetching( | 86 file_system_helper_->StartFetching( |
| 87 base::Bind(&LocalDataContainer::OnFileSystemModelInfoLoaded, | 87 base::Bind(&LocalDataContainer::OnFileSystemModelInfoLoaded, |
| 88 weak_ptr_factory_.GetWeakPtr())); | 88 weak_ptr_factory_.GetWeakPtr())); |
| 89 } | 89 } |
| 90 | 90 |
| 91 if (quota_helper_) { | 91 if (quota_helper_.get()) { |
| 92 quota_helper_->StartFetching( | 92 quota_helper_->StartFetching( |
| 93 base::Bind(&LocalDataContainer::OnQuotaModelInfoLoaded, | 93 base::Bind(&LocalDataContainer::OnQuotaModelInfoLoaded, |
| 94 weak_ptr_factory_.GetWeakPtr())); | 94 weak_ptr_factory_.GetWeakPtr())); |
| 95 } | 95 } |
| 96 | 96 |
| 97 if (server_bound_cert_helper_) { | 97 if (server_bound_cert_helper_.get()) { |
| 98 server_bound_cert_helper_->StartFetching( | 98 server_bound_cert_helper_->StartFetching( |
| 99 base::Bind(&LocalDataContainer::OnServerBoundCertModelInfoLoaded, | 99 base::Bind(&LocalDataContainer::OnServerBoundCertModelInfoLoaded, |
| 100 weak_ptr_factory_.GetWeakPtr())); | 100 weak_ptr_factory_.GetWeakPtr())); |
| 101 } | 101 } |
| 102 | 102 |
| 103 if (flash_lso_helper_) { | 103 if (flash_lso_helper_.get()) { |
| 104 flash_lso_helper_->StartFetching( | 104 flash_lso_helper_->StartFetching( |
| 105 base::Bind(&LocalDataContainer::OnFlashLSOInfoLoaded, | 105 base::Bind(&LocalDataContainer::OnFlashLSOInfoLoaded, |
| 106 weak_ptr_factory_.GetWeakPtr())); | 106 weak_ptr_factory_.GetWeakPtr())); |
| 107 } | 107 } |
| 108 } | 108 } |
| 109 | 109 |
| 110 void LocalDataContainer::OnAppCacheModelInfoLoaded() { | 110 void LocalDataContainer::OnAppCacheModelInfoLoaded() { |
| 111 using appcache::AppCacheInfo; | 111 using appcache::AppCacheInfo; |
| 112 using appcache::AppCacheInfoCollection; | 112 using appcache::AppCacheInfoCollection; |
| 113 using appcache::AppCacheInfoVector; | 113 using appcache::AppCacheInfoVector; |
| 114 typedef std::map<GURL, AppCacheInfoVector> InfoByOrigin; | 114 typedef std::map<GURL, AppCacheInfoVector> InfoByOrigin; |
| 115 | 115 |
| 116 scoped_refptr<AppCacheInfoCollection> appcache_info = | 116 scoped_refptr<AppCacheInfoCollection> appcache_info = |
| 117 appcache_helper_->info_collection(); | 117 appcache_helper_->info_collection(); |
| 118 if (!appcache_info || appcache_info->infos_by_origin.empty()) | 118 if (!appcache_info.get() || appcache_info->infos_by_origin.empty()) |
| 119 return; | 119 return; |
| 120 | 120 |
| 121 for (InfoByOrigin::const_iterator origin = | 121 for (InfoByOrigin::const_iterator origin = |
| 122 appcache_info->infos_by_origin.begin(); | 122 appcache_info->infos_by_origin.begin(); |
| 123 origin != appcache_info->infos_by_origin.end(); ++origin) { | 123 origin != appcache_info->infos_by_origin.end(); ++origin) { |
| 124 std::list<AppCacheInfo>& info_list = appcache_info_[origin->first]; | 124 std::list<AppCacheInfo>& info_list = appcache_info_[origin->first]; |
| 125 info_list.insert( | 125 info_list.insert( |
| 126 info_list.begin(), origin->second.begin(), origin->second.end()); | 126 info_list.begin(), origin->second.begin(), origin->second.end()); |
| 127 } | 127 } |
| 128 | 128 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 DCHECK(model_); | 186 DCHECK(model_); |
| 187 model_->PopulateServerBoundCertInfo(this); | 187 model_->PopulateServerBoundCertInfo(this); |
| 188 } | 188 } |
| 189 | 189 |
| 190 void LocalDataContainer::OnFlashLSOInfoLoaded( | 190 void LocalDataContainer::OnFlashLSOInfoLoaded( |
| 191 const FlashLSODomainList& domains) { | 191 const FlashLSODomainList& domains) { |
| 192 flash_lso_domain_list_ = domains; | 192 flash_lso_domain_list_ = domains; |
| 193 DCHECK(model_); | 193 DCHECK(model_); |
| 194 model_->PopulateFlashLSOInfo(this); | 194 model_->PopulateFlashLSOInfo(this); |
| 195 } | 195 } |
| OLD | NEW |