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