| 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/cookies_tree_model.h" | 5 #include "chrome/browser/browsing_data/cookies_tree_model.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 case CookieTreeNode::DetailedInfo::TYPE_INDEXED_DB: | 131 case CookieTreeNode::DetailedInfo::TYPE_INDEXED_DB: |
| 132 return true; | 132 return true; |
| 133 case CookieTreeNode::DetailedInfo::TYPE_FILE_SYSTEM: | 133 case CookieTreeNode::DetailedInfo::TYPE_FILE_SYSTEM: |
| 134 return true; | 134 return true; |
| 135 case CookieTreeNode::DetailedInfo::TYPE_QUOTA: | 135 case CookieTreeNode::DetailedInfo::TYPE_QUOTA: |
| 136 return false; | 136 return false; |
| 137 case CookieTreeNode::DetailedInfo::TYPE_CHANNEL_ID: | 137 case CookieTreeNode::DetailedInfo::TYPE_CHANNEL_ID: |
| 138 return false; | 138 return false; |
| 139 case CookieTreeNode::DetailedInfo::TYPE_SERVICE_WORKER: | 139 case CookieTreeNode::DetailedInfo::TYPE_SERVICE_WORKER: |
| 140 return true; | 140 return true; |
| 141 case CookieTreeNode::DetailedInfo::TYPE_CACHE_STORAGE: |
| 142 return true; |
| 141 case CookieTreeNode::DetailedInfo::TYPE_FLASH_LSO: | 143 case CookieTreeNode::DetailedInfo::TYPE_FLASH_LSO: |
| 142 return false; | 144 return false; |
| 143 default: | 145 default: |
| 144 break; | 146 break; |
| 145 } | 147 } |
| 146 return false; | 148 return false; |
| 147 } | 149 } |
| 148 #endif | 150 #endif |
| 149 | 151 |
| 150 // This function returns the local data container associated with a leaf tree | 152 // This function returns the local data container associated with a leaf tree |
| (...skipping 14 matching lines...) Expand all Loading... |
| 165 : node_type(TYPE_NONE), | 167 : node_type(TYPE_NONE), |
| 166 cookie(NULL), | 168 cookie(NULL), |
| 167 database_info(NULL), | 169 database_info(NULL), |
| 168 local_storage_info(NULL), | 170 local_storage_info(NULL), |
| 169 session_storage_info(NULL), | 171 session_storage_info(NULL), |
| 170 appcache_info(NULL), | 172 appcache_info(NULL), |
| 171 indexed_db_info(NULL), | 173 indexed_db_info(NULL), |
| 172 file_system_info(NULL), | 174 file_system_info(NULL), |
| 173 quota_info(NULL), | 175 quota_info(NULL), |
| 174 channel_id(NULL), | 176 channel_id(NULL), |
| 175 service_worker_info(NULL) { | 177 service_worker_info(NULL), |
| 176 } | 178 cache_storage_info(NULL) {} |
| 177 | 179 |
| 178 CookieTreeNode::DetailedInfo::~DetailedInfo() {} | 180 CookieTreeNode::DetailedInfo::~DetailedInfo() {} |
| 179 | 181 |
| 180 CookieTreeNode::DetailedInfo& CookieTreeNode::DetailedInfo::Init( | 182 CookieTreeNode::DetailedInfo& CookieTreeNode::DetailedInfo::Init( |
| 181 NodeType type) { | 183 NodeType type) { |
| 182 DCHECK_EQ(TYPE_NONE, node_type); | 184 DCHECK_EQ(TYPE_NONE, node_type); |
| 183 node_type = type; | 185 node_type = type; |
| 184 return *this; | 186 return *this; |
| 185 } | 187 } |
| 186 | 188 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 } | 264 } |
| 263 | 265 |
| 264 CookieTreeNode::DetailedInfo& CookieTreeNode::DetailedInfo::InitServiceWorker( | 266 CookieTreeNode::DetailedInfo& CookieTreeNode::DetailedInfo::InitServiceWorker( |
| 265 const content::ServiceWorkerUsageInfo* service_worker_info) { | 267 const content::ServiceWorkerUsageInfo* service_worker_info) { |
| 266 Init(TYPE_SERVICE_WORKER); | 268 Init(TYPE_SERVICE_WORKER); |
| 267 this->service_worker_info = service_worker_info; | 269 this->service_worker_info = service_worker_info; |
| 268 this->origin = service_worker_info->origin; | 270 this->origin = service_worker_info->origin; |
| 269 return *this; | 271 return *this; |
| 270 } | 272 } |
| 271 | 273 |
| 274 CookieTreeNode::DetailedInfo& CookieTreeNode::DetailedInfo::InitCacheStorage( |
| 275 const content::CacheStorageUsageInfo* cache_storage_info) { |
| 276 Init(TYPE_CACHE_STORAGE); |
| 277 this->cache_storage_info = cache_storage_info; |
| 278 this->origin = cache_storage_info->origin; |
| 279 return *this; |
| 280 } |
| 281 |
| 272 CookieTreeNode::DetailedInfo& CookieTreeNode::DetailedInfo::InitFlashLSO( | 282 CookieTreeNode::DetailedInfo& CookieTreeNode::DetailedInfo::InitFlashLSO( |
| 273 const std::string& flash_lso_domain) { | 283 const std::string& flash_lso_domain) { |
| 274 Init(TYPE_FLASH_LSO); | 284 Init(TYPE_FLASH_LSO); |
| 275 this->flash_lso_domain = flash_lso_domain; | 285 this->flash_lso_domain = flash_lso_domain; |
| 276 return *this; | 286 return *this; |
| 277 } | 287 } |
| 278 | 288 |
| 279 /////////////////////////////////////////////////////////////////////////////// | 289 /////////////////////////////////////////////////////////////////////////////// |
| 280 // CookieTreeNode, public: | 290 // CookieTreeNode, public: |
| 281 | 291 |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 container->service_worker_info_list_.erase(service_worker_info_); | 564 container->service_worker_info_list_.erase(service_worker_info_); |
| 555 } | 565 } |
| 556 } | 566 } |
| 557 | 567 |
| 558 CookieTreeNode::DetailedInfo CookieTreeServiceWorkerNode::GetDetailedInfo() | 568 CookieTreeNode::DetailedInfo CookieTreeServiceWorkerNode::GetDetailedInfo() |
| 559 const { | 569 const { |
| 560 return DetailedInfo().InitServiceWorker(&*service_worker_info_); | 570 return DetailedInfo().InitServiceWorker(&*service_worker_info_); |
| 561 } | 571 } |
| 562 | 572 |
| 563 /////////////////////////////////////////////////////////////////////////////// | 573 /////////////////////////////////////////////////////////////////////////////// |
| 574 // CookieTreeCacheStorageNode, public: |
| 575 |
| 576 CookieTreeCacheStorageNode::CookieTreeCacheStorageNode( |
| 577 std::list<content::CacheStorageUsageInfo>::iterator cache_storage_info) |
| 578 : CookieTreeNode(base::UTF8ToUTF16(cache_storage_info->origin.spec())), |
| 579 cache_storage_info_(cache_storage_info) {} |
| 580 |
| 581 CookieTreeCacheStorageNode::~CookieTreeCacheStorageNode() {} |
| 582 |
| 583 void CookieTreeCacheStorageNode::DeleteStoredObjects() { |
| 584 LocalDataContainer* container = GetLocalDataContainerForNode(this); |
| 585 |
| 586 if (container) { |
| 587 container->cache_storage_helper_->DeleteCacheStorage( |
| 588 cache_storage_info_->origin); |
| 589 container->cache_storage_info_list_.erase(cache_storage_info_); |
| 590 } |
| 591 } |
| 592 |
| 593 CookieTreeNode::DetailedInfo CookieTreeCacheStorageNode::GetDetailedInfo() |
| 594 const { |
| 595 return DetailedInfo().InitCacheStorage(&*cache_storage_info_); |
| 596 } |
| 597 |
| 598 /////////////////////////////////////////////////////////////////////////////// |
| 564 // CookieTreeRootNode, public: | 599 // CookieTreeRootNode, public: |
| 565 | 600 |
| 566 CookieTreeRootNode::CookieTreeRootNode(CookiesTreeModel* model) | 601 CookieTreeRootNode::CookieTreeRootNode(CookiesTreeModel* model) |
| 567 : model_(model) { | 602 : model_(model) { |
| 568 } | 603 } |
| 569 | 604 |
| 570 CookieTreeRootNode::~CookieTreeRootNode() {} | 605 CookieTreeRootNode::~CookieTreeRootNode() {} |
| 571 | 606 |
| 572 CookieTreeHostNode* CookieTreeRootNode::GetOrCreateHostNode( | 607 CookieTreeHostNode* CookieTreeRootNode::GetOrCreateHostNode( |
| 573 const GURL& url) { | 608 const GURL& url) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 cookies_child_(NULL), | 648 cookies_child_(NULL), |
| 614 databases_child_(NULL), | 649 databases_child_(NULL), |
| 615 local_storages_child_(NULL), | 650 local_storages_child_(NULL), |
| 616 session_storages_child_(NULL), | 651 session_storages_child_(NULL), |
| 617 appcaches_child_(NULL), | 652 appcaches_child_(NULL), |
| 618 indexed_dbs_child_(NULL), | 653 indexed_dbs_child_(NULL), |
| 619 file_systems_child_(NULL), | 654 file_systems_child_(NULL), |
| 620 quota_child_(NULL), | 655 quota_child_(NULL), |
| 621 channel_ids_child_(NULL), | 656 channel_ids_child_(NULL), |
| 622 service_workers_child_(NULL), | 657 service_workers_child_(NULL), |
| 658 cache_storages_child_(NULL), |
| 623 flash_lso_child_(NULL), | 659 flash_lso_child_(NULL), |
| 624 url_(url), | 660 url_(url), |
| 625 canonicalized_host_(CanonicalizeHost(url)) { | 661 canonicalized_host_(CanonicalizeHost(url)) {} |
| 626 } | |
| 627 | 662 |
| 628 CookieTreeHostNode::~CookieTreeHostNode() {} | 663 CookieTreeHostNode::~CookieTreeHostNode() {} |
| 629 | 664 |
| 630 const std::string CookieTreeHostNode::GetHost() const { | 665 const std::string CookieTreeHostNode::GetHost() const { |
| 631 const std::string file_origin_node_name( | 666 const std::string file_origin_node_name( |
| 632 std::string(url::kFileScheme) + url::kStandardSchemeSeparator); | 667 std::string(url::kFileScheme) + url::kStandardSchemeSeparator); |
| 633 return url_.SchemeIsFile() ? file_origin_node_name : url_.host(); | 668 return url_.SchemeIsFile() ? file_origin_node_name : url_.host(); |
| 634 } | 669 } |
| 635 | 670 |
| 636 CookieTreeNode::DetailedInfo CookieTreeHostNode::GetDetailedInfo() const { | 671 CookieTreeNode::DetailedInfo CookieTreeHostNode::GetDetailedInfo() const { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 | 750 |
| 716 CookieTreeServiceWorkersNode* | 751 CookieTreeServiceWorkersNode* |
| 717 CookieTreeHostNode::GetOrCreateServiceWorkersNode() { | 752 CookieTreeHostNode::GetOrCreateServiceWorkersNode() { |
| 718 if (service_workers_child_) | 753 if (service_workers_child_) |
| 719 return service_workers_child_; | 754 return service_workers_child_; |
| 720 service_workers_child_ = new CookieTreeServiceWorkersNode; | 755 service_workers_child_ = new CookieTreeServiceWorkersNode; |
| 721 AddChildSortedByTitle(service_workers_child_); | 756 AddChildSortedByTitle(service_workers_child_); |
| 722 return service_workers_child_; | 757 return service_workers_child_; |
| 723 } | 758 } |
| 724 | 759 |
| 760 CookieTreeCacheStoragesNode* |
| 761 CookieTreeHostNode::GetOrCreateCacheStoragesNode() { |
| 762 if (cache_storages_child_) |
| 763 return cache_storages_child_; |
| 764 cache_storages_child_ = new CookieTreeCacheStoragesNode; |
| 765 AddChildSortedByTitle(cache_storages_child_); |
| 766 return cache_storages_child_; |
| 767 } |
| 768 |
| 725 CookieTreeFlashLSONode* CookieTreeHostNode::GetOrCreateFlashLSONode( | 769 CookieTreeFlashLSONode* CookieTreeHostNode::GetOrCreateFlashLSONode( |
| 726 const std::string& domain) { | 770 const std::string& domain) { |
| 727 DCHECK_EQ(GetHost(), domain); | 771 DCHECK_EQ(GetHost(), domain); |
| 728 if (flash_lso_child_) | 772 if (flash_lso_child_) |
| 729 return flash_lso_child_; | 773 return flash_lso_child_; |
| 730 flash_lso_child_ = new CookieTreeFlashLSONode(domain); | 774 flash_lso_child_ = new CookieTreeFlashLSONode(domain); |
| 731 AddChildSortedByTitle(flash_lso_child_); | 775 AddChildSortedByTitle(flash_lso_child_); |
| 732 return flash_lso_child_; | 776 return flash_lso_child_; |
| 733 } | 777 } |
| 734 | 778 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 | 925 |
| 882 CookieTreeServiceWorkersNode::~CookieTreeServiceWorkersNode() { | 926 CookieTreeServiceWorkersNode::~CookieTreeServiceWorkersNode() { |
| 883 } | 927 } |
| 884 | 928 |
| 885 CookieTreeNode::DetailedInfo CookieTreeServiceWorkersNode::GetDetailedInfo() | 929 CookieTreeNode::DetailedInfo CookieTreeServiceWorkersNode::GetDetailedInfo() |
| 886 const { | 930 const { |
| 887 return DetailedInfo().Init(DetailedInfo::TYPE_SERVICE_WORKERS); | 931 return DetailedInfo().Init(DetailedInfo::TYPE_SERVICE_WORKERS); |
| 888 } | 932 } |
| 889 | 933 |
| 890 /////////////////////////////////////////////////////////////////////////////// | 934 /////////////////////////////////////////////////////////////////////////////// |
| 935 // CookieTreeCacheStoragesNode, public: |
| 936 |
| 937 CookieTreeCacheStoragesNode::CookieTreeCacheStoragesNode() |
| 938 : CookieTreeNode(l10n_util::GetStringUTF16(IDS_COOKIES_CACHE_STORAGE)) {} |
| 939 |
| 940 CookieTreeCacheStoragesNode::~CookieTreeCacheStoragesNode() {} |
| 941 |
| 942 CookieTreeNode::DetailedInfo CookieTreeCacheStoragesNode::GetDetailedInfo() |
| 943 const { |
| 944 return DetailedInfo().Init(DetailedInfo::TYPE_CACHE_STORAGES); |
| 945 } |
| 946 |
| 947 /////////////////////////////////////////////////////////////////////////////// |
| 891 // CookieTreeFlashLSONode | 948 // CookieTreeFlashLSONode |
| 892 CookieTreeFlashLSONode::CookieTreeFlashLSONode( | 949 CookieTreeFlashLSONode::CookieTreeFlashLSONode( |
| 893 const std::string& domain) | 950 const std::string& domain) |
| 894 : domain_(domain) {} | 951 : domain_(domain) {} |
| 895 CookieTreeFlashLSONode::~CookieTreeFlashLSONode() {} | 952 CookieTreeFlashLSONode::~CookieTreeFlashLSONode() {} |
| 896 | 953 |
| 897 void CookieTreeFlashLSONode::DeleteStoredObjects() { | 954 void CookieTreeFlashLSONode::DeleteStoredObjects() { |
| 898 // We are one level below the host node. | 955 // We are one level below the host node. |
| 899 CookieTreeHostNode* host = static_cast<CookieTreeHostNode*>(parent()); | 956 CookieTreeHostNode* host = static_cast<CookieTreeHostNode*>(parent()); |
| 900 CHECK_EQ(host->GetDetailedInfo().node_type, | 957 CHECK_EQ(host->GetDetailedInfo().node_type, |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1003 case CookieTreeNode::DetailedInfo::TYPE_INDEXED_DB: | 1060 case CookieTreeNode::DetailedInfo::TYPE_INDEXED_DB: |
| 1004 return DATABASE; // ditto | 1061 return DATABASE; // ditto |
| 1005 case CookieTreeNode::DetailedInfo::TYPE_FILE_SYSTEM: | 1062 case CookieTreeNode::DetailedInfo::TYPE_FILE_SYSTEM: |
| 1006 return DATABASE; // ditto | 1063 return DATABASE; // ditto |
| 1007 case CookieTreeNode::DetailedInfo::TYPE_QUOTA: | 1064 case CookieTreeNode::DetailedInfo::TYPE_QUOTA: |
| 1008 return -1; | 1065 return -1; |
| 1009 case CookieTreeNode::DetailedInfo::TYPE_CHANNEL_ID: | 1066 case CookieTreeNode::DetailedInfo::TYPE_CHANNEL_ID: |
| 1010 return COOKIE; // It's kinda like a cookie? | 1067 return COOKIE; // It's kinda like a cookie? |
| 1011 case CookieTreeNode::DetailedInfo::TYPE_SERVICE_WORKER: | 1068 case CookieTreeNode::DetailedInfo::TYPE_SERVICE_WORKER: |
| 1012 return DATABASE; // Just like appcache | 1069 return DATABASE; // Just like appcache |
| 1070 case CookieTreeNode::DetailedInfo::TYPE_CACHE_STORAGE: |
| 1071 return DATABASE; // ditto |
| 1013 default: | 1072 default: |
| 1014 break; | 1073 break; |
| 1015 } | 1074 } |
| 1016 return -1; | 1075 return -1; |
| 1017 } | 1076 } |
| 1018 | 1077 |
| 1019 void CookiesTreeModel::DeleteAllStoredObjects() { | 1078 void CookiesTreeModel::DeleteAllStoredObjects() { |
| 1020 NotifyObserverBeginBatch(); | 1079 NotifyObserverBeginBatch(); |
| 1021 CookieTreeNode* root = GetRoot(); | 1080 CookieTreeNode* root = GetRoot(); |
| 1022 root->DeleteStoredObjects(); | 1081 root->DeleteStoredObjects(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1049 PopulateCookieInfoWithFilter(data_container(), ¬ifier, filter); | 1108 PopulateCookieInfoWithFilter(data_container(), ¬ifier, filter); |
| 1050 PopulateDatabaseInfoWithFilter(data_container(), ¬ifier, filter); | 1109 PopulateDatabaseInfoWithFilter(data_container(), ¬ifier, filter); |
| 1051 PopulateLocalStorageInfoWithFilter(data_container(), ¬ifier, filter); | 1110 PopulateLocalStorageInfoWithFilter(data_container(), ¬ifier, filter); |
| 1052 PopulateSessionStorageInfoWithFilter(data_container(), ¬ifier, filter); | 1111 PopulateSessionStorageInfoWithFilter(data_container(), ¬ifier, filter); |
| 1053 PopulateAppCacheInfoWithFilter(data_container(), ¬ifier, filter); | 1112 PopulateAppCacheInfoWithFilter(data_container(), ¬ifier, filter); |
| 1054 PopulateIndexedDBInfoWithFilter(data_container(), ¬ifier, filter); | 1113 PopulateIndexedDBInfoWithFilter(data_container(), ¬ifier, filter); |
| 1055 PopulateFileSystemInfoWithFilter(data_container(), ¬ifier, filter); | 1114 PopulateFileSystemInfoWithFilter(data_container(), ¬ifier, filter); |
| 1056 PopulateQuotaInfoWithFilter(data_container(), ¬ifier, filter); | 1115 PopulateQuotaInfoWithFilter(data_container(), ¬ifier, filter); |
| 1057 PopulateChannelIDInfoWithFilter(data_container(), ¬ifier, filter); | 1116 PopulateChannelIDInfoWithFilter(data_container(), ¬ifier, filter); |
| 1058 PopulateServiceWorkerUsageInfoWithFilter(data_container(), ¬ifier, filter); | 1117 PopulateServiceWorkerUsageInfoWithFilter(data_container(), ¬ifier, filter); |
| 1118 PopulateCacheStorageUsageInfoWithFilter(data_container(), ¬ifier, filter); |
| 1059 } | 1119 } |
| 1060 | 1120 |
| 1061 #if defined(ENABLE_EXTENSIONS) | 1121 #if defined(ENABLE_EXTENSIONS) |
| 1062 const extensions::ExtensionSet* CookiesTreeModel::ExtensionsProtectingNode( | 1122 const extensions::ExtensionSet* CookiesTreeModel::ExtensionsProtectingNode( |
| 1063 const CookieTreeNode& cookie_node) { | 1123 const CookieTreeNode& cookie_node) { |
| 1064 if (!special_storage_policy_.get()) | 1124 if (!special_storage_policy_.get()) |
| 1065 return NULL; | 1125 return NULL; |
| 1066 | 1126 |
| 1067 CookieTreeNode::DetailedInfo info = cookie_node.GetDetailedInfo(); | 1127 CookieTreeNode::DetailedInfo info = cookie_node.GetDetailedInfo(); |
| 1068 | 1128 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1133 PopulateChannelIDInfoWithFilter(container, ¬ifier, base::string16()); | 1193 PopulateChannelIDInfoWithFilter(container, ¬ifier, base::string16()); |
| 1134 } | 1194 } |
| 1135 | 1195 |
| 1136 void CookiesTreeModel::PopulateServiceWorkerUsageInfo( | 1196 void CookiesTreeModel::PopulateServiceWorkerUsageInfo( |
| 1137 LocalDataContainer* container) { | 1197 LocalDataContainer* container) { |
| 1138 ScopedBatchUpdateNotifier notifier(this, GetRoot()); | 1198 ScopedBatchUpdateNotifier notifier(this, GetRoot()); |
| 1139 PopulateServiceWorkerUsageInfoWithFilter( | 1199 PopulateServiceWorkerUsageInfoWithFilter( |
| 1140 container, ¬ifier, base::string16()); | 1200 container, ¬ifier, base::string16()); |
| 1141 } | 1201 } |
| 1142 | 1202 |
| 1203 void CookiesTreeModel::PopulateCacheStorageUsageInfo( |
| 1204 LocalDataContainer* container) { |
| 1205 ScopedBatchUpdateNotifier notifier(this, GetRoot()); |
| 1206 PopulateCacheStorageUsageInfoWithFilter(container, ¬ifier, |
| 1207 base::string16()); |
| 1208 } |
| 1209 |
| 1143 void CookiesTreeModel::PopulateFlashLSOInfo( | 1210 void CookiesTreeModel::PopulateFlashLSOInfo( |
| 1144 LocalDataContainer* container) { | 1211 LocalDataContainer* container) { |
| 1145 ScopedBatchUpdateNotifier notifier(this, GetRoot()); | 1212 ScopedBatchUpdateNotifier notifier(this, GetRoot()); |
| 1146 PopulateFlashLSOInfoWithFilter(container, ¬ifier, base::string16()); | 1213 PopulateFlashLSOInfoWithFilter(container, ¬ifier, base::string16()); |
| 1147 } | 1214 } |
| 1148 | 1215 |
| 1149 void CookiesTreeModel::PopulateAppCacheInfoWithFilter( | 1216 void CookiesTreeModel::PopulateAppCacheInfoWithFilter( |
| 1150 LocalDataContainer* container, | 1217 LocalDataContainer* container, |
| 1151 ScopedBatchUpdateNotifier* notifier, | 1218 ScopedBatchUpdateNotifier* notifier, |
| 1152 const base::string16& filter) { | 1219 const base::string16& filter) { |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1369 .find(filter) != base::string16::npos)) { | 1436 .find(filter) != base::string16::npos)) { |
| 1370 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin); | 1437 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin); |
| 1371 CookieTreeServiceWorkersNode* service_workers_node = | 1438 CookieTreeServiceWorkersNode* service_workers_node = |
| 1372 host_node->GetOrCreateServiceWorkersNode(); | 1439 host_node->GetOrCreateServiceWorkersNode(); |
| 1373 service_workers_node->AddServiceWorkerNode( | 1440 service_workers_node->AddServiceWorkerNode( |
| 1374 new CookieTreeServiceWorkerNode(service_worker_info)); | 1441 new CookieTreeServiceWorkerNode(service_worker_info)); |
| 1375 } | 1442 } |
| 1376 } | 1443 } |
| 1377 } | 1444 } |
| 1378 | 1445 |
| 1446 void CookiesTreeModel::PopulateCacheStorageUsageInfoWithFilter( |
| 1447 LocalDataContainer* container, |
| 1448 ScopedBatchUpdateNotifier* notifier, |
| 1449 const base::string16& filter) { |
| 1450 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); |
| 1451 |
| 1452 if (container->cache_storage_info_list_.empty()) |
| 1453 return; |
| 1454 |
| 1455 notifier->StartBatchUpdate(); |
| 1456 for (CacheStorageUsageInfoList::iterator cache_storage_info = |
| 1457 container->cache_storage_info_list_.begin(); |
| 1458 cache_storage_info != container->cache_storage_info_list_.end(); |
| 1459 ++cache_storage_info) { |
| 1460 const GURL& origin = cache_storage_info->origin; |
| 1461 |
| 1462 if (filter.empty() || (CookieTreeHostNode::TitleForUrl(origin) |
| 1463 .find(filter) != base::string16::npos)) { |
| 1464 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin); |
| 1465 CookieTreeCacheStoragesNode* cache_storages_node = |
| 1466 host_node->GetOrCreateCacheStoragesNode(); |
| 1467 cache_storages_node->AddCacheStorageNode( |
| 1468 new CookieTreeCacheStorageNode(cache_storage_info)); |
| 1469 } |
| 1470 } |
| 1471 } |
| 1472 |
| 1379 void CookiesTreeModel::PopulateFileSystemInfoWithFilter( | 1473 void CookiesTreeModel::PopulateFileSystemInfoWithFilter( |
| 1380 LocalDataContainer* container, | 1474 LocalDataContainer* container, |
| 1381 ScopedBatchUpdateNotifier* notifier, | 1475 ScopedBatchUpdateNotifier* notifier, |
| 1382 const base::string16& filter) { | 1476 const base::string16& filter) { |
| 1383 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); | 1477 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); |
| 1384 | 1478 |
| 1385 if (container->file_system_info_list_.empty()) | 1479 if (container->file_system_info_list_.empty()) |
| 1386 return; | 1480 return; |
| 1387 | 1481 |
| 1388 notifier->StartBatchUpdate(); | 1482 notifier->StartBatchUpdate(); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1480 void CookiesTreeModel::MaybeNotifyBatchesEnded() { | 1574 void CookiesTreeModel::MaybeNotifyBatchesEnded() { |
| 1481 // Only notify the observers if this is the outermost call to EndBatch() if | 1575 // Only notify the observers if this is the outermost call to EndBatch() if |
| 1482 // called in a nested manner. | 1576 // called in a nested manner. |
| 1483 if (batches_ended_ == batches_started_ && | 1577 if (batches_ended_ == batches_started_ && |
| 1484 batches_seen_ == batches_expected_) { | 1578 batches_seen_ == batches_expected_) { |
| 1485 FOR_EACH_OBSERVER(Observer, | 1579 FOR_EACH_OBSERVER(Observer, |
| 1486 cookies_observer_list_, | 1580 cookies_observer_list_, |
| 1487 TreeModelEndBatch(this)); | 1581 TreeModelEndBatch(this)); |
| 1488 } | 1582 } |
| 1489 } | 1583 } |
| OLD | NEW |