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 <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 void CookiesTreeModel::DeleteCookieNode(CookieTreeNode* cookie_node) { | 931 void CookiesTreeModel::DeleteCookieNode(CookieTreeNode* cookie_node) { |
932 if (cookie_node == GetRoot()) | 932 if (cookie_node == GetRoot()) |
933 return; | 933 return; |
934 cookie_node->DeleteStoredObjects(); | 934 cookie_node->DeleteStoredObjects(); |
935 CookieTreeNode* parent_node = cookie_node->parent(); | 935 CookieTreeNode* parent_node = cookie_node->parent(); |
936 delete Remove(parent_node, cookie_node); | 936 delete Remove(parent_node, cookie_node); |
937 if (parent_node->empty()) | 937 if (parent_node->empty()) |
938 DeleteCookieNode(parent_node); | 938 DeleteCookieNode(parent_node); |
939 } | 939 } |
940 | 940 |
941 void CookiesTreeModel::UpdateSearchResults(const string16& filter) { | 941 void CookiesTreeModel::UpdateSearchResults(const base::string16& filter) { |
942 CookieTreeNode* root = GetRoot(); | 942 CookieTreeNode* root = GetRoot(); |
943 ScopedBatchUpdateNotifier notifier(this, root); | 943 ScopedBatchUpdateNotifier notifier(this, root); |
944 int num_children = root->child_count(); | 944 int num_children = root->child_count(); |
945 notifier.StartBatchUpdate(); | 945 notifier.StartBatchUpdate(); |
946 for (int i = num_children - 1; i >= 0; --i) | 946 for (int i = num_children - 1; i >= 0; --i) |
947 delete Remove(root, root->GetChild(i)); | 947 delete Remove(root, root->GetChild(i)); |
948 | 948 |
949 PopulateCookieInfoWithFilter(data_container(), ¬ifier, filter); | 949 PopulateCookieInfoWithFilter(data_container(), ¬ifier, filter); |
950 PopulateDatabaseInfoWithFilter(data_container(), ¬ifier, filter); | 950 PopulateDatabaseInfoWithFilter(data_container(), ¬ifier, filter); |
951 PopulateLocalStorageInfoWithFilter(data_container(), ¬ifier, filter); | 951 PopulateLocalStorageInfoWithFilter(data_container(), ¬ifier, filter); |
(...skipping 26 matching lines...) Expand all Loading... |
978 } | 978 } |
979 | 979 |
980 void CookiesTreeModel::RemoveCookiesTreeObserver(Observer* observer) { | 980 void CookiesTreeModel::RemoveCookiesTreeObserver(Observer* observer) { |
981 cookies_observer_list_.RemoveObserver(observer); | 981 cookies_observer_list_.RemoveObserver(observer); |
982 // Call super so that TreeNodeModel doesn't have dead pointers. | 982 // Call super so that TreeNodeModel doesn't have dead pointers. |
983 ui::TreeNodeModel<CookieTreeNode>::RemoveObserver(observer); | 983 ui::TreeNodeModel<CookieTreeNode>::RemoveObserver(observer); |
984 } | 984 } |
985 | 985 |
986 void CookiesTreeModel::PopulateAppCacheInfo(LocalDataContainer* container) { | 986 void CookiesTreeModel::PopulateAppCacheInfo(LocalDataContainer* container) { |
987 ScopedBatchUpdateNotifier notifier(this, GetRoot()); | 987 ScopedBatchUpdateNotifier notifier(this, GetRoot()); |
988 PopulateAppCacheInfoWithFilter(container, ¬ifier, string16()); | 988 PopulateAppCacheInfoWithFilter(container, ¬ifier, base::string16()); |
989 } | 989 } |
990 | 990 |
991 void CookiesTreeModel::PopulateCookieInfo(LocalDataContainer* container) { | 991 void CookiesTreeModel::PopulateCookieInfo(LocalDataContainer* container) { |
992 ScopedBatchUpdateNotifier notifier(this, GetRoot()); | 992 ScopedBatchUpdateNotifier notifier(this, GetRoot()); |
993 PopulateCookieInfoWithFilter(container, ¬ifier, string16()); | 993 PopulateCookieInfoWithFilter(container, ¬ifier, base::string16()); |
994 } | 994 } |
995 | 995 |
996 void CookiesTreeModel::PopulateDatabaseInfo(LocalDataContainer* container) { | 996 void CookiesTreeModel::PopulateDatabaseInfo(LocalDataContainer* container) { |
997 ScopedBatchUpdateNotifier notifier(this, GetRoot()); | 997 ScopedBatchUpdateNotifier notifier(this, GetRoot()); |
998 PopulateDatabaseInfoWithFilter(container, ¬ifier, string16()); | 998 PopulateDatabaseInfoWithFilter(container, ¬ifier, base::string16()); |
999 } | 999 } |
1000 | 1000 |
1001 void CookiesTreeModel::PopulateLocalStorageInfo(LocalDataContainer* container) { | 1001 void CookiesTreeModel::PopulateLocalStorageInfo(LocalDataContainer* container) { |
1002 ScopedBatchUpdateNotifier notifier(this, GetRoot()); | 1002 ScopedBatchUpdateNotifier notifier(this, GetRoot()); |
1003 PopulateLocalStorageInfoWithFilter(container, ¬ifier, string16()); | 1003 PopulateLocalStorageInfoWithFilter(container, ¬ifier, base::string16()); |
1004 } | 1004 } |
1005 | 1005 |
1006 void CookiesTreeModel::PopulateSessionStorageInfo( | 1006 void CookiesTreeModel::PopulateSessionStorageInfo( |
1007 LocalDataContainer* container) { | 1007 LocalDataContainer* container) { |
1008 ScopedBatchUpdateNotifier notifier(this, GetRoot()); | 1008 ScopedBatchUpdateNotifier notifier(this, GetRoot()); |
1009 PopulateSessionStorageInfoWithFilter(container, ¬ifier, string16()); | 1009 PopulateSessionStorageInfoWithFilter(container, ¬ifier, base::string16()); |
1010 } | 1010 } |
1011 | 1011 |
1012 void CookiesTreeModel::PopulateIndexedDBInfo(LocalDataContainer* container){ | 1012 void CookiesTreeModel::PopulateIndexedDBInfo(LocalDataContainer* container){ |
1013 ScopedBatchUpdateNotifier notifier(this, GetRoot()); | 1013 ScopedBatchUpdateNotifier notifier(this, GetRoot()); |
1014 PopulateIndexedDBInfoWithFilter(container, ¬ifier, string16()); | 1014 PopulateIndexedDBInfoWithFilter(container, ¬ifier, base::string16()); |
1015 } | 1015 } |
1016 | 1016 |
1017 void CookiesTreeModel::PopulateFileSystemInfo(LocalDataContainer* container) { | 1017 void CookiesTreeModel::PopulateFileSystemInfo(LocalDataContainer* container) { |
1018 ScopedBatchUpdateNotifier notifier(this, GetRoot()); | 1018 ScopedBatchUpdateNotifier notifier(this, GetRoot()); |
1019 PopulateFileSystemInfoWithFilter(container, ¬ifier, string16()); | 1019 PopulateFileSystemInfoWithFilter(container, ¬ifier, base::string16()); |
1020 } | 1020 } |
1021 | 1021 |
1022 void CookiesTreeModel::PopulateQuotaInfo(LocalDataContainer* container) { | 1022 void CookiesTreeModel::PopulateQuotaInfo(LocalDataContainer* container) { |
1023 ScopedBatchUpdateNotifier notifier(this, GetRoot()); | 1023 ScopedBatchUpdateNotifier notifier(this, GetRoot()); |
1024 PopulateQuotaInfoWithFilter(container, ¬ifier, string16()); | 1024 PopulateQuotaInfoWithFilter(container, ¬ifier, base::string16()); |
1025 } | 1025 } |
1026 | 1026 |
1027 void CookiesTreeModel::PopulateServerBoundCertInfo( | 1027 void CookiesTreeModel::PopulateServerBoundCertInfo( |
1028 LocalDataContainer* container) { | 1028 LocalDataContainer* container) { |
1029 ScopedBatchUpdateNotifier notifier(this, GetRoot()); | 1029 ScopedBatchUpdateNotifier notifier(this, GetRoot()); |
1030 PopulateServerBoundCertInfoWithFilter(container, ¬ifier, string16()); | 1030 PopulateServerBoundCertInfoWithFilter(container, ¬ifier, base::string16()); |
1031 } | 1031 } |
1032 | 1032 |
1033 void CookiesTreeModel::PopulateFlashLSOInfo( | 1033 void CookiesTreeModel::PopulateFlashLSOInfo( |
1034 LocalDataContainer* container) { | 1034 LocalDataContainer* container) { |
1035 ScopedBatchUpdateNotifier notifier(this, GetRoot()); | 1035 ScopedBatchUpdateNotifier notifier(this, GetRoot()); |
1036 PopulateFlashLSOInfoWithFilter(container, ¬ifier, string16()); | 1036 PopulateFlashLSOInfoWithFilter(container, ¬ifier, base::string16()); |
1037 } | 1037 } |
1038 | 1038 |
1039 void CookiesTreeModel::PopulateAppCacheInfoWithFilter( | 1039 void CookiesTreeModel::PopulateAppCacheInfoWithFilter( |
1040 LocalDataContainer* container, | 1040 LocalDataContainer* container, |
1041 ScopedBatchUpdateNotifier* notifier, | 1041 ScopedBatchUpdateNotifier* notifier, |
1042 const string16& filter) { | 1042 const base::string16& filter) { |
1043 using appcache::AppCacheInfo; | 1043 using appcache::AppCacheInfo; |
1044 typedef std::map<GURL, std::list<AppCacheInfo> > InfoByOrigin; | 1044 typedef std::map<GURL, std::list<AppCacheInfo> > InfoByOrigin; |
1045 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); | 1045 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); |
1046 | 1046 |
1047 if (container->appcache_info_.empty()) | 1047 if (container->appcache_info_.empty()) |
1048 return; | 1048 return; |
1049 | 1049 |
1050 notifier->StartBatchUpdate(); | 1050 notifier->StartBatchUpdate(); |
1051 for (InfoByOrigin::iterator origin = container->appcache_info_.begin(); | 1051 for (InfoByOrigin::iterator origin = container->appcache_info_.begin(); |
1052 origin != container->appcache_info_.end(); ++origin) { | 1052 origin != container->appcache_info_.end(); ++origin) { |
1053 string16 host_node_name = UTF8ToUTF16(origin->first.host()); | 1053 base::string16 host_node_name = UTF8ToUTF16(origin->first.host()); |
1054 if (filter.empty() || | 1054 if (filter.empty() || |
1055 (host_node_name.find(filter) != string16::npos)) { | 1055 (host_node_name.find(filter) != base::string16::npos)) { |
1056 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin->first); | 1056 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin->first); |
1057 CookieTreeAppCachesNode* appcaches_node = | 1057 CookieTreeAppCachesNode* appcaches_node = |
1058 host_node->GetOrCreateAppCachesNode(); | 1058 host_node->GetOrCreateAppCachesNode(); |
1059 | 1059 |
1060 for (std::list<AppCacheInfo>::iterator info = origin->second.begin(); | 1060 for (std::list<AppCacheInfo>::iterator info = origin->second.begin(); |
1061 info != origin->second.end(); ++info) { | 1061 info != origin->second.end(); ++info) { |
1062 appcaches_node->AddAppCacheNode( | 1062 appcaches_node->AddAppCacheNode( |
1063 new CookieTreeAppCacheNode(origin->first, info)); | 1063 new CookieTreeAppCacheNode(origin->first, info)); |
1064 } | 1064 } |
1065 } | 1065 } |
1066 } | 1066 } |
1067 } | 1067 } |
1068 | 1068 |
1069 void CookiesTreeModel::PopulateCookieInfoWithFilter( | 1069 void CookiesTreeModel::PopulateCookieInfoWithFilter( |
1070 LocalDataContainer* container, | 1070 LocalDataContainer* container, |
1071 ScopedBatchUpdateNotifier* notifier, | 1071 ScopedBatchUpdateNotifier* notifier, |
1072 const string16& filter) { | 1072 const base::string16& filter) { |
1073 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); | 1073 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); |
1074 | 1074 |
1075 notifier->StartBatchUpdate(); | 1075 notifier->StartBatchUpdate(); |
1076 for (CookieList::iterator it = container->cookie_list_.begin(); | 1076 for (CookieList::iterator it = container->cookie_list_.begin(); |
1077 it != container->cookie_list_.end(); ++it) { | 1077 it != container->cookie_list_.end(); ++it) { |
1078 std::string source_string = it->Source(); | 1078 std::string source_string = it->Source(); |
1079 if (source_string.empty() || !group_by_cookie_source_) { | 1079 if (source_string.empty() || !group_by_cookie_source_) { |
1080 std::string domain = it->Domain(); | 1080 std::string domain = it->Domain(); |
1081 if (domain.length() > 1 && domain[0] == '.') | 1081 if (domain.length() > 1 && domain[0] == '.') |
1082 domain = domain.substr(1); | 1082 domain = domain.substr(1); |
1083 | 1083 |
1084 // We treat secure cookies just the same as normal ones. | 1084 // We treat secure cookies just the same as normal ones. |
1085 source_string = std::string(content::kHttpScheme) + | 1085 source_string = std::string(content::kHttpScheme) + |
1086 content::kStandardSchemeSeparator + domain + "/"; | 1086 content::kStandardSchemeSeparator + domain + "/"; |
1087 } | 1087 } |
1088 | 1088 |
1089 GURL source(source_string); | 1089 GURL source(source_string); |
1090 if (!filter.size() || | 1090 if (!filter.size() || |
1091 (CookieTreeHostNode::TitleForUrl(source).find(filter) != | 1091 (CookieTreeHostNode::TitleForUrl(source).find(filter) != |
1092 string16::npos)) { | 1092 base::string16::npos)) { |
1093 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(source); | 1093 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(source); |
1094 CookieTreeCookiesNode* cookies_node = | 1094 CookieTreeCookiesNode* cookies_node = |
1095 host_node->GetOrCreateCookiesNode(); | 1095 host_node->GetOrCreateCookiesNode(); |
1096 CookieTreeCookieNode* new_cookie = new CookieTreeCookieNode(it); | 1096 CookieTreeCookieNode* new_cookie = new CookieTreeCookieNode(it); |
1097 cookies_node->AddCookieNode(new_cookie); | 1097 cookies_node->AddCookieNode(new_cookie); |
1098 } | 1098 } |
1099 } | 1099 } |
1100 } | 1100 } |
1101 | 1101 |
1102 void CookiesTreeModel::PopulateDatabaseInfoWithFilter( | 1102 void CookiesTreeModel::PopulateDatabaseInfoWithFilter( |
1103 LocalDataContainer* container, | 1103 LocalDataContainer* container, |
1104 ScopedBatchUpdateNotifier* notifier, | 1104 ScopedBatchUpdateNotifier* notifier, |
1105 const string16& filter) { | 1105 const base::string16& filter) { |
1106 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); | 1106 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); |
1107 | 1107 |
1108 if (container->database_info_list_.empty()) | 1108 if (container->database_info_list_.empty()) |
1109 return; | 1109 return; |
1110 | 1110 |
1111 notifier->StartBatchUpdate(); | 1111 notifier->StartBatchUpdate(); |
1112 for (DatabaseInfoList::iterator database_info = | 1112 for (DatabaseInfoList::iterator database_info = |
1113 container->database_info_list_.begin(); | 1113 container->database_info_list_.begin(); |
1114 database_info != container->database_info_list_.end(); | 1114 database_info != container->database_info_list_.end(); |
1115 ++database_info) { | 1115 ++database_info) { |
1116 GURL origin(database_info->identifier.ToOrigin()); | 1116 GURL origin(database_info->identifier.ToOrigin()); |
1117 | 1117 |
1118 if (!filter.size() || | 1118 if (!filter.size() || |
1119 (CookieTreeHostNode::TitleForUrl(origin).find(filter) != | 1119 (CookieTreeHostNode::TitleForUrl(origin).find(filter) != |
1120 string16::npos)) { | 1120 base::string16::npos)) { |
1121 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin); | 1121 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin); |
1122 CookieTreeDatabasesNode* databases_node = | 1122 CookieTreeDatabasesNode* databases_node = |
1123 host_node->GetOrCreateDatabasesNode(); | 1123 host_node->GetOrCreateDatabasesNode(); |
1124 databases_node->AddDatabaseNode( | 1124 databases_node->AddDatabaseNode( |
1125 new CookieTreeDatabaseNode(database_info)); | 1125 new CookieTreeDatabaseNode(database_info)); |
1126 } | 1126 } |
1127 } | 1127 } |
1128 } | 1128 } |
1129 | 1129 |
1130 void CookiesTreeModel::PopulateLocalStorageInfoWithFilter( | 1130 void CookiesTreeModel::PopulateLocalStorageInfoWithFilter( |
1131 LocalDataContainer* container, | 1131 LocalDataContainer* container, |
1132 ScopedBatchUpdateNotifier* notifier, | 1132 ScopedBatchUpdateNotifier* notifier, |
1133 const string16& filter) { | 1133 const base::string16& filter) { |
1134 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); | 1134 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); |
1135 | 1135 |
1136 if (container->local_storage_info_list_.empty()) | 1136 if (container->local_storage_info_list_.empty()) |
1137 return; | 1137 return; |
1138 | 1138 |
1139 notifier->StartBatchUpdate(); | 1139 notifier->StartBatchUpdate(); |
1140 for (LocalStorageInfoList::iterator local_storage_info = | 1140 for (LocalStorageInfoList::iterator local_storage_info = |
1141 container->local_storage_info_list_.begin(); | 1141 container->local_storage_info_list_.begin(); |
1142 local_storage_info != container->local_storage_info_list_.end(); | 1142 local_storage_info != container->local_storage_info_list_.end(); |
1143 ++local_storage_info) { | 1143 ++local_storage_info) { |
1144 const GURL& origin(local_storage_info->origin_url); | 1144 const GURL& origin(local_storage_info->origin_url); |
1145 | 1145 |
1146 if (!filter.size() || | 1146 if (!filter.size() || |
1147 (CookieTreeHostNode::TitleForUrl(origin).find(filter) != | 1147 (CookieTreeHostNode::TitleForUrl(origin).find(filter) != |
1148 std::string::npos)) { | 1148 std::string::npos)) { |
1149 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin); | 1149 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin); |
1150 CookieTreeLocalStoragesNode* local_storages_node = | 1150 CookieTreeLocalStoragesNode* local_storages_node = |
1151 host_node->GetOrCreateLocalStoragesNode(); | 1151 host_node->GetOrCreateLocalStoragesNode(); |
1152 local_storages_node->AddLocalStorageNode( | 1152 local_storages_node->AddLocalStorageNode( |
1153 new CookieTreeLocalStorageNode(local_storage_info)); | 1153 new CookieTreeLocalStorageNode(local_storage_info)); |
1154 } | 1154 } |
1155 } | 1155 } |
1156 } | 1156 } |
1157 | 1157 |
1158 void CookiesTreeModel::PopulateSessionStorageInfoWithFilter( | 1158 void CookiesTreeModel::PopulateSessionStorageInfoWithFilter( |
1159 LocalDataContainer* container, | 1159 LocalDataContainer* container, |
1160 ScopedBatchUpdateNotifier* notifier, | 1160 ScopedBatchUpdateNotifier* notifier, |
1161 const string16& filter) { | 1161 const base::string16& filter) { |
1162 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); | 1162 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); |
1163 | 1163 |
1164 if (container->session_storage_info_list_.empty()) | 1164 if (container->session_storage_info_list_.empty()) |
1165 return; | 1165 return; |
1166 | 1166 |
1167 notifier->StartBatchUpdate(); | 1167 notifier->StartBatchUpdate(); |
1168 for (LocalStorageInfoList::iterator session_storage_info = | 1168 for (LocalStorageInfoList::iterator session_storage_info = |
1169 container->session_storage_info_list_.begin(); | 1169 container->session_storage_info_list_.begin(); |
1170 session_storage_info != container->session_storage_info_list_.end(); | 1170 session_storage_info != container->session_storage_info_list_.end(); |
1171 ++session_storage_info) { | 1171 ++session_storage_info) { |
1172 const GURL& origin = session_storage_info->origin_url; | 1172 const GURL& origin = session_storage_info->origin_url; |
1173 | 1173 |
1174 if (!filter.size() || | 1174 if (!filter.size() || |
1175 (CookieTreeHostNode::TitleForUrl(origin).find(filter) != | 1175 (CookieTreeHostNode::TitleForUrl(origin).find(filter) != |
1176 string16::npos)) { | 1176 base::string16::npos)) { |
1177 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin); | 1177 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin); |
1178 CookieTreeSessionStoragesNode* session_storages_node = | 1178 CookieTreeSessionStoragesNode* session_storages_node = |
1179 host_node->GetOrCreateSessionStoragesNode(); | 1179 host_node->GetOrCreateSessionStoragesNode(); |
1180 session_storages_node->AddSessionStorageNode( | 1180 session_storages_node->AddSessionStorageNode( |
1181 new CookieTreeSessionStorageNode(session_storage_info)); | 1181 new CookieTreeSessionStorageNode(session_storage_info)); |
1182 } | 1182 } |
1183 } | 1183 } |
1184 } | 1184 } |
1185 | 1185 |
1186 void CookiesTreeModel::PopulateIndexedDBInfoWithFilter( | 1186 void CookiesTreeModel::PopulateIndexedDBInfoWithFilter( |
1187 LocalDataContainer* container, | 1187 LocalDataContainer* container, |
1188 ScopedBatchUpdateNotifier* notifier, | 1188 ScopedBatchUpdateNotifier* notifier, |
1189 const string16& filter) { | 1189 const base::string16& filter) { |
1190 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); | 1190 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); |
1191 | 1191 |
1192 if (container->indexed_db_info_list_.empty()) | 1192 if (container->indexed_db_info_list_.empty()) |
1193 return; | 1193 return; |
1194 | 1194 |
1195 notifier->StartBatchUpdate(); | 1195 notifier->StartBatchUpdate(); |
1196 for (IndexedDBInfoList::iterator indexed_db_info = | 1196 for (IndexedDBInfoList::iterator indexed_db_info = |
1197 container->indexed_db_info_list_.begin(); | 1197 container->indexed_db_info_list_.begin(); |
1198 indexed_db_info != container->indexed_db_info_list_.end(); | 1198 indexed_db_info != container->indexed_db_info_list_.end(); |
1199 ++indexed_db_info) { | 1199 ++indexed_db_info) { |
1200 const GURL& origin = indexed_db_info->origin_; | 1200 const GURL& origin = indexed_db_info->origin_; |
1201 | 1201 |
1202 if (!filter.size() || | 1202 if (!filter.size() || |
1203 (CookieTreeHostNode::TitleForUrl(origin).find(filter) != | 1203 (CookieTreeHostNode::TitleForUrl(origin).find(filter) != |
1204 string16::npos)) { | 1204 base::string16::npos)) { |
1205 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin); | 1205 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin); |
1206 CookieTreeIndexedDBsNode* indexed_dbs_node = | 1206 CookieTreeIndexedDBsNode* indexed_dbs_node = |
1207 host_node->GetOrCreateIndexedDBsNode(); | 1207 host_node->GetOrCreateIndexedDBsNode(); |
1208 indexed_dbs_node->AddIndexedDBNode( | 1208 indexed_dbs_node->AddIndexedDBNode( |
1209 new CookieTreeIndexedDBNode(indexed_db_info)); | 1209 new CookieTreeIndexedDBNode(indexed_db_info)); |
1210 } | 1210 } |
1211 } | 1211 } |
1212 } | 1212 } |
1213 | 1213 |
1214 void CookiesTreeModel::PopulateServerBoundCertInfoWithFilter( | 1214 void CookiesTreeModel::PopulateServerBoundCertInfoWithFilter( |
1215 LocalDataContainer* container, | 1215 LocalDataContainer* container, |
1216 ScopedBatchUpdateNotifier* notifier, | 1216 ScopedBatchUpdateNotifier* notifier, |
1217 const string16& filter) { | 1217 const base::string16& filter) { |
1218 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); | 1218 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); |
1219 | 1219 |
1220 if (container->server_bound_cert_list_.empty()) | 1220 if (container->server_bound_cert_list_.empty()) |
1221 return; | 1221 return; |
1222 | 1222 |
1223 notifier->StartBatchUpdate(); | 1223 notifier->StartBatchUpdate(); |
1224 for (ServerBoundCertList::iterator cert_info = | 1224 for (ServerBoundCertList::iterator cert_info = |
1225 container->server_bound_cert_list_.begin(); | 1225 container->server_bound_cert_list_.begin(); |
1226 cert_info != container->server_bound_cert_list_.end(); | 1226 cert_info != container->server_bound_cert_list_.end(); |
1227 ++cert_info) { | 1227 ++cert_info) { |
1228 GURL origin(cert_info->server_identifier()); | 1228 GURL origin(cert_info->server_identifier()); |
1229 if (!origin.is_valid()) { | 1229 if (!origin.is_valid()) { |
1230 // Domain Bound Cert. Make a valid URL to satisfy the | 1230 // Domain Bound Cert. Make a valid URL to satisfy the |
1231 // CookieTreeRootNode::GetOrCreateHostNode interface. | 1231 // CookieTreeRootNode::GetOrCreateHostNode interface. |
1232 origin = GURL(std::string(content::kHttpsScheme) + | 1232 origin = GURL(std::string(content::kHttpsScheme) + |
1233 content::kStandardSchemeSeparator + | 1233 content::kStandardSchemeSeparator + |
1234 cert_info->server_identifier() + "/"); | 1234 cert_info->server_identifier() + "/"); |
1235 } | 1235 } |
1236 string16 title = CookieTreeHostNode::TitleForUrl(origin); | 1236 base::string16 title = CookieTreeHostNode::TitleForUrl(origin); |
1237 if (!filter.size() || title.find(filter) != string16::npos) { | 1237 if (!filter.size() || title.find(filter) != base::string16::npos) { |
1238 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin); | 1238 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin); |
1239 CookieTreeServerBoundCertsNode* server_bound_certs_node = | 1239 CookieTreeServerBoundCertsNode* server_bound_certs_node = |
1240 host_node->GetOrCreateServerBoundCertsNode(); | 1240 host_node->GetOrCreateServerBoundCertsNode(); |
1241 server_bound_certs_node->AddServerBoundCertNode( | 1241 server_bound_certs_node->AddServerBoundCertNode( |
1242 new CookieTreeServerBoundCertNode(cert_info)); | 1242 new CookieTreeServerBoundCertNode(cert_info)); |
1243 } | 1243 } |
1244 } | 1244 } |
1245 } | 1245 } |
1246 | 1246 |
1247 void CookiesTreeModel::PopulateFileSystemInfoWithFilter( | 1247 void CookiesTreeModel::PopulateFileSystemInfoWithFilter( |
1248 LocalDataContainer* container, | 1248 LocalDataContainer* container, |
1249 ScopedBatchUpdateNotifier* notifier, | 1249 ScopedBatchUpdateNotifier* notifier, |
1250 const string16& filter) { | 1250 const base::string16& filter) { |
1251 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); | 1251 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); |
1252 | 1252 |
1253 if (container->file_system_info_list_.empty()) | 1253 if (container->file_system_info_list_.empty()) |
1254 return; | 1254 return; |
1255 | 1255 |
1256 notifier->StartBatchUpdate(); | 1256 notifier->StartBatchUpdate(); |
1257 for (FileSystemInfoList::iterator file_system_info = | 1257 for (FileSystemInfoList::iterator file_system_info = |
1258 container->file_system_info_list_.begin(); | 1258 container->file_system_info_list_.begin(); |
1259 file_system_info != container->file_system_info_list_.end(); | 1259 file_system_info != container->file_system_info_list_.end(); |
1260 ++file_system_info) { | 1260 ++file_system_info) { |
1261 GURL origin(file_system_info->origin); | 1261 GURL origin(file_system_info->origin); |
1262 | 1262 |
1263 if (!filter.size() || | 1263 if (!filter.size() || |
1264 (CookieTreeHostNode::TitleForUrl(origin).find(filter) != | 1264 (CookieTreeHostNode::TitleForUrl(origin).find(filter) != |
1265 string16::npos)) { | 1265 base::string16::npos)) { |
1266 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin); | 1266 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin); |
1267 CookieTreeFileSystemsNode* file_systems_node = | 1267 CookieTreeFileSystemsNode* file_systems_node = |
1268 host_node->GetOrCreateFileSystemsNode(); | 1268 host_node->GetOrCreateFileSystemsNode(); |
1269 file_systems_node->AddFileSystemNode( | 1269 file_systems_node->AddFileSystemNode( |
1270 new CookieTreeFileSystemNode(file_system_info)); | 1270 new CookieTreeFileSystemNode(file_system_info)); |
1271 } | 1271 } |
1272 } | 1272 } |
1273 } | 1273 } |
1274 | 1274 |
1275 void CookiesTreeModel::PopulateQuotaInfoWithFilter( | 1275 void CookiesTreeModel::PopulateQuotaInfoWithFilter( |
1276 LocalDataContainer* container, | 1276 LocalDataContainer* container, |
1277 ScopedBatchUpdateNotifier* notifier, | 1277 ScopedBatchUpdateNotifier* notifier, |
1278 const string16& filter) { | 1278 const base::string16& filter) { |
1279 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); | 1279 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); |
1280 | 1280 |
1281 if (container->quota_info_list_.empty()) | 1281 if (container->quota_info_list_.empty()) |
1282 return; | 1282 return; |
1283 | 1283 |
1284 notifier->StartBatchUpdate(); | 1284 notifier->StartBatchUpdate(); |
1285 for (QuotaInfoList::iterator quota_info = container->quota_info_list_.begin(); | 1285 for (QuotaInfoList::iterator quota_info = container->quota_info_list_.begin(); |
1286 quota_info != container->quota_info_list_.end(); | 1286 quota_info != container->quota_info_list_.end(); |
1287 ++quota_info) { | 1287 ++quota_info) { |
1288 if (!filter.size() || | 1288 if (!filter.size() || |
1289 (UTF8ToUTF16(quota_info->host).find(filter) != string16::npos)) { | 1289 (UTF8ToUTF16(quota_info->host).find(filter) != base::string16::npos)) { |
1290 CookieTreeHostNode* host_node = | 1290 CookieTreeHostNode* host_node = |
1291 root->GetOrCreateHostNode(GURL("http://" + quota_info->host)); | 1291 root->GetOrCreateHostNode(GURL("http://" + quota_info->host)); |
1292 host_node->UpdateOrCreateQuotaNode(quota_info); | 1292 host_node->UpdateOrCreateQuotaNode(quota_info); |
1293 } | 1293 } |
1294 } | 1294 } |
1295 } | 1295 } |
1296 | 1296 |
1297 void CookiesTreeModel::PopulateFlashLSOInfoWithFilter( | 1297 void CookiesTreeModel::PopulateFlashLSOInfoWithFilter( |
1298 LocalDataContainer* container, | 1298 LocalDataContainer* container, |
1299 ScopedBatchUpdateNotifier* notifier, | 1299 ScopedBatchUpdateNotifier* notifier, |
1300 const string16& filter) { | 1300 const base::string16& filter) { |
1301 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); | 1301 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); |
1302 | 1302 |
1303 if (container->flash_lso_domain_list_.empty()) | 1303 if (container->flash_lso_domain_list_.empty()) |
1304 return; | 1304 return; |
1305 | 1305 |
1306 std::string filter_utf8 = UTF16ToUTF8(filter); | 1306 std::string filter_utf8 = UTF16ToUTF8(filter); |
1307 notifier->StartBatchUpdate(); | 1307 notifier->StartBatchUpdate(); |
1308 for (std::vector<std::string>::iterator it = | 1308 for (std::vector<std::string>::iterator it = |
1309 container->flash_lso_domain_list_.begin(); | 1309 container->flash_lso_domain_list_.begin(); |
1310 it != container->flash_lso_domain_list_.end(); ++it) { | 1310 it != container->flash_lso_domain_list_.end(); ++it) { |
(...skipping 17 matching lines...) Expand all Loading... |
1328 | 1328 |
1329 void CookiesTreeModel::NotifyObserverEndBatch() { | 1329 void CookiesTreeModel::NotifyObserverEndBatch() { |
1330 // Only notify the observers if this is the outermost call to EndBatch() if | 1330 // Only notify the observers if this is the outermost call to EndBatch() if |
1331 // called in a nested manner. | 1331 // called in a nested manner. |
1332 if (--batch_update_ == 0) { | 1332 if (--batch_update_ == 0) { |
1333 FOR_EACH_OBSERVER(Observer, | 1333 FOR_EACH_OBSERVER(Observer, |
1334 cookies_observer_list_, | 1334 cookies_observer_list_, |
1335 TreeModelEndBatch(this)); | 1335 TreeModelEndBatch(this)); |
1336 } | 1336 } |
1337 } | 1337 } |
OLD | NEW |