Chromium Code Reviews| 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/cookies_tree_model.h" | 5 #include "chrome/browser/cookies_tree_model.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/memory/linked_ptr.h" | 12 #include "base/memory/linked_ptr.h" |
| 13 #include "base/stl_util.h" | |
| 13 #include "base/string_util.h" | 14 #include "base/string_util.h" |
| 14 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 15 #include "chrome/browser/browsing_data_cookie_helper.h" | 16 #include "chrome/browser/browsing_data_cookie_helper.h" |
| 16 #include "chrome/browser/browsing_data_server_bound_cert_helper.h" | 17 #include "chrome/browser/browsing_data_server_bound_cert_helper.h" |
| 17 #include "chrome/browser/content_settings/cookie_settings.h" | 18 #include "chrome/browser/content_settings/cookie_settings.h" |
| 18 #include "chrome/browser/extensions/extension_service.h" | 19 #include "chrome/browser/extensions/extension_service.h" |
| 19 #include "grit/generated_resources.h" | 20 #include "grit/generated_resources.h" |
| 20 #include "grit/theme_resources.h" | 21 #include "grit/theme_resources.h" |
| 21 #include "grit/ui_resources.h" | 22 #include "grit/ui_resources.h" |
| 22 #include "net/base/registry_controlled_domain.h" | 23 #include "net/base/registry_controlled_domain.h" |
| 23 #include "net/cookies/cookie_monster.h" | 24 #include "net/cookies/cookie_monster.h" |
| 24 #include "net/url_request/url_request_context.h" | 25 #include "net/url_request/url_request_context.h" |
| 25 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
| 26 #include "ui/base/resource/resource_bundle.h" | 27 #include "ui/base/resource/resource_bundle.h" |
| 27 #include "ui/gfx/image/image_skia.h" | 28 #include "ui/gfx/image/image_skia.h" |
| 28 | 29 |
| 29 static const char kFileOriginNodeName[] = "file://"; | 30 static const char kFileOriginNodeName[] = "file://"; |
| 30 | 31 |
| 31 /////////////////////////////////////////////////////////////////////////////// | 32 /////////////////////////////////////////////////////////////////////////////// |
| 32 // CookieTreeNode, public: | 33 // CookieTreeNode, public: |
| 33 | 34 |
| 34 void CookieTreeNode::DeleteStoredObjects() { | 35 void CookieTreeNode::DeleteStoredObjects() { |
| 35 std::for_each(children().begin(), | 36 std::for_each(children().begin(), |
| 36 children().end(), | 37 children().end(), |
| 37 std::mem_fun(&CookieTreeNode::DeleteStoredObjects)); | 38 std::mem_fun(&CookieTreeNode::DeleteStoredObjects)); |
| 38 } | 39 } |
| 39 | 40 |
| 40 CookiesTreeModel* CookieTreeNode::GetModel() const { | 41 CookiesTreeModel* CookieTreeNode::GetModel() const { |
| 41 if (parent()) | 42 if (parent()) { |
| 42 return parent()->GetModel(); | 43 if (parent()->parent()) { |
| 43 else | 44 return parent()->parent()->GetModel(); |
| 45 } else { | |
| 46 return parent()->GetModel(); | |
| 47 } | |
| 48 } else { | |
| 44 return NULL; | 49 return NULL; |
| 50 } | |
| 45 } | 51 } |
| 46 | 52 |
| 47 /////////////////////////////////////////////////////////////////////////////// | 53 /////////////////////////////////////////////////////////////////////////////// |
| 48 // CookieTreeCookieNode, public: | 54 // CookieTreeCookieNode, public: |
| 49 | 55 |
| 50 CookieTreeCookieNode::CookieTreeCookieNode( | 56 CookieTreeCookieNode::CookieTreeCookieNode( |
| 51 std::list<net::CookieMonster::CanonicalCookie>::iterator cookie) | 57 std::list<net::CookieMonster::CanonicalCookie>::iterator cookie) |
| 52 : CookieTreeNode(UTF8ToUTF16(cookie->Name())), | 58 : CookieTreeNode(UTF8ToUTF16(cookie->Name())), |
| 53 cookie_(cookie) { | 59 cookie_(cookie) { |
| 54 } | 60 } |
| 55 | 61 |
| 56 CookieTreeCookieNode::~CookieTreeCookieNode() {} | 62 CookieTreeCookieNode::~CookieTreeCookieNode() {} |
| 57 | 63 |
| 58 void CookieTreeCookieNode::DeleteStoredObjects() { | 64 void CookieTreeCookieNode::DeleteStoredObjects() { |
| 59 // notify CookieMonster that we should delete this cookie | 65 // notify CookieMonster that we should delete this cookie |
| 60 GetModel()->cookie_helper_->DeleteCookie(*cookie_); | 66 CookieTreeAppNode* app = static_cast<CookieTreeAppNode*>( |
| 61 GetModel()->cookie_list_.erase(cookie_); | 67 parent()->parent()->parent()); |
| 68 LocalDataContainer* container = GetModel()->GetLocalDataContainer( | |
| 69 app->app_id()); | |
| 70 | |
| 71 if (container) { | |
| 72 container->cookie_helper_->DeleteCookie(*cookie_); | |
| 73 container->cookie_list_.erase(cookie_); | |
| 74 } | |
| 62 } | 75 } |
| 63 | 76 |
| 64 CookieTreeNode::DetailedInfo CookieTreeCookieNode::GetDetailedInfo() const { | 77 CookieTreeNode::DetailedInfo CookieTreeCookieNode::GetDetailedInfo() const { |
| 65 return DetailedInfo(parent()->parent()->GetTitle()).InitCookie(&*cookie_); | 78 return DetailedInfo(parent()->parent()->GetTitle()).InitCookie(&*cookie_); |
| 66 } | 79 } |
| 67 | 80 |
| 68 namespace { | 81 namespace { |
| 69 // comparison functor, for use in CookieTreeRootNode | 82 // comparison functor, for use in CookieTreeRootNode |
| 70 class OriginNodeComparator { | 83 class OriginNodeComparator { |
| 71 public: | 84 public: |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 std::list<appcache::AppCacheInfo>::iterator appcache_info) | 145 std::list<appcache::AppCacheInfo>::iterator appcache_info) |
| 133 : CookieTreeNode(UTF8ToUTF16(appcache_info->manifest_url.spec())), | 146 : CookieTreeNode(UTF8ToUTF16(appcache_info->manifest_url.spec())), |
| 134 origin_url_(origin_url), | 147 origin_url_(origin_url), |
| 135 appcache_info_(appcache_info) { | 148 appcache_info_(appcache_info) { |
| 136 } | 149 } |
| 137 | 150 |
| 138 CookieTreeAppCacheNode::~CookieTreeAppCacheNode() { | 151 CookieTreeAppCacheNode::~CookieTreeAppCacheNode() { |
| 139 } | 152 } |
| 140 | 153 |
| 141 void CookieTreeAppCacheNode::DeleteStoredObjects() { | 154 void CookieTreeAppCacheNode::DeleteStoredObjects() { |
| 142 DCHECK(GetModel()->appcache_helper_); | 155 |
|
markusheintz_
2012/06/18 16:52:41
Please delete the empty line here.
nasko
2012/06/18 19:59:14
Done.
| |
| 143 GetModel()->appcache_helper_->DeleteAppCacheGroup( | 156 CookieTreeAppNode* app = static_cast<CookieTreeAppNode*>( |
| 144 appcache_info_->manifest_url); | 157 parent()->parent()->parent()); |
| 145 GetModel()->appcache_info_[origin_url_].erase(appcache_info_); | 158 LocalDataContainer* container = GetModel()->GetLocalDataContainer( |
| 159 app->app_id()); | |
| 160 | |
| 161 if (container) { | |
| 162 DCHECK(container->appcache_helper_); | |
| 163 container->appcache_helper_->DeleteAppCacheGroup( | |
| 164 appcache_info_->manifest_url); | |
| 165 container->appcache_info_[origin_url_].erase(appcache_info_); | |
| 166 } | |
| 146 } | 167 } |
| 147 | 168 |
| 148 CookieTreeNode::DetailedInfo CookieTreeAppCacheNode::GetDetailedInfo() const { | 169 CookieTreeNode::DetailedInfo CookieTreeAppCacheNode::GetDetailedInfo() const { |
| 149 return DetailedInfo(parent()->parent()->GetTitle()).InitAppCache( | 170 return DetailedInfo(parent()->parent()->GetTitle()).InitAppCache( |
| 150 &*appcache_info_); | 171 &*appcache_info_); |
| 151 } | 172 } |
| 152 | 173 |
| 153 /////////////////////////////////////////////////////////////////////////////// | 174 /////////////////////////////////////////////////////////////////////////////// |
| 154 // CookieTreeDatabaseNode, public: | 175 // CookieTreeDatabaseNode, public: |
| 155 | 176 |
| 156 CookieTreeDatabaseNode::CookieTreeDatabaseNode( | 177 CookieTreeDatabaseNode::CookieTreeDatabaseNode( |
| 157 std::list<BrowsingDataDatabaseHelper::DatabaseInfo>::iterator database_info) | 178 std::list<BrowsingDataDatabaseHelper::DatabaseInfo>::iterator database_info) |
| 158 : CookieTreeNode(database_info->database_name.empty() ? | 179 : CookieTreeNode(database_info->database_name.empty() ? |
| 159 l10n_util::GetStringUTF16(IDS_COOKIES_WEB_DATABASE_UNNAMED_NAME) : | 180 l10n_util::GetStringUTF16(IDS_COOKIES_WEB_DATABASE_UNNAMED_NAME) : |
| 160 UTF8ToUTF16(database_info->database_name)), | 181 UTF8ToUTF16(database_info->database_name)), |
| 161 database_info_(database_info) { | 182 database_info_(database_info) { |
| 162 } | 183 } |
| 163 | 184 |
| 164 CookieTreeDatabaseNode::~CookieTreeDatabaseNode() {} | 185 CookieTreeDatabaseNode::~CookieTreeDatabaseNode() {} |
| 165 | 186 |
| 166 void CookieTreeDatabaseNode::DeleteStoredObjects() { | 187 void CookieTreeDatabaseNode::DeleteStoredObjects() { |
| 167 GetModel()->database_helper_->DeleteDatabase( | 188 CookieTreeAppNode* app = static_cast<CookieTreeAppNode*>( |
|
markusheintz_
2012/06/18 16:52:41
You repeat these 4 lines again and again in other
nasko
2012/06/18 19:59:14
The reason I didn't is that it assumes a level in
markusheintz_
2012/06/19 20:01:34
Looks like the quota node is the only exemption.
nasko
2012/06/19 22:22:40
Done.
| |
| 168 database_info_->origin_identifier, database_info_->database_name); | 189 parent()->parent()->parent()); |
| 169 GetModel()->database_info_list_.erase(database_info_); | 190 LocalDataContainer* container = GetModel()->GetLocalDataContainer( |
| 191 app->app_id()); | |
| 192 | |
| 193 if (container) { | |
| 194 container->database_helper_->DeleteDatabase( | |
| 195 database_info_->origin_identifier, database_info_->database_name); | |
| 196 container->database_info_list_.erase(database_info_); | |
| 197 } | |
| 170 } | 198 } |
| 171 | 199 |
| 172 CookieTreeNode::DetailedInfo CookieTreeDatabaseNode::GetDetailedInfo() const { | 200 CookieTreeNode::DetailedInfo CookieTreeDatabaseNode::GetDetailedInfo() const { |
| 173 return DetailedInfo(parent()->parent()->GetTitle()).InitDatabase( | 201 return DetailedInfo(parent()->parent()->GetTitle()).InitDatabase( |
| 174 &*database_info_); | 202 &*database_info_); |
| 175 } | 203 } |
| 176 | 204 |
| 177 /////////////////////////////////////////////////////////////////////////////// | 205 /////////////////////////////////////////////////////////////////////////////// |
| 178 // CookieTreeLocalStorageNode, public: | 206 // CookieTreeLocalStorageNode, public: |
| 179 | 207 |
| 180 CookieTreeLocalStorageNode::CookieTreeLocalStorageNode( | 208 CookieTreeLocalStorageNode::CookieTreeLocalStorageNode( |
| 181 std::list<BrowsingDataLocalStorageHelper::LocalStorageInfo>::iterator | 209 std::list<BrowsingDataLocalStorageHelper::LocalStorageInfo>::iterator |
| 182 local_storage_info) | 210 local_storage_info) |
| 183 : CookieTreeNode(UTF8ToUTF16(local_storage_info->origin_url.spec())), | 211 : CookieTreeNode(UTF8ToUTF16(local_storage_info->origin_url.spec())), |
| 184 local_storage_info_(local_storage_info) { | 212 local_storage_info_(local_storage_info) { |
| 185 } | 213 } |
| 186 | 214 |
| 187 CookieTreeLocalStorageNode::~CookieTreeLocalStorageNode() {} | 215 CookieTreeLocalStorageNode::~CookieTreeLocalStorageNode() {} |
| 188 | 216 |
| 189 void CookieTreeLocalStorageNode::DeleteStoredObjects() { | 217 void CookieTreeLocalStorageNode::DeleteStoredObjects() { |
| 190 GetModel()->local_storage_helper_->DeleteOrigin( | 218 CookieTreeAppNode* app = static_cast<CookieTreeAppNode*>( |
| 191 local_storage_info_->origin_url); | 219 parent()->parent()->parent()); |
| 192 GetModel()->local_storage_info_list_.erase(local_storage_info_); | 220 LocalDataContainer* container = GetModel()->GetLocalDataContainer( |
| 221 app->app_id()); | |
| 222 | |
| 223 if (container) { | |
| 224 container->local_storage_helper_->DeleteOrigin( | |
| 225 local_storage_info_->origin_url); | |
| 226 container->local_storage_info_list_.erase(local_storage_info_); | |
| 227 } | |
| 193 } | 228 } |
| 194 | 229 |
| 195 CookieTreeNode::DetailedInfo | 230 CookieTreeNode::DetailedInfo |
| 196 CookieTreeLocalStorageNode::GetDetailedInfo() const { | 231 CookieTreeLocalStorageNode::GetDetailedInfo() const { |
| 197 return DetailedInfo(parent()->parent()->GetTitle()).InitLocalStorage( | 232 return DetailedInfo(parent()->parent()->GetTitle()).InitLocalStorage( |
| 198 &*local_storage_info_); | 233 &*local_storage_info_); |
| 199 } | 234 } |
| 200 | 235 |
| 201 /////////////////////////////////////////////////////////////////////////////// | 236 /////////////////////////////////////////////////////////////////////////////// |
| 202 // CookieTreeSessionStorageNode, public: | 237 // CookieTreeSessionStorageNode, public: |
| 203 | 238 |
| 204 CookieTreeSessionStorageNode::CookieTreeSessionStorageNode( | 239 CookieTreeSessionStorageNode::CookieTreeSessionStorageNode( |
| 205 std::list<BrowsingDataLocalStorageHelper::LocalStorageInfo>::iterator | 240 std::list<BrowsingDataLocalStorageHelper::LocalStorageInfo>::iterator |
| 206 session_storage_info) | 241 session_storage_info) |
| 207 : CookieTreeNode(UTF8ToUTF16(session_storage_info->origin_url.spec())), | 242 : CookieTreeNode(UTF8ToUTF16(session_storage_info->origin_url.spec())), |
| 208 session_storage_info_(session_storage_info) { | 243 session_storage_info_(session_storage_info) { |
| 209 } | 244 } |
| 210 | 245 |
| 211 CookieTreeSessionStorageNode::~CookieTreeSessionStorageNode() {} | 246 CookieTreeSessionStorageNode::~CookieTreeSessionStorageNode() {} |
| 212 | 247 |
| 213 void CookieTreeSessionStorageNode::DeleteStoredObjects() { | 248 void CookieTreeSessionStorageNode::DeleteStoredObjects() { |
| 214 GetModel()->session_storage_info_list_.erase(session_storage_info_); | 249 CookieTreeAppNode* app = static_cast<CookieTreeAppNode*>( |
| 250 parent()->parent()->parent()); | |
| 251 LocalDataContainer* container = GetModel()->GetLocalDataContainer( | |
| 252 app->app_id()); | |
| 253 | |
| 254 if (container) { | |
| 255 container->session_storage_info_list_.erase(session_storage_info_); | |
| 256 } | |
| 215 } | 257 } |
| 216 | 258 |
| 217 CookieTreeNode::DetailedInfo | 259 CookieTreeNode::DetailedInfo |
| 218 CookieTreeSessionStorageNode::GetDetailedInfo() const { | 260 CookieTreeSessionStorageNode::GetDetailedInfo() const { |
| 219 return DetailedInfo(parent()->parent()->GetTitle()).InitSessionStorage( | 261 return DetailedInfo(parent()->parent()->GetTitle()).InitSessionStorage( |
| 220 &*session_storage_info_); | 262 &*session_storage_info_); |
| 221 } | 263 } |
| 222 | 264 |
| 223 /////////////////////////////////////////////////////////////////////////////// | 265 /////////////////////////////////////////////////////////////////////////////// |
| 224 // CookieTreeIndexedDBNode, public: | 266 // CookieTreeIndexedDBNode, public: |
| 225 | 267 |
| 226 CookieTreeIndexedDBNode::CookieTreeIndexedDBNode( | 268 CookieTreeIndexedDBNode::CookieTreeIndexedDBNode( |
| 227 std::list<BrowsingDataIndexedDBHelper::IndexedDBInfo>::iterator | 269 std::list<BrowsingDataIndexedDBHelper::IndexedDBInfo>::iterator |
| 228 indexed_db_info) | 270 indexed_db_info) |
| 229 : CookieTreeNode(UTF8ToUTF16( | 271 : CookieTreeNode(UTF8ToUTF16( |
| 230 indexed_db_info->origin.spec())), | 272 indexed_db_info->origin.spec())), |
| 231 indexed_db_info_(indexed_db_info) { | 273 indexed_db_info_(indexed_db_info) { |
| 232 } | 274 } |
| 233 | 275 |
| 234 CookieTreeIndexedDBNode::~CookieTreeIndexedDBNode() {} | 276 CookieTreeIndexedDBNode::~CookieTreeIndexedDBNode() {} |
| 235 | 277 |
| 236 void CookieTreeIndexedDBNode::DeleteStoredObjects() { | 278 void CookieTreeIndexedDBNode::DeleteStoredObjects() { |
| 237 GetModel()->indexed_db_helper_->DeleteIndexedDB( | 279 CookieTreeAppNode* app = static_cast<CookieTreeAppNode*>( |
| 238 indexed_db_info_->origin); | 280 parent()->parent()->parent()); |
| 239 GetModel()->indexed_db_info_list_.erase(indexed_db_info_); | 281 LocalDataContainer* container = GetModel()->GetLocalDataContainer( |
| 282 app->app_id()); | |
| 283 | |
| 284 if (container) { | |
| 285 container->indexed_db_helper_->DeleteIndexedDB( | |
| 286 indexed_db_info_->origin); | |
| 287 container->indexed_db_info_list_.erase(indexed_db_info_); | |
| 288 } | |
| 240 } | 289 } |
| 241 | 290 |
| 242 CookieTreeNode::DetailedInfo CookieTreeIndexedDBNode::GetDetailedInfo() const { | 291 CookieTreeNode::DetailedInfo CookieTreeIndexedDBNode::GetDetailedInfo() const { |
| 243 return DetailedInfo(parent()->parent()->GetTitle()).InitIndexedDB( | 292 return DetailedInfo(parent()->parent()->GetTitle()).InitIndexedDB( |
| 244 &*indexed_db_info_); | 293 &*indexed_db_info_); |
| 245 } | 294 } |
| 246 | 295 |
| 247 /////////////////////////////////////////////////////////////////////////////// | 296 /////////////////////////////////////////////////////////////////////////////// |
| 248 // CookieTreeFileSystemNode, public: | 297 // CookieTreeFileSystemNode, public: |
| 249 | 298 |
| 250 CookieTreeFileSystemNode::CookieTreeFileSystemNode( | 299 CookieTreeFileSystemNode::CookieTreeFileSystemNode( |
| 251 std::list<BrowsingDataFileSystemHelper::FileSystemInfo>::iterator | 300 std::list<BrowsingDataFileSystemHelper::FileSystemInfo>::iterator |
| 252 file_system_info) | 301 file_system_info) |
| 253 : CookieTreeNode(UTF8ToUTF16( | 302 : CookieTreeNode(UTF8ToUTF16( |
| 254 file_system_info->origin.spec())), | 303 file_system_info->origin.spec())), |
| 255 file_system_info_(file_system_info) { | 304 file_system_info_(file_system_info) { |
| 256 } | 305 } |
| 257 | 306 |
| 258 CookieTreeFileSystemNode::~CookieTreeFileSystemNode() {} | 307 CookieTreeFileSystemNode::~CookieTreeFileSystemNode() {} |
| 259 | 308 |
| 260 void CookieTreeFileSystemNode::DeleteStoredObjects() { | 309 void CookieTreeFileSystemNode::DeleteStoredObjects() { |
| 261 GetModel()->file_system_helper_->DeleteFileSystemOrigin( | 310 CookieTreeAppNode* app = static_cast<CookieTreeAppNode*>( |
| 262 file_system_info_->origin); | 311 parent()->parent()->parent()); |
| 263 GetModel()->file_system_info_list_.erase(file_system_info_); | 312 LocalDataContainer* container = GetModel()->GetLocalDataContainer( |
| 313 app->app_id()); | |
| 314 | |
| 315 if (container) { | |
| 316 container->file_system_helper_->DeleteFileSystemOrigin( | |
| 317 file_system_info_->origin); | |
| 318 container->file_system_info_list_.erase(file_system_info_); | |
| 319 } | |
| 264 } | 320 } |
| 265 | 321 |
| 266 CookieTreeNode::DetailedInfo CookieTreeFileSystemNode::GetDetailedInfo() const { | 322 CookieTreeNode::DetailedInfo CookieTreeFileSystemNode::GetDetailedInfo() const { |
| 267 return DetailedInfo(parent()->parent()->GetTitle()).InitFileSystem( | 323 return DetailedInfo(parent()->parent()->GetTitle()).InitFileSystem( |
| 268 &*file_system_info_); | 324 &*file_system_info_); |
| 269 } | 325 } |
| 270 | 326 |
| 271 /////////////////////////////////////////////////////////////////////////////// | 327 /////////////////////////////////////////////////////////////////////////////// |
| 272 // CookieTreeQuotaNode, public: | 328 // CookieTreeQuotaNode, public: |
| 273 | 329 |
| 274 CookieTreeQuotaNode::CookieTreeQuotaNode( | 330 CookieTreeQuotaNode::CookieTreeQuotaNode( |
| 275 std::list<BrowsingDataQuotaHelper::QuotaInfo>::iterator quota_info) | 331 std::list<BrowsingDataQuotaHelper::QuotaInfo>::iterator quota_info) |
| 276 : CookieTreeNode(UTF8ToUTF16(quota_info->host)), | 332 : CookieTreeNode(UTF8ToUTF16(quota_info->host)), |
| 277 quota_info_(quota_info) { | 333 quota_info_(quota_info) { |
| 278 } | 334 } |
| 279 | 335 |
| 280 CookieTreeQuotaNode::~CookieTreeQuotaNode() {} | 336 CookieTreeQuotaNode::~CookieTreeQuotaNode() {} |
| 281 | 337 |
| 282 void CookieTreeQuotaNode::DeleteStoredObjects() { | 338 void CookieTreeQuotaNode::DeleteStoredObjects() { |
| 283 // Calling this function may cause unexpected over-quota state of origin. | 339 // Calling this function may cause unexpected over-quota state of origin. |
| 284 // However, it'll caused no problem, just prevent usage growth of the origin. | 340 // However, it'll caused no problem, just prevent usage growth of the origin. |
| 285 GetModel()->quota_helper_->RevokeHostQuota(quota_info_->host); | 341 CookieTreeAppNode* app = static_cast<CookieTreeAppNode*>( |
| 286 GetModel()->quota_info_list_.erase(quota_info_); | 342 parent()->parent()); |
| 343 LocalDataContainer* container = GetModel()->GetLocalDataContainer( | |
| 344 app->app_id()); | |
| 345 | |
| 346 if (container) { | |
| 347 container->quota_helper_->RevokeHostQuota(quota_info_->host); | |
| 348 container->quota_info_list_.erase(quota_info_); | |
| 349 } | |
| 287 } | 350 } |
| 288 | 351 |
| 289 CookieTreeNode::DetailedInfo CookieTreeQuotaNode::GetDetailedInfo() const { | 352 CookieTreeNode::DetailedInfo CookieTreeQuotaNode::GetDetailedInfo() const { |
| 290 return DetailedInfo(parent()->parent()->GetTitle()).InitQuota( | 353 return DetailedInfo(parent()->parent()->GetTitle()).InitQuota( |
| 291 &*quota_info_); | 354 &*quota_info_); |
| 292 } | 355 } |
| 293 | 356 |
| 294 /////////////////////////////////////////////////////////////////////////////// | 357 /////////////////////////////////////////////////////////////////////////////// |
| 295 // CookieTreeServerBoundCertNode, public: | 358 // CookieTreeServerBoundCertNode, public: |
| 296 | 359 |
| 297 CookieTreeServerBoundCertNode::CookieTreeServerBoundCertNode( | 360 CookieTreeServerBoundCertNode::CookieTreeServerBoundCertNode( |
| 298 net::ServerBoundCertStore::ServerBoundCertList::iterator cert) | 361 net::ServerBoundCertStore::ServerBoundCertList::iterator cert) |
| 299 : CookieTreeNode(ASCIIToUTF16(cert->server_identifier())), | 362 : CookieTreeNode(ASCIIToUTF16(cert->server_identifier())), |
| 300 server_bound_cert_(cert) { | 363 server_bound_cert_(cert) { |
| 301 } | 364 } |
| 302 | 365 |
| 303 CookieTreeServerBoundCertNode::~CookieTreeServerBoundCertNode() {} | 366 CookieTreeServerBoundCertNode::~CookieTreeServerBoundCertNode() {} |
| 304 | 367 |
| 305 void CookieTreeServerBoundCertNode::DeleteStoredObjects() { | 368 void CookieTreeServerBoundCertNode::DeleteStoredObjects() { |
| 306 GetModel()->server_bound_cert_helper_->DeleteServerBoundCert( | 369 CookieTreeAppNode* app = static_cast<CookieTreeAppNode*>( |
| 307 server_bound_cert_->server_identifier()); | 370 parent()->parent()->parent()); |
| 308 GetModel()->server_bound_cert_list_.erase(server_bound_cert_); | 371 LocalDataContainer* container = GetModel()->GetLocalDataContainer( |
| 372 app->app_id()); | |
| 373 | |
| 374 if (container) { | |
| 375 container->server_bound_cert_helper_->DeleteServerBoundCert( | |
| 376 server_bound_cert_->server_identifier()); | |
| 377 container->server_bound_cert_list_.erase(server_bound_cert_); | |
| 378 } | |
| 309 } | 379 } |
| 310 | 380 |
| 311 CookieTreeNode::DetailedInfo | 381 CookieTreeNode::DetailedInfo |
| 312 CookieTreeServerBoundCertNode::GetDetailedInfo() const { | 382 CookieTreeServerBoundCertNode::GetDetailedInfo() const { |
| 313 return DetailedInfo(parent()->parent()->GetTitle()).InitServerBoundCert( | 383 return DetailedInfo(parent()->parent()->GetTitle()).InitServerBoundCert( |
| 314 &*server_bound_cert_); | 384 &*server_bound_cert_); |
| 315 } | 385 } |
| 316 | 386 |
| 317 /////////////////////////////////////////////////////////////////////////////// | 387 /////////////////////////////////////////////////////////////////////////////// |
| 318 // CookieTreeRootNode, public: | 388 // CookieTreeRootNode, public: |
| 319 | 389 |
| 320 CookieTreeRootNode::CookieTreeRootNode(CookiesTreeModel* model) | 390 CookieTreeRootNode::CookieTreeRootNode(CookiesTreeModel* model) |
| 321 : model_(model) { | 391 : model_(model) { |
| 322 } | 392 } |
| 323 | 393 |
| 324 CookieTreeRootNode::~CookieTreeRootNode() {} | 394 CookieTreeRootNode::~CookieTreeRootNode() {} |
| 325 | 395 |
| 326 CookieTreeOriginNode* CookieTreeRootNode::GetOrCreateOriginNode( | 396 CookieTreeAppNode* CookieTreeRootNode::GetOrCreateAppNode( |
| 397 const string16& app_name, | |
| 398 const string16& app_id) { | |
| 399 CookieTreeAppNode app_node(app_name, app_id); | |
| 400 | |
| 401 // First see if there is an existing match. | |
| 402 std::vector<CookieTreeNode*>::iterator app_node_iterator = | |
| 403 std::lower_bound(children().begin(), | |
| 404 children().end(), | |
| 405 &app_node, | |
| 406 AppNodeComparator()); | |
| 407 | |
| 408 if (app_node_iterator != children().end()) | |
| 409 return static_cast<CookieTreeAppNode*>(*app_node_iterator); | |
| 410 | |
| 411 // Node doesn't exist, create a new one and insert it into the (ordered) | |
| 412 // children. | |
| 413 CookieTreeAppNode* retval = new CookieTreeAppNode(app_name, app_id); | |
| 414 DCHECK(model_); | |
| 415 model_->Add(this, retval, (app_node_iterator - children().begin())); | |
| 416 return retval; | |
| 417 } | |
| 418 | |
| 419 CookiesTreeModel* CookieTreeRootNode::GetModel() const { | |
| 420 return model_; | |
| 421 } | |
| 422 | |
| 423 CookieTreeNode::DetailedInfo CookieTreeRootNode::GetDetailedInfo() const { | |
| 424 return DetailedInfo(string16()).Init(DetailedInfo::TYPE_ROOT); | |
| 425 } | |
| 426 | |
| 427 /////////////////////////////////////////////////////////////////////////////// | |
| 428 // CookieTreeAppNode, public: | |
| 429 | |
| 430 CookieTreeAppNode::CookieTreeAppNode(const string16& app_name, | |
| 431 const string16& app_id) | |
| 432 : CookieTreeNode(app_name), | |
| 433 app_name_(app_name), | |
| 434 app_id_(app_id) {} | |
| 435 | |
| 436 CookieTreeAppNode::~CookieTreeAppNode() {} | |
| 437 | |
| 438 CookieTreeOriginNode* CookieTreeAppNode::GetOrCreateOriginNode( | |
| 327 const GURL& url) { | 439 const GURL& url) { |
| 328 CookieTreeOriginNode origin_node(url); | 440 CookieTreeOriginNode origin_node(url); |
| 329 | 441 |
| 330 // First see if there is an existing match. | 442 // First see if there is an existing match. |
| 331 std::vector<CookieTreeNode*>::iterator origin_node_iterator = | 443 std::vector<CookieTreeNode*>::iterator origin_node_iterator = |
| 332 std::lower_bound(children().begin(), | 444 std::lower_bound(children().begin(), |
| 333 children().end(), | 445 children().end(), |
| 334 &origin_node, | 446 &origin_node, |
| 335 OriginNodeComparator()); | 447 OriginNodeComparator()); |
| 336 | 448 |
| 337 if (origin_node_iterator != children().end() && | 449 if (origin_node_iterator != children().end() && |
| 338 WideToUTF16Hack(CookieTreeOriginNode::TitleForUrl(url)) == | 450 CookieTreeOriginNode::TitleForUrl(url) == |
| 339 (*origin_node_iterator)->GetTitle()) | 451 (*origin_node_iterator)->GetTitle()) |
| 340 return static_cast<CookieTreeOriginNode*>(*origin_node_iterator); | 452 return static_cast<CookieTreeOriginNode*>(*origin_node_iterator); |
| 341 // Node doesn't exist, create a new one and insert it into the (ordered) | 453 // Node doesn't exist, create a new one and insert it into the (ordered) |
| 342 // children. | 454 // children. |
| 343 CookieTreeOriginNode* retval = new CookieTreeOriginNode(url); | 455 CookieTreeOriginNode* retval = new CookieTreeOriginNode(url); |
| 344 DCHECK(model_); | 456 GetModel()->Add(this, retval, (origin_node_iterator - children().begin())); |
| 345 model_->Add(this, retval, (origin_node_iterator - children().begin())); | |
| 346 return retval; | 457 return retval; |
| 347 } | 458 } |
| 348 | 459 |
| 349 CookiesTreeModel* CookieTreeRootNode::GetModel() const { | 460 CookieTreeNode::DetailedInfo CookieTreeAppNode::GetDetailedInfo() const { |
| 350 return model_; | 461 return DetailedInfo(GetTitle()).InitApp(app_name_, app_id_); |
| 351 } | |
| 352 | |
| 353 CookieTreeNode::DetailedInfo CookieTreeRootNode::GetDetailedInfo() const { | |
| 354 return DetailedInfo(string16()).Init(DetailedInfo::TYPE_ROOT); | |
| 355 } | 462 } |
| 356 | 463 |
| 357 /////////////////////////////////////////////////////////////////////////////// | 464 /////////////////////////////////////////////////////////////////////////////// |
| 358 // CookieTreeOriginNode, public: | 465 // CookieTreeOriginNode, public: |
| 359 | 466 |
| 360 // static | 467 // static |
| 361 std::wstring CookieTreeOriginNode::TitleForUrl( | 468 string16 CookieTreeOriginNode::TitleForUrl( |
| 362 const GURL& url) { | 469 const GURL& url) { |
| 363 return UTF8ToWide(url.SchemeIsFile() ? kFileOriginNodeName : url.host()); | 470 return UTF8ToUTF16(url.SchemeIsFile() ? kFileOriginNodeName : url.host()); |
| 364 } | 471 } |
| 365 | 472 |
| 366 CookieTreeOriginNode::CookieTreeOriginNode(const GURL& url) | 473 CookieTreeOriginNode::CookieTreeOriginNode(const GURL& url) |
| 367 : CookieTreeNode(WideToUTF16Hack(TitleForUrl(url))), | 474 : CookieTreeNode(TitleForUrl(url)), |
| 368 cookies_child_(NULL), | 475 cookies_child_(NULL), |
| 369 databases_child_(NULL), | 476 databases_child_(NULL), |
| 370 local_storages_child_(NULL), | 477 local_storages_child_(NULL), |
| 371 session_storages_child_(NULL), | 478 session_storages_child_(NULL), |
| 372 appcaches_child_(NULL), | 479 appcaches_child_(NULL), |
| 373 indexed_dbs_child_(NULL), | 480 indexed_dbs_child_(NULL), |
| 374 file_systems_child_(NULL), | 481 file_systems_child_(NULL), |
| 375 quota_child_(NULL), | 482 quota_child_(NULL), |
| 376 server_bound_certs_child_(NULL), | 483 server_bound_certs_child_(NULL), |
| 377 url_(url) {} | 484 url_(url) {} |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 599 | 706 |
| 600 bool CookieTreeNode::NodeTitleComparator::operator() ( | 707 bool CookieTreeNode::NodeTitleComparator::operator() ( |
| 601 const CookieTreeNode* lhs, const CookieTreeNode* rhs) { | 708 const CookieTreeNode* lhs, const CookieTreeNode* rhs) { |
| 602 const CookieTreeNode* left = | 709 const CookieTreeNode* left = |
| 603 static_cast<const CookieTreeNode*>(lhs); | 710 static_cast<const CookieTreeNode*>(lhs); |
| 604 const CookieTreeNode* right = | 711 const CookieTreeNode* right = |
| 605 static_cast<const CookieTreeNode*>(rhs); | 712 static_cast<const CookieTreeNode*>(rhs); |
| 606 return (left->GetTitle() < right->GetTitle()); | 713 return (left->GetTitle() < right->GetTitle()); |
| 607 } | 714 } |
| 608 | 715 |
| 716 bool CookieTreeNode::AppNodeComparator::operator() ( | |
| 717 const CookieTreeNode* lhs, const CookieTreeNode* rhs) { | |
| 718 const CookieTreeAppNode* left = | |
| 719 static_cast<const CookieTreeAppNode*>(lhs); | |
| 720 const CookieTreeAppNode* right = | |
| 721 static_cast<const CookieTreeAppNode*>(rhs); | |
| 722 return (left->app_id() < right->app_id()); | |
| 723 } | |
| 724 | |
| 609 void CookieTreeNode::AddChildSortedByTitle(CookieTreeNode* new_child) { | 725 void CookieTreeNode::AddChildSortedByTitle(CookieTreeNode* new_child) { |
| 610 DCHECK(new_child); | 726 DCHECK(new_child); |
| 611 std::vector<CookieTreeNode*>::iterator iter = | 727 std::vector<CookieTreeNode*>::iterator iter = |
| 612 std::lower_bound(children().begin(), | 728 std::lower_bound(children().begin(), |
| 613 children().end(), | 729 children().end(), |
| 614 new_child, | 730 new_child, |
| 615 NodeTitleComparator()); | 731 NodeTitleComparator()); |
| 616 GetModel()->Add(this, new_child, iter - children().begin()); | 732 GetModel()->Add(this, new_child, iter - children().begin()); |
| 617 } | 733 } |
| 618 | 734 |
| 619 /////////////////////////////////////////////////////////////////////////////// | 735 /////////////////////////////////////////////////////////////////////////////// |
| 620 // CookiesTreeModel, public: | 736 // CookiesTreeModel, public: |
| 621 | 737 CookiesTreeModel::CookiesTreeModel(ContainerMap& apps_map, |
|
markusheintz_
2012/06/18 16:52:41
Below you copy the apps_map.
I think you can avoi
nasko
2012/06/18 19:59:14
Done.
| |
| 622 CookiesTreeModel::CookiesTreeModel( | 738 bool use_cookie_source) |
| 623 BrowsingDataCookieHelper* cookie_helper, | |
| 624 BrowsingDataDatabaseHelper* database_helper, | |
| 625 BrowsingDataLocalStorageHelper* local_storage_helper, | |
| 626 BrowsingDataLocalStorageHelper* session_storage_helper, | |
| 627 BrowsingDataAppCacheHelper* appcache_helper, | |
| 628 BrowsingDataIndexedDBHelper* indexed_db_helper, | |
| 629 BrowsingDataFileSystemHelper* file_system_helper, | |
| 630 BrowsingDataQuotaHelper* quota_helper, | |
| 631 BrowsingDataServerBoundCertHelper* server_bound_cert_helper, | |
| 632 bool use_cookie_source) | |
| 633 : ALLOW_THIS_IN_INITIALIZER_LIST(ui::TreeNodeModel<CookieTreeNode>( | 739 : ALLOW_THIS_IN_INITIALIZER_LIST(ui::TreeNodeModel<CookieTreeNode>( |
| 634 new CookieTreeRootNode(this))), | 740 new CookieTreeRootNode(this))), |
| 635 appcache_helper_(appcache_helper), | |
| 636 cookie_helper_(cookie_helper), | |
| 637 database_helper_(database_helper), | |
| 638 local_storage_helper_(local_storage_helper), | |
| 639 session_storage_helper_(session_storage_helper), | |
| 640 indexed_db_helper_(indexed_db_helper), | |
| 641 file_system_helper_(file_system_helper), | |
| 642 quota_helper_(quota_helper), | |
| 643 server_bound_cert_helper_(server_bound_cert_helper), | |
| 644 batch_update_(0), | |
| 645 use_cookie_source_(use_cookie_source), | 741 use_cookie_source_(use_cookie_source), |
| 646 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { | 742 batch_update_(0) { |
| 647 DCHECK(cookie_helper_); | 743 for (ContainerMap::iterator it = apps_map.begin(); |
| 648 cookie_helper_->StartFetching( | 744 it != apps_map.end(); ++it) { |
|
markusheintz_
2012/06/18 16:52:41
Please fix indentation here. Thanks.
nasko
2012/06/18 19:59:14
Done.
| |
| 649 base::Bind(&CookiesTreeModel::OnCookiesModelInfoLoaded, | 745 app_data_map_[it->first] = it->second; |
| 650 weak_ptr_factory_.GetWeakPtr())); | 746 it->second->Init(this); |
| 651 DCHECK(database_helper_); | |
| 652 database_helper_->StartFetching( | |
| 653 base::Bind(&CookiesTreeModel::OnDatabaseModelInfoLoaded, | |
| 654 weak_ptr_factory_.GetWeakPtr())); | |
| 655 DCHECK(local_storage_helper_); | |
| 656 local_storage_helper_->StartFetching( | |
| 657 base::Bind(&CookiesTreeModel::OnLocalStorageModelInfoLoaded, | |
| 658 weak_ptr_factory_.GetWeakPtr())); | |
| 659 if (session_storage_helper_) { | |
| 660 session_storage_helper_->StartFetching( | |
| 661 base::Bind(&CookiesTreeModel::OnSessionStorageModelInfoLoaded, | |
| 662 weak_ptr_factory_.GetWeakPtr())); | |
| 663 } | |
| 664 | |
| 665 // TODO(michaeln): When all of the UI implementations have been updated, make | |
| 666 // this a required parameter. | |
| 667 if (appcache_helper_) { | |
| 668 appcache_helper_->StartFetching( | |
| 669 base::Bind(&CookiesTreeModel::OnAppCacheModelInfoLoaded, | |
| 670 weak_ptr_factory_.GetWeakPtr())); | |
| 671 } | |
| 672 | |
| 673 if (indexed_db_helper_) { | |
| 674 indexed_db_helper_->StartFetching( | |
| 675 base::Bind(&CookiesTreeModel::OnIndexedDBModelInfoLoaded, | |
| 676 weak_ptr_factory_.GetWeakPtr())); | |
| 677 } | |
| 678 | |
| 679 if (file_system_helper_) { | |
| 680 file_system_helper_->StartFetching( | |
| 681 base::Bind(&CookiesTreeModel::OnFileSystemModelInfoLoaded, | |
| 682 weak_ptr_factory_.GetWeakPtr())); | |
| 683 } | |
| 684 | |
| 685 if (quota_helper_) { | |
| 686 quota_helper_->StartFetching( | |
| 687 base::Bind(&CookiesTreeModel::OnQuotaModelInfoLoaded, | |
| 688 weak_ptr_factory_.GetWeakPtr())); | |
| 689 } | |
| 690 | |
| 691 if (server_bound_cert_helper_) { | |
| 692 server_bound_cert_helper_->StartFetching( | |
| 693 base::Bind(&CookiesTreeModel::OnServerBoundCertModelInfoLoaded, | |
| 694 weak_ptr_factory_.GetWeakPtr())); | |
| 695 } | 747 } |
| 696 } | 748 } |
| 697 | 749 |
| 698 CookiesTreeModel::~CookiesTreeModel() {} | 750 CookiesTreeModel::~CookiesTreeModel() { |
| 751 STLDeleteValues(&app_data_map_); | |
| 752 } | |
| 699 | 753 |
| 700 /////////////////////////////////////////////////////////////////////////////// | 754 /////////////////////////////////////////////////////////////////////////////// |
| 701 // CookiesTreeModel, TreeModel methods (public): | 755 // CookiesTreeModel, TreeModel methods (public): |
| 702 | 756 |
| 703 // TreeModel methods: | 757 // TreeModel methods: |
| 704 // Returns the set of icons for the nodes in the tree. You only need override | 758 // Returns the set of icons for the nodes in the tree. You only need override |
| 705 // this if you don't want to use the default folder icons. | 759 // this if you don't want to use the default folder icons. |
| 706 void CookiesTreeModel::GetIcons(std::vector<gfx::ImageSkia>* icons) { | 760 void CookiesTreeModel::GetIcons(std::vector<gfx::ImageSkia>* icons) { |
| 707 icons->push_back(*ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 761 icons->push_back(*ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| 708 IDR_OMNIBOX_HTTP)); | 762 IDR_OMNIBOX_HTTP)); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 748 NotifyObserverBeginBatch(); | 802 NotifyObserverBeginBatch(); |
| 749 CookieTreeNode* root = GetRoot(); | 803 CookieTreeNode* root = GetRoot(); |
| 750 root->DeleteStoredObjects(); | 804 root->DeleteStoredObjects(); |
| 751 int num_children = root->child_count(); | 805 int num_children = root->child_count(); |
| 752 for (int i = num_children - 1; i >= 0; --i) | 806 for (int i = num_children - 1; i >= 0; --i) |
| 753 delete Remove(root, root->GetChild(i)); | 807 delete Remove(root, root->GetChild(i)); |
| 754 NotifyObserverTreeNodeChanged(root); | 808 NotifyObserverTreeNodeChanged(root); |
| 755 NotifyObserverEndBatch(); | 809 NotifyObserverEndBatch(); |
| 756 } | 810 } |
| 757 | 811 |
| 812 void CookiesTreeModel::DeleteStoredObjectsForApp(const string16& app_id) { | |
| 813 NotifyObserverBeginBatch(); | |
| 814 CookieTreeAppNode* app_node; | |
| 815 CookieTreeNode* root = GetRoot(); | |
| 816 for (int i = 0; i < root->child_count(); ++i) { | |
| 817 app_node = static_cast<CookieTreeAppNode*>(root->GetChild(i)); | |
| 818 app_node->DeleteStoredObjects(); | |
| 819 if (app_node->GetDetailedInfo().app_id == app_id) { | |
| 820 // We need to loop over and delete the child nodes, as we can't just | |
| 821 // delete the app node. The reason for this is that the app node doesn't | |
| 822 // really get deleted, unless the app is uninstalled, which doesn't happen | |
| 823 // in this case. | |
| 824 int num_children = app_node->child_count(); | |
| 825 for (int j = num_children - 1; j >= 0; --j) { | |
| 826 delete Remove(app_node, app_node->GetChild(j)); | |
| 827 } | |
| 828 break; | |
| 829 } | |
| 830 } | |
| 831 NotifyObserverTreeNodeChanged(root); | |
| 832 NotifyObserverEndBatch(); | |
| 833 } | |
| 834 | |
| 758 void CookiesTreeModel::DeleteCookieNode(CookieTreeNode* cookie_node) { | 835 void CookiesTreeModel::DeleteCookieNode(CookieTreeNode* cookie_node) { |
| 759 if (cookie_node == GetRoot()) | 836 if (cookie_node == GetRoot()) |
| 760 return; | 837 return; |
| 761 cookie_node->DeleteStoredObjects(); | 838 cookie_node->DeleteStoredObjects(); |
| 762 CookieTreeNode* parent_node = cookie_node->parent(); | 839 CookieTreeNode* parent_node = cookie_node->parent(); |
| 763 delete Remove(parent_node, cookie_node); | 840 delete Remove(parent_node, cookie_node); |
| 764 if (parent_node->empty()) | 841 if (parent_node->empty()) |
| 765 DeleteCookieNode(parent_node); | 842 DeleteCookieNode(parent_node); |
| 766 } | 843 } |
| 767 | 844 |
| 768 void CookiesTreeModel::UpdateSearchResults(const std::wstring& filter) { | 845 void CookiesTreeModel::UpdateSearchResults(const string16& filter) { |
| 769 CookieTreeNode* root = GetRoot(); | 846 CookieTreeNode* root = GetRoot(); |
| 770 int num_children = root->child_count(); | 847 int num_children = root->child_count(); |
| 771 NotifyObserverBeginBatch(); | 848 NotifyObserverBeginBatch(); |
| 772 for (int i = num_children - 1; i >= 0; --i) | 849 for (int i = num_children - 1; i >= 0; --i) |
| 773 delete Remove(root, root->GetChild(i)); | 850 delete Remove(root, root->GetChild(i)); |
| 774 PopulateCookieInfoWithFilter(filter); | 851 PopulateCookieInfoWithFilter(NULL, filter); |
| 775 PopulateDatabaseInfoWithFilter(filter); | 852 PopulateDatabaseInfoWithFilter(NULL, filter); |
| 776 PopulateLocalStorageInfoWithFilter(filter); | 853 PopulateLocalStorageInfoWithFilter(NULL, filter); |
| 777 PopulateSessionStorageInfoWithFilter(filter); | 854 PopulateSessionStorageInfoWithFilter(NULL, filter); |
| 778 PopulateAppCacheInfoWithFilter(filter); | 855 PopulateAppCacheInfoWithFilter(NULL, filter); |
| 779 PopulateIndexedDBInfoWithFilter(filter); | 856 PopulateIndexedDBInfoWithFilter(NULL, filter); |
| 780 PopulateFileSystemInfoWithFilter(filter); | 857 PopulateFileSystemInfoWithFilter(NULL, filter); |
| 781 PopulateQuotaInfoWithFilter(filter); | 858 PopulateQuotaInfoWithFilter(NULL, filter); |
| 782 PopulateServerBoundCertInfoWithFilter(filter); | 859 PopulateServerBoundCertInfoWithFilter(NULL, filter); |
| 783 NotifyObserverTreeNodeChanged(root); | 860 NotifyObserverTreeNodeChanged(root); |
| 784 NotifyObserverEndBatch(); | 861 NotifyObserverEndBatch(); |
| 785 } | 862 } |
| 786 | 863 |
| 787 void CookiesTreeModel::AddCookiesTreeObserver(Observer* observer) { | 864 void CookiesTreeModel::AddCookiesTreeObserver(Observer* observer) { |
| 788 cookies_observer_list_.AddObserver(observer); | 865 cookies_observer_list_.AddObserver(observer); |
| 789 // Call super so that TreeNodeModel can notify, too. | 866 // Call super so that TreeNodeModel can notify, too. |
| 790 ui::TreeNodeModel<CookieTreeNode>::AddObserver(observer); | 867 ui::TreeNodeModel<CookieTreeNode>::AddObserver(observer); |
| 791 } | 868 } |
| 792 | 869 |
| 793 void CookiesTreeModel::RemoveCookiesTreeObserver(Observer* observer) { | 870 void CookiesTreeModel::RemoveCookiesTreeObserver(Observer* observer) { |
| 794 cookies_observer_list_.RemoveObserver(observer); | 871 cookies_observer_list_.RemoveObserver(observer); |
| 795 // Call super so that TreeNodeModel doesn't have dead pointers. | 872 // Call super so that TreeNodeModel doesn't have dead pointers. |
| 796 ui::TreeNodeModel<CookieTreeNode>::RemoveObserver(observer); | 873 ui::TreeNodeModel<CookieTreeNode>::RemoveObserver(observer); |
| 797 } | 874 } |
| 798 | 875 |
| 799 void CookiesTreeModel::OnAppCacheModelInfoLoaded() { | |
| 800 using appcache::AppCacheInfo; | |
| 801 using appcache::AppCacheInfoCollection; | |
| 802 using appcache::AppCacheInfoVector; | |
| 803 typedef std::map<GURL, AppCacheInfoVector> InfoByOrigin; | |
| 804 | |
| 805 scoped_refptr<AppCacheInfoCollection> appcache_info = | |
| 806 appcache_helper_->info_collection(); | |
| 807 if (!appcache_info || appcache_info->infos_by_origin.empty()) | |
| 808 return; | |
| 809 | |
| 810 for (InfoByOrigin::const_iterator origin = | |
| 811 appcache_info->infos_by_origin.begin(); | |
| 812 origin != appcache_info->infos_by_origin.end(); ++origin) { | |
| 813 std::list<AppCacheInfo>& info_list = appcache_info_[origin->first]; | |
| 814 info_list.insert( | |
| 815 info_list.begin(), origin->second.begin(), origin->second.end()); | |
| 816 } | |
| 817 | |
| 818 PopulateAppCacheInfoWithFilter(std::wstring()); | |
| 819 } | |
| 820 | |
| 821 void CookiesTreeModel::PopulateAppCacheInfoWithFilter( | 876 void CookiesTreeModel::PopulateAppCacheInfoWithFilter( |
| 822 const std::wstring& filter) { | 877 const string16* app_id, |
| 878 const string16& filter) { | |
| 879 | |
| 823 using appcache::AppCacheInfo; | 880 using appcache::AppCacheInfo; |
| 824 typedef std::map<GURL, std::list<AppCacheInfo> > InfoByOrigin; | 881 typedef std::map<GURL, std::list<AppCacheInfo> > InfoByOrigin; |
| 825 | 882 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); |
| 826 if (appcache_info_.empty()) | 883 bool begin_batch = false; |
| 827 return; | 884 |
| 885 for (ContainerMap::iterator ait = app_data_map_.begin(); | |
|
markusheintz_
2012/06/19 20:01:34
Here and in all other populate methods:
I probabl
nasko
2012/06/19 22:22:40
The reason is that if app_id is NULL, you want to
| |
| 886 ait != app_data_map_.end(); ++ait ) { | |
| 887 LocalDataContainer* container = ait->second; | |
| 888 | |
| 889 if (container->appcache_info_.empty()) | |
| 890 continue; | |
| 891 | |
| 892 if (app_id && *app_id != container->app_id()) | |
| 893 continue; | |
| 894 | |
| 895 if (!begin_batch) { | |
| 896 NotifyObserverBeginBatch(); | |
| 897 begin_batch = true; | |
| 898 } | |
| 899 | |
| 900 CookieTreeAppNode* app_node = | |
| 901 root->GetOrCreateAppNode(container->app_name(), container->app_id()); | |
| 902 | |
| 903 for (InfoByOrigin::iterator origin = container->appcache_info_.begin(); | |
| 904 origin != container->appcache_info_.end(); ++origin) { | |
|
markusheintz_
2012/06/19 20:01:34
indent by 1
nasko
2012/06/19 22:22:40
Done.
| |
| 905 string16 origin_node_name = UTF8ToUTF16(origin->first.host()); | |
| 906 if (filter.empty() || | |
| 907 (origin_node_name.find(filter) != string16::npos)) { | |
| 908 CookieTreeOriginNode* origin_node = | |
| 909 app_node->GetOrCreateOriginNode(origin->first); | |
| 910 CookieTreeAppCachesNode* appcaches_node = | |
| 911 origin_node->GetOrCreateAppCachesNode(); | |
| 912 | |
| 913 for (std::list<AppCacheInfo>::iterator info = origin->second.begin(); | |
| 914 info != origin->second.end(); ++info) { | |
|
markusheintz_
2012/06/19 20:01:34
indent by 1
nasko
2012/06/19 22:22:40
Done.
| |
| 915 appcaches_node->AddAppCacheNode( | |
| 916 new CookieTreeAppCacheNode(origin->first, info)); | |
| 917 } | |
| 918 } | |
| 919 } | |
| 920 } | |
| 921 | |
| 922 if (begin_batch) { | |
| 923 NotifyObserverTreeNodeChanged(root); | |
| 924 NotifyObserverEndBatch(); | |
| 925 } | |
| 926 } | |
| 927 | |
| 928 void CookiesTreeModel::PopulateCookieInfoWithFilter( | |
| 929 const string16* app_id, | |
| 930 const string16& filter) { | |
| 931 // mmargh mmargh mmargh! delicious! | |
| 828 | 932 |
| 829 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); | 933 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); |
| 830 NotifyObserverBeginBatch(); | 934 NotifyObserverBeginBatch(); |
| 831 for (InfoByOrigin::iterator origin = appcache_info_.begin(); | 935 for (ContainerMap::iterator ait = app_data_map_.begin(); |
| 832 origin != appcache_info_.end(); ++origin) { | 936 ait != app_data_map_.end(); ++ait ) { |
| 833 std::wstring origin_node_name = UTF8ToWide(origin->first.host()); | 937 LocalDataContainer* container = ait->second; |
| 834 if (filter.empty() || | 938 |
| 835 (origin_node_name.find(filter) != std::wstring::npos)) { | 939 if (app_id && *app_id != container->app_id()) |
| 836 CookieTreeOriginNode* origin_node = | 940 continue; |
| 837 root->GetOrCreateOriginNode(origin->first); | 941 |
| 838 CookieTreeAppCachesNode* appcaches_node = | 942 CookieTreeAppNode* app_node = |
| 839 origin_node->GetOrCreateAppCachesNode(); | 943 root->GetOrCreateAppNode(container->app_name(), container->app_id()); |
| 840 | 944 |
| 841 for (std::list<AppCacheInfo>::iterator info = origin->second.begin(); | 945 for (CookieList::iterator it = container->cookie_list_.begin(); |
| 842 info != origin->second.end(); ++info) { | 946 it != container->cookie_list_.end(); ++it) { |
|
markusheintz_
2012/06/19 20:01:34
indent by 1
nasko
2012/06/19 22:22:40
Done.
| |
| 843 appcaches_node->AddAppCacheNode( | 947 std::string source_string = it->Source(); |
| 844 new CookieTreeAppCacheNode(origin->first, info)); | 948 if (source_string.empty() || !use_cookie_source_) { |
| 949 std::string domain = it->Domain(); | |
| 950 if (domain.length() > 1 && domain[0] == '.') | |
| 951 domain = domain.substr(1); | |
| 952 | |
| 953 // We treat secure cookies just the same as normal ones. | |
| 954 source_string = std::string(chrome::kHttpScheme) + | |
| 955 content::kStandardSchemeSeparator + domain + "/"; | |
| 956 } | |
| 957 | |
| 958 GURL source(source_string); | |
| 959 if (!filter.size() || | |
| 960 (CookieTreeOriginNode::TitleForUrl(source).find(filter) != | |
| 961 std::string::npos)) { | |
| 962 CookieTreeOriginNode* origin_node = | |
| 963 app_node->GetOrCreateOriginNode(source); | |
| 964 CookieTreeCookiesNode* cookies_node = | |
| 965 origin_node->GetOrCreateCookiesNode(); | |
| 966 CookieTreeCookieNode* new_cookie = new CookieTreeCookieNode(it); | |
| 967 cookies_node->AddCookieNode(new_cookie); | |
| 845 } | 968 } |
| 846 } | 969 } |
| 847 } | 970 } |
| 848 NotifyObserverTreeNodeChanged(root); | 971 NotifyObserverTreeNodeChanged(root); |
| 849 NotifyObserverEndBatch(); | 972 NotifyObserverEndBatch(); |
| 850 } | 973 } |
| 851 | 974 |
| 852 void CookiesTreeModel::OnCookiesModelInfoLoaded( | |
| 853 const net::CookieList& cookie_list) { | |
| 854 cookie_list_.insert(cookie_list_.begin(), | |
| 855 cookie_list.begin(), | |
| 856 cookie_list.end()); | |
| 857 PopulateCookieInfoWithFilter(std::wstring()); | |
| 858 } | |
| 859 | |
| 860 void CookiesTreeModel::PopulateCookieInfoWithFilter( | |
| 861 const std::wstring& filter) { | |
| 862 // mmargh mmargh mmargh! delicious! | |
| 863 | |
| 864 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); | |
| 865 NotifyObserverBeginBatch(); | |
| 866 for (CookieList::iterator it = cookie_list_.begin(); | |
| 867 it != cookie_list_.end(); ++it) { | |
| 868 std::string source_string = it->Source(); | |
| 869 if (source_string.empty() || !use_cookie_source_) { | |
| 870 std::string domain = it->Domain(); | |
| 871 if (domain.length() > 1 && domain[0] == '.') | |
| 872 domain = domain.substr(1); | |
| 873 | |
| 874 // We treat secure cookies just the same as normal ones. | |
| 875 source_string = std::string(chrome::kHttpScheme) + | |
| 876 content::kStandardSchemeSeparator + domain + "/"; | |
| 877 } | |
| 878 | |
| 879 GURL source(source_string); | |
| 880 if (!filter.size() || | |
| 881 (CookieTreeOriginNode::TitleForUrl(source).find(filter) != | |
| 882 std::string::npos)) { | |
| 883 CookieTreeOriginNode* origin_node = | |
| 884 root->GetOrCreateOriginNode(source); | |
| 885 CookieTreeCookiesNode* cookies_node = | |
| 886 origin_node->GetOrCreateCookiesNode(); | |
| 887 CookieTreeCookieNode* new_cookie = new CookieTreeCookieNode(it); | |
| 888 cookies_node->AddCookieNode(new_cookie); | |
| 889 } | |
| 890 } | |
| 891 NotifyObserverTreeNodeChanged(root); | |
| 892 NotifyObserverEndBatch(); | |
| 893 } | |
| 894 | |
| 895 void CookiesTreeModel::OnDatabaseModelInfoLoaded( | |
| 896 const DatabaseInfoList& database_info) { | |
| 897 database_info_list_ = database_info; | |
| 898 PopulateDatabaseInfoWithFilter(std::wstring()); | |
| 899 } | |
| 900 | |
| 901 void CookiesTreeModel::PopulateDatabaseInfoWithFilter( | 975 void CookiesTreeModel::PopulateDatabaseInfoWithFilter( |
| 902 const std::wstring& filter) { | 976 const string16* app_id, |
| 903 if (database_info_list_.empty()) | 977 const string16& filter) { |
| 904 return; | 978 |
| 905 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); | 979 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); |
| 906 NotifyObserverBeginBatch(); | 980 bool begin_batch = false; |
| 907 for (DatabaseInfoList::iterator database_info = database_info_list_.begin(); | 981 |
| 908 database_info != database_info_list_.end(); | 982 for (ContainerMap::iterator ait = app_data_map_.begin(); |
| 909 ++database_info) { | 983 ait != app_data_map_.end(); ++ait ) { |
| 910 GURL origin(database_info->origin); | 984 LocalDataContainer* container = ait->second; |
| 911 | 985 |
| 912 if (!filter.size() || | 986 if (container->database_info_list_.empty()) |
|
markusheintz_
2012/06/19 20:01:34
Here and in all other Populate methods:
If you ke
| |
| 913 (CookieTreeOriginNode::TitleForUrl(origin).find(filter) != | 987 continue; |
| 914 std::wstring::npos)) { | 988 |
| 915 CookieTreeOriginNode* origin_node = | 989 if (app_id && *app_id != container->app_id()) |
| 916 root->GetOrCreateOriginNode(origin); | 990 continue; |
| 917 CookieTreeDatabasesNode* databases_node = | 991 |
| 918 origin_node->GetOrCreateDatabasesNode(); | 992 if (!begin_batch) { |
| 919 databases_node->AddDatabaseNode( | 993 NotifyObserverBeginBatch(); |
| 920 new CookieTreeDatabaseNode(database_info)); | 994 begin_batch = true; |
| 921 } | 995 } |
| 922 } | 996 |
| 923 NotifyObserverTreeNodeChanged(root); | 997 CookieTreeAppNode* app_node = |
| 924 NotifyObserverEndBatch(); | 998 root->GetOrCreateAppNode(container->app_name(), container->app_id()); |
| 925 } | 999 |
| 926 | 1000 for (DatabaseInfoList::iterator database_info = |
| 927 void CookiesTreeModel::OnLocalStorageModelInfoLoaded( | 1001 container->database_info_list_.begin(); |
| 928 const LocalStorageInfoList& local_storage_info) { | 1002 database_info != container->database_info_list_.end(); |
| 929 local_storage_info_list_ = local_storage_info; | 1003 ++database_info) { |
| 930 PopulateLocalStorageInfoWithFilter(std::wstring()); | 1004 GURL origin(database_info->origin); |
| 1005 | |
| 1006 if (!filter.size() || | |
| 1007 (CookieTreeOriginNode::TitleForUrl(origin).find(filter) != | |
| 1008 string16::npos)) { | |
| 1009 CookieTreeOriginNode* origin_node = | |
| 1010 app_node->GetOrCreateOriginNode(origin); | |
| 1011 CookieTreeDatabasesNode* databases_node = | |
| 1012 origin_node->GetOrCreateDatabasesNode(); | |
| 1013 databases_node->AddDatabaseNode( | |
| 1014 new CookieTreeDatabaseNode(database_info)); | |
| 1015 } | |
| 1016 } | |
| 1017 } | |
| 1018 | |
| 1019 if (begin_batch) { | |
| 1020 NotifyObserverTreeNodeChanged(root); | |
| 1021 NotifyObserverEndBatch(); | |
| 1022 } | |
| 931 } | 1023 } |
| 932 | 1024 |
| 933 void CookiesTreeModel::PopulateLocalStorageInfoWithFilter( | 1025 void CookiesTreeModel::PopulateLocalStorageInfoWithFilter( |
| 934 const std::wstring& filter) { | 1026 const string16* app_id, |
| 935 if (local_storage_info_list_.empty()) | 1027 const string16& filter) { |
| 936 return; | 1028 |
| 937 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); | 1029 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); |
| 938 NotifyObserverBeginBatch(); | 1030 bool begin_batch = false; |
| 939 for (LocalStorageInfoList::iterator local_storage_info = | 1031 |
| 940 local_storage_info_list_.begin(); | 1032 for (ContainerMap::iterator ait = app_data_map_.begin(); |
| 941 local_storage_info != local_storage_info_list_.end(); | 1033 ait != app_data_map_.end(); ++ait ) { |
| 942 ++local_storage_info) { | 1034 LocalDataContainer* container = ait->second; |
| 943 const GURL& origin(local_storage_info->origin_url); | 1035 |
| 944 | 1036 if (container->local_storage_info_list_.empty()) |
| 945 if (!filter.size() || | 1037 continue; |
| 946 (CookieTreeOriginNode::TitleForUrl(origin).find(filter) != | 1038 |
| 947 std::wstring::npos)) { | 1039 if (app_id && *app_id != container->app_id()) |
| 948 CookieTreeOriginNode* origin_node = | 1040 continue; |
| 949 root->GetOrCreateOriginNode(origin); | 1041 |
| 950 CookieTreeLocalStoragesNode* local_storages_node = | 1042 if (!begin_batch) { |
| 951 origin_node->GetOrCreateLocalStoragesNode(); | 1043 NotifyObserverBeginBatch(); |
| 952 local_storages_node->AddLocalStorageNode( | 1044 begin_batch = true; |
| 953 new CookieTreeLocalStorageNode(local_storage_info)); | 1045 } |
| 954 } | 1046 |
| 955 } | 1047 CookieTreeAppNode* app_node = |
| 956 NotifyObserverTreeNodeChanged(root); | 1048 root->GetOrCreateAppNode(container->app_name(), container->app_id()); |
| 957 NotifyObserverEndBatch(); | 1049 |
| 958 } | 1050 for (LocalStorageInfoList::iterator local_storage_info = |
| 959 | 1051 container->local_storage_info_list_.begin(); |
|
markusheintz_
2012/06/19 20:01:34
Fix indentation.
nasko
2012/06/19 22:22:40
Done.
| |
| 960 void CookiesTreeModel::OnSessionStorageModelInfoLoaded( | 1052 local_storage_info != container->local_storage_info_list_.end(); |
| 961 const LocalStorageInfoList& session_storage_info) { | 1053 ++local_storage_info) { |
| 962 session_storage_info_list_ = session_storage_info; | 1054 const GURL& origin(local_storage_info->origin_url); |
| 963 PopulateSessionStorageInfoWithFilter(std::wstring()); | 1055 |
| 1056 if (!filter.size() || | |
| 1057 (CookieTreeOriginNode::TitleForUrl(origin).find(filter) != | |
| 1058 string16::npos)) { | |
| 1059 CookieTreeOriginNode* origin_node = | |
| 1060 app_node->GetOrCreateOriginNode(origin); | |
| 1061 CookieTreeLocalStoragesNode* local_storages_node = | |
| 1062 origin_node->GetOrCreateLocalStoragesNode(); | |
| 1063 local_storages_node->AddLocalStorageNode( | |
| 1064 new CookieTreeLocalStorageNode(local_storage_info)); | |
| 1065 } | |
| 1066 } | |
| 1067 } | |
| 1068 if (begin_batch) { | |
| 1069 NotifyObserverTreeNodeChanged(root); | |
| 1070 NotifyObserverEndBatch(); | |
| 1071 } | |
| 964 } | 1072 } |
| 965 | 1073 |
| 966 void CookiesTreeModel::PopulateSessionStorageInfoWithFilter( | 1074 void CookiesTreeModel::PopulateSessionStorageInfoWithFilter( |
| 967 const std::wstring& filter) { | 1075 const string16* app_id, |
| 968 if (session_storage_info_list_.empty()) | 1076 const string16& filter) { |
| 969 return; | 1077 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); |
| 970 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); | 1078 bool begin_batch = false; |
| 971 NotifyObserverBeginBatch(); | 1079 |
| 972 for (LocalStorageInfoList::iterator session_storage_info = | 1080 for (ContainerMap::iterator ait = app_data_map_.begin(); |
| 973 session_storage_info_list_.begin(); | 1081 ait != app_data_map_.end(); ++ait ) { |
| 974 session_storage_info != session_storage_info_list_.end(); | 1082 LocalDataContainer* container = ait->second; |
| 975 ++session_storage_info) { | 1083 |
| 976 const GURL& origin = session_storage_info->origin_url; | 1084 if (container->session_storage_info_list_.empty()) |
| 977 if (!filter.size() || | 1085 continue; |
| 978 (CookieTreeOriginNode::TitleForUrl(origin).find(filter) != | 1086 |
| 979 std::wstring::npos)) { | 1087 if (app_id && *app_id != container->app_id()) |
| 980 CookieTreeOriginNode* origin_node = | 1088 continue; |
| 981 root->GetOrCreateOriginNode(origin); | 1089 |
| 982 CookieTreeSessionStoragesNode* session_storages_node = | 1090 if (!begin_batch) { |
| 983 origin_node->GetOrCreateSessionStoragesNode(); | 1091 NotifyObserverBeginBatch(); |
| 984 session_storages_node->AddSessionStorageNode( | 1092 begin_batch = true; |
| 985 new CookieTreeSessionStorageNode(session_storage_info)); | 1093 } |
| 986 } | 1094 |
| 987 } | 1095 CookieTreeAppNode* app_node = |
| 988 NotifyObserverTreeNodeChanged(root); | 1096 root->GetOrCreateAppNode(container->app_name(), container->app_id()); |
| 989 NotifyObserverEndBatch(); | 1097 |
| 990 } | 1098 for (LocalStorageInfoList::iterator session_storage_info = |
| 991 | 1099 container->session_storage_info_list_.begin(); |
|
markusheintz_
2012/06/19 20:01:34
indent by 5 next two lines indet by 1
nasko
2012/06/19 22:22:40
Done.
| |
| 992 void CookiesTreeModel::OnIndexedDBModelInfoLoaded( | 1100 session_storage_info != container->session_storage_info_list_.end(); |
| 993 const IndexedDBInfoList& indexed_db_info) { | 1101 ++session_storage_info) { |
| 994 indexed_db_info_list_ = indexed_db_info; | 1102 const GURL& origin = session_storage_info->origin_url; |
| 995 PopulateIndexedDBInfoWithFilter(std::wstring()); | 1103 |
| 1104 if (!filter.size() || | |
| 1105 (CookieTreeOriginNode::TitleForUrl(origin).find(filter) != | |
| 1106 string16::npos)) { | |
| 1107 CookieTreeOriginNode* origin_node = | |
| 1108 app_node->GetOrCreateOriginNode(origin); | |
| 1109 CookieTreeSessionStoragesNode* session_storages_node = | |
| 1110 origin_node->GetOrCreateSessionStoragesNode(); | |
| 1111 session_storages_node->AddSessionStorageNode( | |
| 1112 new CookieTreeSessionStorageNode(session_storage_info)); | |
| 1113 } | |
| 1114 } | |
| 1115 } | |
| 1116 if (begin_batch) { | |
| 1117 NotifyObserverTreeNodeChanged(root); | |
| 1118 NotifyObserverEndBatch(); | |
| 1119 } | |
| 996 } | 1120 } |
| 997 | 1121 |
| 998 void CookiesTreeModel::PopulateIndexedDBInfoWithFilter( | 1122 void CookiesTreeModel::PopulateIndexedDBInfoWithFilter( |
| 999 const std::wstring& filter) { | 1123 const string16* app_id, |
| 1000 if (indexed_db_info_list_.empty()) | 1124 const string16& filter) { |
| 1001 return; | 1125 |
| 1002 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); | 1126 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); |
| 1003 NotifyObserverBeginBatch(); | 1127 bool begin_batch = false; |
| 1004 for (IndexedDBInfoList::iterator indexed_db_info = | 1128 |
| 1005 indexed_db_info_list_.begin(); | 1129 for (ContainerMap::iterator ait = app_data_map_.begin(); |
| 1006 indexed_db_info != indexed_db_info_list_.end(); | 1130 ait != app_data_map_.end(); ++ait ) { |
|
markusheintz_
2012/06/19 20:01:34
indent by one
nasko
2012/06/19 22:22:40
Done.
| |
| 1007 ++indexed_db_info) { | 1131 LocalDataContainer* container = ait->second; |
| 1008 const GURL& origin = indexed_db_info->origin; | 1132 |
| 1009 | 1133 if (container->indexed_db_info_list_.empty()) |
| 1010 if (!filter.size() || | 1134 continue; |
| 1011 (CookieTreeOriginNode::TitleForUrl(origin).find(filter) != | 1135 |
| 1012 std::wstring::npos)) { | 1136 if (app_id && *app_id != container->app_id()) |
| 1013 CookieTreeOriginNode* origin_node = | 1137 continue; |
| 1014 root->GetOrCreateOriginNode(origin); | 1138 |
| 1015 CookieTreeIndexedDBsNode* indexed_dbs_node = | 1139 if (!begin_batch) { |
| 1016 origin_node->GetOrCreateIndexedDBsNode(); | 1140 NotifyObserverBeginBatch(); |
| 1017 indexed_dbs_node->AddIndexedDBNode( | 1141 begin_batch = true; |
| 1018 new CookieTreeIndexedDBNode(indexed_db_info)); | 1142 } |
| 1019 } | 1143 |
| 1020 } | 1144 CookieTreeAppNode* app_node = |
| 1021 NotifyObserverTreeNodeChanged(root); | 1145 root->GetOrCreateAppNode(container->app_name(), container->app_id()); |
| 1022 NotifyObserverEndBatch(); | 1146 |
| 1023 } | 1147 for (IndexedDBInfoList::iterator indexed_db_info = |
| 1024 | 1148 container->indexed_db_info_list_.begin(); |
|
markusheintz_
2012/06/19 20:01:34
Indent by 5.
nasko
2012/06/19 22:22:40
Done.
| |
| 1025 void CookiesTreeModel::OnFileSystemModelInfoLoaded( | 1149 indexed_db_info != container->indexed_db_info_list_.end(); |
|
markusheintz_
2012/06/19 20:01:34
this and the next line indent by 1
nasko
2012/06/19 22:22:40
Done.
nasko
2012/06/19 22:22:40
Done.
| |
| 1026 const FileSystemInfoList& file_system_info) { | 1150 ++indexed_db_info) { |
| 1027 file_system_info_list_ = file_system_info; | 1151 const GURL& origin = indexed_db_info->origin; |
| 1028 PopulateFileSystemInfoWithFilter(std::wstring()); | 1152 |
| 1153 if (!filter.size() || | |
| 1154 (CookieTreeOriginNode::TitleForUrl(origin).find(filter) != | |
| 1155 string16::npos)) { | |
| 1156 CookieTreeOriginNode* origin_node = | |
| 1157 app_node->GetOrCreateOriginNode(origin); | |
| 1158 CookieTreeIndexedDBsNode* indexed_dbs_node = | |
| 1159 origin_node->GetOrCreateIndexedDBsNode(); | |
| 1160 indexed_dbs_node->AddIndexedDBNode( | |
| 1161 new CookieTreeIndexedDBNode(indexed_db_info)); | |
| 1162 } | |
| 1163 } | |
| 1164 } | |
| 1165 if (begin_batch) { | |
| 1166 NotifyObserverTreeNodeChanged(root); | |
| 1167 NotifyObserverEndBatch(); | |
| 1168 } | |
| 1169 } | |
| 1170 | |
| 1171 void CookiesTreeModel::PopulateServerBoundCertInfoWithFilter( | |
| 1172 const string16* app_id, | |
| 1173 const string16& filter) { | |
| 1174 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); | |
| 1175 bool begin_batch = false; | |
| 1176 | |
| 1177 for (ContainerMap::iterator ait = app_data_map_.begin(); | |
| 1178 ait != app_data_map_.end(); ++ait ) { | |
|
markusheintz_
2012/06/19 20:01:34
Indentation.
nasko
2012/06/19 22:22:40
Done.
| |
| 1179 LocalDataContainer* container = ait->second; | |
| 1180 | |
| 1181 if (container->server_bound_cert_list_.empty()) | |
| 1182 continue; | |
| 1183 | |
| 1184 if (app_id && *app_id != container->app_id()) | |
| 1185 continue; | |
| 1186 | |
| 1187 if (!begin_batch) { | |
| 1188 NotifyObserverBeginBatch(); | |
| 1189 begin_batch = true; | |
| 1190 } | |
| 1191 | |
| 1192 CookieTreeAppNode* app_node = | |
| 1193 root->GetOrCreateAppNode(container->app_name(), container->app_id()); | |
| 1194 | |
| 1195 for (ServerBoundCertList::iterator cert_info = | |
| 1196 container->server_bound_cert_list_.begin(); | |
|
markusheintz_
2012/06/19 20:01:34
Please fix indentation.
nasko
2012/06/19 22:22:40
Done.
| |
| 1197 cert_info != container->server_bound_cert_list_.end(); | |
| 1198 ++cert_info) { | |
| 1199 GURL origin(cert_info->server_identifier()); | |
| 1200 if (!origin.is_valid()) { | |
| 1201 // Domain Bound Cert. Make a valid URL to satisfy the | |
| 1202 // CookieTreeRootNode::GetOrCreateOriginNode interface. | |
| 1203 origin = GURL(std::string(chrome::kHttpsScheme) + | |
| 1204 content::kStandardSchemeSeparator + | |
| 1205 cert_info->server_identifier() + "/"); | |
| 1206 } | |
| 1207 string16 title = CookieTreeOriginNode::TitleForUrl(origin); | |
| 1208 | |
| 1209 if (!filter.size() || title.find(filter) != string16::npos) { | |
| 1210 CookieTreeOriginNode* origin_node = | |
| 1211 app_node->GetOrCreateOriginNode(origin); | |
| 1212 CookieTreeServerBoundCertsNode* server_bound_certs_node = | |
| 1213 origin_node->GetOrCreateServerBoundCertsNode(); | |
| 1214 server_bound_certs_node->AddServerBoundCertNode( | |
| 1215 new CookieTreeServerBoundCertNode(cert_info)); | |
| 1216 } | |
| 1217 } | |
| 1218 } | |
| 1219 if (begin_batch) { | |
| 1220 NotifyObserverTreeNodeChanged(root); | |
| 1221 NotifyObserverEndBatch(); | |
| 1222 } | |
| 1029 } | 1223 } |
| 1030 | 1224 |
| 1031 void CookiesTreeModel::PopulateFileSystemInfoWithFilter( | 1225 void CookiesTreeModel::PopulateFileSystemInfoWithFilter( |
| 1032 const std::wstring& filter) { | 1226 const string16* app_id, |
| 1033 if (file_system_info_list_.empty()) | 1227 const string16& filter) { |
| 1034 return; | 1228 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); |
| 1035 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); | 1229 bool begin_batch = false; |
| 1036 NotifyObserverBeginBatch(); | 1230 |
| 1037 for (FileSystemInfoList::iterator file_system_info = | 1231 for (ContainerMap::iterator ait = app_data_map_.begin(); |
| 1038 file_system_info_list_.begin(); | 1232 ait != app_data_map_.end(); ++ait ) { |
|
markusheintz_
2012/06/19 20:01:34
Please fix indentation here.
nasko
2012/06/19 22:22:40
Done.
| |
| 1039 file_system_info != file_system_info_list_.end(); | 1233 LocalDataContainer* container = ait->second; |
| 1040 ++file_system_info) { | 1234 |
| 1041 GURL origin(file_system_info->origin); | 1235 if (container->file_system_info_list_.empty()) |
| 1042 | 1236 continue; |
| 1043 if (!filter.size() || | 1237 |
| 1044 (CookieTreeOriginNode::TitleForUrl(origin).find(filter) != | 1238 if (app_id && *app_id != container->app_id()) |
| 1045 std::wstring::npos)) { | 1239 continue; |
| 1046 CookieTreeOriginNode* origin_node = | 1240 |
| 1047 root->GetOrCreateOriginNode(origin); | 1241 if (!begin_batch) { |
| 1048 CookieTreeFileSystemsNode* file_systems_node = | 1242 NotifyObserverBeginBatch(); |
| 1049 origin_node->GetOrCreateFileSystemsNode(); | 1243 begin_batch = true; |
| 1050 file_systems_node->AddFileSystemNode( | 1244 } |
| 1051 new CookieTreeFileSystemNode(file_system_info)); | 1245 |
| 1052 } | 1246 CookieTreeAppNode* app_node = |
| 1053 } | 1247 root->GetOrCreateAppNode(container->app_name(), container->app_id()); |
| 1054 NotifyObserverTreeNodeChanged(root); | 1248 |
| 1055 NotifyObserverEndBatch(); | 1249 for (FileSystemInfoList::iterator file_system_info = |
| 1056 } | 1250 container->file_system_info_list_.begin(); |
|
markusheintz_
2012/06/19 20:01:34
Please fix indentation
nasko
2012/06/19 22:22:40
Done.
| |
| 1057 | 1251 file_system_info != container->file_system_info_list_.end(); |
| 1058 void CookiesTreeModel::OnQuotaModelInfoLoaded( | 1252 ++file_system_info) { |
| 1059 const QuotaInfoArray& quota_info) { | 1253 GURL origin(file_system_info->origin); |
| 1060 quota_info_list_ = quota_info; | 1254 |
| 1061 PopulateQuotaInfoWithFilter(std::wstring()); | 1255 if (!filter.size() || |
| 1256 (CookieTreeOriginNode::TitleForUrl(origin).find(filter) != | |
| 1257 string16::npos)) { | |
| 1258 CookieTreeOriginNode* origin_node = | |
| 1259 app_node->GetOrCreateOriginNode(origin); | |
| 1260 CookieTreeFileSystemsNode* file_systems_node = | |
| 1261 origin_node->GetOrCreateFileSystemsNode(); | |
| 1262 file_systems_node->AddFileSystemNode( | |
| 1263 new CookieTreeFileSystemNode(file_system_info)); | |
| 1264 } | |
| 1265 } | |
| 1266 } | |
| 1267 if (begin_batch) { | |
| 1268 NotifyObserverTreeNodeChanged(root); | |
| 1269 NotifyObserverEndBatch(); | |
| 1270 } | |
| 1062 } | 1271 } |
| 1063 | 1272 |
| 1064 void CookiesTreeModel::PopulateQuotaInfoWithFilter( | 1273 void CookiesTreeModel::PopulateQuotaInfoWithFilter( |
| 1065 const std::wstring& filter) { | 1274 const string16* app_id, |
| 1066 if (quota_info_list_.empty()) | 1275 const string16& filter) { |
| 1067 return; | 1276 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); |
| 1068 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); | 1277 bool begin_batch = false; |
| 1069 NotifyObserverBeginBatch(); | 1278 |
| 1070 for (QuotaInfoArray::iterator quota_info = quota_info_list_.begin(); | 1279 for (ContainerMap::iterator ait = app_data_map_.begin(); |
| 1071 quota_info != quota_info_list_.end(); | 1280 ait != app_data_map_.end(); ++ait ) { |
|
markusheintz_
2012/06/19 20:01:34
Pls fix intendation.
nasko
2012/06/19 22:22:40
Done.
| |
| 1072 ++quota_info) { | 1281 LocalDataContainer* container = ait->second; |
| 1073 if (!filter.size() || | 1282 |
| 1074 (UTF8ToWide(quota_info->host).find(filter) != std::wstring::npos)) { | 1283 if (container->quota_info_list_.empty()) |
| 1075 CookieTreeOriginNode* origin_node = | 1284 continue; |
| 1076 root->GetOrCreateOriginNode(GURL("http://" + quota_info->host)); | 1285 |
| 1077 origin_node->UpdateOrCreateQuotaNode(quota_info); | 1286 if (app_id && *app_id != container->app_id()) |
| 1078 } | 1287 continue; |
| 1079 } | 1288 |
| 1080 NotifyObserverTreeNodeChanged(root); | 1289 if (!begin_batch) { |
| 1081 NotifyObserverEndBatch(); | 1290 NotifyObserverBeginBatch(); |
| 1082 } | 1291 begin_batch = true; |
| 1083 | 1292 } |
| 1084 void CookiesTreeModel::OnServerBoundCertModelInfoLoaded( | 1293 |
| 1085 const ServerBoundCertList& cert_list) { | 1294 CookieTreeAppNode* app_node = |
| 1086 server_bound_cert_list_ = cert_list; | 1295 root->GetOrCreateAppNode(container->app_name(), container->app_id()); |
| 1087 PopulateServerBoundCertInfoWithFilter(std::wstring()); | 1296 |
| 1088 } | 1297 for (QuotaInfoList::iterator quota_info = |
| 1089 | 1298 container->quota_info_list_.begin(); |
|
markusheintz_
2012/06/19 20:01:34
Please fix indentation here
nasko
2012/06/19 22:22:40
Done.
| |
| 1090 void CookiesTreeModel::PopulateServerBoundCertInfoWithFilter( | 1299 quota_info != container->quota_info_list_.end(); |
| 1091 const std::wstring& filter) { | 1300 ++quota_info) { |
| 1092 if (server_bound_cert_list_.empty()) | 1301 if (!filter.size() || |
| 1093 return; | 1302 (UTF8ToUTF16(quota_info->host).find(filter) != string16::npos)) { |
| 1094 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); | 1303 CookieTreeOriginNode* origin_node = |
| 1095 NotifyObserverBeginBatch(); | 1304 app_node->GetOrCreateOriginNode(GURL("http://" + quota_info->host)); |
| 1096 for (ServerBoundCertList::iterator cert_info = | 1305 origin_node->UpdateOrCreateQuotaNode(quota_info); |
| 1097 server_bound_cert_list_.begin(); | 1306 } |
| 1098 cert_info != server_bound_cert_list_.end(); | 1307 } |
| 1099 ++cert_info) { | 1308 } |
| 1100 GURL origin(cert_info->server_identifier()); | 1309 if (begin_batch) { |
| 1101 if (!origin.is_valid()) { | 1310 NotifyObserverTreeNodeChanged(root); |
| 1102 // Domain Bound Cert. Make a valid URL to satisfy the | 1311 NotifyObserverEndBatch(); |
| 1103 // CookieTreeRootNode::GetOrCreateOriginNode interface. | 1312 } |
| 1104 origin = GURL(std::string(chrome::kHttpsScheme) + | |
| 1105 content::kStandardSchemeSeparator + | |
| 1106 cert_info->server_identifier() + "/"); | |
| 1107 } | |
| 1108 std::wstring title = CookieTreeOriginNode::TitleForUrl(origin); | |
| 1109 | |
| 1110 if (!filter.size() || title.find(filter) != std::wstring::npos) { | |
| 1111 CookieTreeOriginNode* origin_node = | |
| 1112 root->GetOrCreateOriginNode(origin); | |
| 1113 CookieTreeServerBoundCertsNode* server_bound_certs_node = | |
| 1114 origin_node->GetOrCreateServerBoundCertsNode(); | |
| 1115 server_bound_certs_node->AddServerBoundCertNode( | |
| 1116 new CookieTreeServerBoundCertNode(cert_info)); | |
| 1117 } | |
| 1118 } | |
| 1119 NotifyObserverTreeNodeChanged(root); | |
| 1120 NotifyObserverEndBatch(); | |
| 1121 } | 1313 } |
| 1122 | 1314 |
| 1123 void CookiesTreeModel::NotifyObserverBeginBatch() { | 1315 void CookiesTreeModel::NotifyObserverBeginBatch() { |
| 1124 // Only notify the model once if we're batching in a nested manner. | 1316 // Only notify the model once if we're batching in a nested manner. |
| 1125 if (batch_update_++ == 0) { | 1317 if (batch_update_++ == 0) { |
| 1126 FOR_EACH_OBSERVER(Observer, | 1318 FOR_EACH_OBSERVER(Observer, |
| 1127 cookies_observer_list_, | 1319 cookies_observer_list_, |
| 1128 TreeModelBeginBatch(this)); | 1320 TreeModelBeginBatch(this)); |
| 1129 } | 1321 } |
| 1130 } | 1322 } |
| 1131 | 1323 |
| 1132 void CookiesTreeModel::NotifyObserverEndBatch() { | 1324 void CookiesTreeModel::NotifyObserverEndBatch() { |
| 1133 // Only notify the observers if this is the outermost call to EndBatch() if | 1325 // Only notify the observers if this is the outermost call to EndBatch() if |
| 1134 // called in a nested manner. | 1326 // called in a nested manner. |
| 1135 if (--batch_update_ == 0) { | 1327 if (--batch_update_ == 0) { |
| 1136 FOR_EACH_OBSERVER(Observer, | 1328 FOR_EACH_OBSERVER(Observer, |
| 1137 cookies_observer_list_, | 1329 cookies_observer_list_, |
| 1138 TreeModelEndBatch(this)); | 1330 TreeModelEndBatch(this)); |
| 1139 } | 1331 } |
| 1140 } | 1332 } |
| 1333 | |
| 1334 LocalDataContainer* CookiesTreeModel::GetLocalDataContainer( | |
| 1335 const string16& app_id) { | |
| 1336 LocalDataContainer* container = app_data_map_[app_id]; | |
| 1337 return container; | |
| 1338 } | |
| 1339 | |
| 1340 /////////////////////////////////////////////////////////////////////////////// | |
| 1341 // LocalDataContainer, public: | |
| 1342 | |
| 1343 LocalDataContainer::LocalDataContainer( | |
| 1344 const string16& app_name, | |
| 1345 const string16& app_id, | |
| 1346 BrowsingDataCookieHelper* cookie_helper, | |
| 1347 BrowsingDataDatabaseHelper* database_helper, | |
| 1348 BrowsingDataLocalStorageHelper* local_storage_helper, | |
| 1349 BrowsingDataLocalStorageHelper* session_storage_helper, | |
| 1350 BrowsingDataAppCacheHelper* appcache_helper, | |
| 1351 BrowsingDataIndexedDBHelper* indexed_db_helper, | |
| 1352 BrowsingDataFileSystemHelper* file_system_helper, | |
| 1353 BrowsingDataQuotaHelper* quota_helper, | |
| 1354 BrowsingDataServerBoundCertHelper* server_bound_cert_helper) | |
| 1355 : app_name_(app_name), | |
| 1356 app_id_(app_id), | |
| 1357 appcache_helper_(appcache_helper), | |
| 1358 cookie_helper_(cookie_helper), | |
| 1359 database_helper_(database_helper), | |
| 1360 local_storage_helper_(local_storage_helper), | |
| 1361 session_storage_helper_(session_storage_helper), | |
| 1362 indexed_db_helper_(indexed_db_helper), | |
| 1363 file_system_helper_(file_system_helper), | |
| 1364 quota_helper_(quota_helper), | |
| 1365 server_bound_cert_helper_(server_bound_cert_helper), | |
| 1366 delegate_(NULL), | |
| 1367 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) {} | |
| 1368 | |
| 1369 LocalDataContainer::~LocalDataContainer() {} | |
| 1370 | |
| 1371 void LocalDataContainer::Init(CookiesTreeModelDelegate* d) { | |
|
markusheintz_
2012/06/19 20:01:34
nit: s/d/delegate/
nasko
2012/06/19 22:22:40
Done.
| |
| 1372 DCHECK(!delegate_); | |
| 1373 delegate_ = d; | |
| 1374 | |
| 1375 DCHECK(cookie_helper_); | |
| 1376 cookie_helper_->StartFetching( | |
| 1377 base::Bind(&LocalDataContainer::OnCookiesModelInfoLoaded, | |
| 1378 weak_ptr_factory_.GetWeakPtr())); | |
| 1379 DCHECK(database_helper_); | |
| 1380 database_helper_->StartFetching( | |
| 1381 base::Bind(&LocalDataContainer::OnDatabaseModelInfoLoaded, | |
| 1382 weak_ptr_factory_.GetWeakPtr())); | |
| 1383 DCHECK(local_storage_helper_); | |
| 1384 local_storage_helper_->StartFetching( | |
| 1385 base::Bind(&LocalDataContainer::OnLocalStorageModelInfoLoaded, | |
| 1386 weak_ptr_factory_.GetWeakPtr())); | |
| 1387 if (session_storage_helper_) { | |
| 1388 session_storage_helper_->StartFetching( | |
| 1389 base::Bind(&LocalDataContainer::OnSessionStorageModelInfoLoaded, | |
| 1390 weak_ptr_factory_.GetWeakPtr())); | |
| 1391 } | |
| 1392 | |
| 1393 // TODO(michaeln): When all of the UI implementations have been updated, make | |
| 1394 // this a required parameter. | |
| 1395 if (appcache_helper_) { | |
| 1396 appcache_helper_->StartFetching( | |
| 1397 base::Bind(&LocalDataContainer::OnAppCacheModelInfoLoaded, | |
| 1398 weak_ptr_factory_.GetWeakPtr())); | |
| 1399 } | |
| 1400 | |
| 1401 if (indexed_db_helper_) { | |
| 1402 indexed_db_helper_->StartFetching( | |
| 1403 base::Bind(&LocalDataContainer::OnIndexedDBModelInfoLoaded, | |
| 1404 weak_ptr_factory_.GetWeakPtr())); | |
| 1405 } | |
| 1406 | |
| 1407 if (file_system_helper_) { | |
| 1408 file_system_helper_->StartFetching( | |
| 1409 base::Bind(&LocalDataContainer::OnFileSystemModelInfoLoaded, | |
| 1410 weak_ptr_factory_.GetWeakPtr())); | |
| 1411 } | |
| 1412 | |
| 1413 if (quota_helper_) { | |
| 1414 quota_helper_->StartFetching( | |
| 1415 base::Bind(&LocalDataContainer::OnQuotaModelInfoLoaded, | |
| 1416 weak_ptr_factory_.GetWeakPtr())); | |
| 1417 } | |
| 1418 | |
| 1419 if (server_bound_cert_helper_) { | |
| 1420 server_bound_cert_helper_->StartFetching( | |
| 1421 base::Bind(&LocalDataContainer::OnServerBoundCertModelInfoLoaded, | |
| 1422 weak_ptr_factory_.GetWeakPtr())); | |
| 1423 } | |
| 1424 } | |
| 1425 | |
| 1426 void LocalDataContainer::OnAppCacheModelInfoLoaded() { | |
| 1427 using appcache::AppCacheInfo; | |
| 1428 using appcache::AppCacheInfoCollection; | |
| 1429 using appcache::AppCacheInfoVector; | |
| 1430 typedef std::map<GURL, AppCacheInfoVector> InfoByOrigin; | |
| 1431 | |
| 1432 scoped_refptr<AppCacheInfoCollection> appcache_info = | |
| 1433 appcache_helper_->info_collection(); | |
| 1434 if (!appcache_info || appcache_info->infos_by_origin.empty()) | |
| 1435 return; | |
| 1436 | |
| 1437 for (InfoByOrigin::const_iterator origin = | |
| 1438 appcache_info->infos_by_origin.begin(); | |
| 1439 origin != appcache_info->infos_by_origin.end(); ++origin) { | |
| 1440 std::list<AppCacheInfo>& info_list = appcache_info_[origin->first]; | |
| 1441 info_list.insert( | |
| 1442 info_list.begin(), origin->second.begin(), origin->second.end()); | |
| 1443 } | |
| 1444 | |
| 1445 delegate_->PopulateAppCacheInfoWithFilter(&app_name_, string16()); | |
| 1446 } | |
| 1447 | |
| 1448 void LocalDataContainer::OnCookiesModelInfoLoaded( | |
| 1449 const net::CookieList& cookie_list) { | |
| 1450 cookie_list_.insert(cookie_list_.begin(), | |
| 1451 cookie_list.begin(), | |
| 1452 cookie_list.end()); | |
| 1453 DCHECK(delegate_); | |
| 1454 delegate_->PopulateCookieInfoWithFilter(&app_id_, string16()); | |
| 1455 } | |
| 1456 | |
| 1457 void LocalDataContainer::OnDatabaseModelInfoLoaded( | |
| 1458 const DatabaseInfoList& database_info) { | |
| 1459 database_info_list_ = database_info; | |
| 1460 DCHECK(delegate_); | |
| 1461 delegate_->PopulateDatabaseInfoWithFilter(&app_id_, string16()); | |
| 1462 } | |
| 1463 | |
| 1464 void LocalDataContainer::OnLocalStorageModelInfoLoaded( | |
| 1465 const LocalStorageInfoList& local_storage_info) { | |
| 1466 local_storage_info_list_ = local_storage_info; | |
| 1467 DCHECK(delegate_); | |
| 1468 delegate_->PopulateLocalStorageInfoWithFilter(&app_id_, string16()); | |
| 1469 } | |
| 1470 | |
| 1471 void LocalDataContainer::OnSessionStorageModelInfoLoaded( | |
| 1472 const LocalStorageInfoList& session_storage_info) { | |
| 1473 session_storage_info_list_ = session_storage_info; | |
| 1474 DCHECK(delegate_); | |
| 1475 delegate_->PopulateSessionStorageInfoWithFilter(&app_id_, string16()); | |
| 1476 } | |
| 1477 | |
| 1478 void LocalDataContainer::OnIndexedDBModelInfoLoaded( | |
| 1479 const IndexedDBInfoList& indexed_db_info) { | |
| 1480 indexed_db_info_list_ = indexed_db_info; | |
| 1481 DCHECK(delegate_); | |
| 1482 delegate_->PopulateIndexedDBInfoWithFilter(&app_id_, string16()); | |
| 1483 } | |
|
markusheintz_
2012/06/19 20:01:34
nit: Please add an empty line here.
nasko
2012/06/19 22:22:40
Done.
| |
| 1484 void LocalDataContainer::OnFileSystemModelInfoLoaded( | |
| 1485 const FileSystemInfoList& file_system_info) { | |
| 1486 file_system_info_list_ = file_system_info; | |
| 1487 DCHECK(delegate_); | |
| 1488 delegate_->PopulateFileSystemInfoWithFilter(&app_id_, string16()); | |
| 1489 } | |
| 1490 | |
| 1491 void LocalDataContainer::OnQuotaModelInfoLoaded( | |
| 1492 const QuotaInfoList& quota_info) { | |
| 1493 quota_info_list_ = quota_info; | |
| 1494 DCHECK(delegate_); | |
| 1495 delegate_->PopulateQuotaInfoWithFilter(&app_id_, string16()); | |
| 1496 } | |
| 1497 | |
| 1498 void LocalDataContainer::OnServerBoundCertModelInfoLoaded( | |
| 1499 const ServerBoundCertList& cert_list) { | |
| 1500 server_bound_cert_list_ = cert_list; | |
| 1501 DCHECK(delegate_); | |
| 1502 delegate_->PopulateServerBoundCertInfoWithFilter(&app_id_, string16()); | |
| 1503 } | |
| OLD | NEW |