Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: chrome/browser/browsing_data/cookies_tree_model.cc

Issue 459233002: Browsing Data Deletion: Style fixes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Re-apply comment tweaks Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <vector> 10 #include <vector>
10 11
11 #include "base/bind.h" 12 #include "base/bind.h"
12 #include "base/memory/linked_ptr.h" 13 #include "base/memory/linked_ptr.h"
13 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
14 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
15 #include "chrome/browser/browsing_data/browsing_data_channel_id_helper.h" 16 #include "chrome/browser/browsing_data/browsing_data_channel_id_helper.h"
16 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" 17 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h"
17 #include "chrome/browser/browsing_data/browsing_data_flash_lso_helper.h" 18 #include "chrome/browser/browsing_data/browsing_data_flash_lso_helper.h"
18 #include "chrome/browser/content_settings/cookie_settings.h" 19 #include "chrome/browser/content_settings/cookie_settings.h"
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 CookieTreeCookieNode::CookieTreeCookieNode( 297 CookieTreeCookieNode::CookieTreeCookieNode(
297 std::list<net::CanonicalCookie>::iterator cookie) 298 std::list<net::CanonicalCookie>::iterator cookie)
298 : CookieTreeNode(base::UTF8ToUTF16(cookie->Name())), 299 : CookieTreeNode(base::UTF8ToUTF16(cookie->Name())),
299 cookie_(cookie) { 300 cookie_(cookie) {
300 } 301 }
301 302
302 CookieTreeCookieNode::~CookieTreeCookieNode() {} 303 CookieTreeCookieNode::~CookieTreeCookieNode() {}
303 304
304 void CookieTreeCookieNode::DeleteStoredObjects() { 305 void CookieTreeCookieNode::DeleteStoredObjects() {
305 LocalDataContainer* container = GetLocalDataContainerForNode(this); 306 LocalDataContainer* container = GetLocalDataContainerForNode(this);
306 CHECK(container);
307 container->cookie_helper_->DeleteCookie(*cookie_); 307 container->cookie_helper_->DeleteCookie(*cookie_);
308 container->cookie_list_.erase(cookie_); 308 container->cookie_list_.erase(cookie_);
309 } 309 }
310 310
311 CookieTreeNode::DetailedInfo CookieTreeCookieNode::GetDetailedInfo() const { 311 CookieTreeNode::DetailedInfo CookieTreeCookieNode::GetDetailedInfo() const {
312 return DetailedInfo().InitCookie(&*cookie_); 312 return DetailedInfo().InitCookie(&*cookie_);
313 } 313 }
314 314
315 /////////////////////////////////////////////////////////////////////////////// 315 ///////////////////////////////////////////////////////////////////////////////
316 // CookieTreeAppCacheNode, public: 316 // CookieTreeAppCacheNode, public:
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
891 const std::string& domain) 891 const std::string& domain)
892 : domain_(domain) {} 892 : domain_(domain) {}
893 CookieTreeFlashLSONode::~CookieTreeFlashLSONode() {} 893 CookieTreeFlashLSONode::~CookieTreeFlashLSONode() {}
894 894
895 void CookieTreeFlashLSONode::DeleteStoredObjects() { 895 void CookieTreeFlashLSONode::DeleteStoredObjects() {
896 // We are one level below the host node. 896 // We are one level below the host node.
897 CookieTreeHostNode* host = static_cast<CookieTreeHostNode*>(parent()); 897 CookieTreeHostNode* host = static_cast<CookieTreeHostNode*>(parent());
898 CHECK_EQ(host->GetDetailedInfo().node_type, 898 CHECK_EQ(host->GetDetailedInfo().node_type,
899 CookieTreeNode::DetailedInfo::TYPE_HOST); 899 CookieTreeNode::DetailedInfo::TYPE_HOST);
900 LocalDataContainer* container = GetModel()->data_container(); 900 LocalDataContainer* container = GetModel()->data_container();
901 CHECK(container);
902
903 container->flash_lso_helper_->DeleteFlashLSOsForSite(domain_); 901 container->flash_lso_helper_->DeleteFlashLSOsForSite(domain_);
904 } 902 }
905 903
906 CookieTreeNode::DetailedInfo CookieTreeFlashLSONode::GetDetailedInfo() const { 904 CookieTreeNode::DetailedInfo CookieTreeFlashLSONode::GetDetailedInfo() const {
907 return DetailedInfo().InitFlashLSO(domain_); 905 return DetailedInfo().InitFlashLSO(domain_);
908 } 906 }
909 907
910 /////////////////////////////////////////////////////////////////////////////// 908 ///////////////////////////////////////////////////////////////////////////////
911 // ScopedBatchUpdateNotifier 909 // ScopedBatchUpdateNotifier
912 CookiesTreeModel::ScopedBatchUpdateNotifier::ScopedBatchUpdateNotifier( 910 CookiesTreeModel::ScopedBatchUpdateNotifier::ScopedBatchUpdateNotifier(
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 std::string domain = it->Domain(); 1167 std::string domain = it->Domain();
1170 if (domain.length() > 1 && domain[0] == '.') 1168 if (domain.length() > 1 && domain[0] == '.')
1171 domain = domain.substr(1); 1169 domain = domain.substr(1);
1172 1170
1173 // We treat secure cookies just the same as normal ones. 1171 // We treat secure cookies just the same as normal ones.
1174 source_string = std::string(url::kHttpScheme) + 1172 source_string = std::string(url::kHttpScheme) +
1175 url::kStandardSchemeSeparator + domain + "/"; 1173 url::kStandardSchemeSeparator + domain + "/";
1176 } 1174 }
1177 1175
1178 GURL source(source_string); 1176 GURL source(source_string);
1179 if (!filter.size() || 1177 if (filter.empty() || (CookieTreeHostNode::TitleForUrl(source)
1180 (CookieTreeHostNode::TitleForUrl(source).find(filter) != 1178 .find(filter) != base::string16::npos)) {
1181 base::string16::npos)) {
1182 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(source); 1179 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(source);
1183 CookieTreeCookiesNode* cookies_node = 1180 CookieTreeCookiesNode* cookies_node =
1184 host_node->GetOrCreateCookiesNode(); 1181 host_node->GetOrCreateCookiesNode();
1185 CookieTreeCookieNode* new_cookie = new CookieTreeCookieNode(it); 1182 CookieTreeCookieNode* new_cookie = new CookieTreeCookieNode(it);
1186 cookies_node->AddCookieNode(new_cookie); 1183 cookies_node->AddCookieNode(new_cookie);
1187 } 1184 }
1188 } 1185 }
1189 } 1186 }
1190 1187
1191 void CookiesTreeModel::PopulateDatabaseInfoWithFilter( 1188 void CookiesTreeModel::PopulateDatabaseInfoWithFilter(
1192 LocalDataContainer* container, 1189 LocalDataContainer* container,
1193 ScopedBatchUpdateNotifier* notifier, 1190 ScopedBatchUpdateNotifier* notifier,
1194 const base::string16& filter) { 1191 const base::string16& filter) {
1195 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); 1192 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot());
1196 1193
1197 if (container->database_info_list_.empty()) 1194 if (container->database_info_list_.empty())
1198 return; 1195 return;
1199 1196
1200 notifier->StartBatchUpdate(); 1197 notifier->StartBatchUpdate();
1201 for (DatabaseInfoList::iterator database_info = 1198 for (DatabaseInfoList::iterator database_info =
1202 container->database_info_list_.begin(); 1199 container->database_info_list_.begin();
1203 database_info != container->database_info_list_.end(); 1200 database_info != container->database_info_list_.end();
1204 ++database_info) { 1201 ++database_info) {
1205 GURL origin(database_info->identifier.ToOrigin()); 1202 GURL origin(database_info->identifier.ToOrigin());
1206 1203
1207 if (!filter.size() || 1204 if (filter.empty() || (CookieTreeHostNode::TitleForUrl(origin)
1208 (CookieTreeHostNode::TitleForUrl(origin).find(filter) != 1205 .find(filter) != base::string16::npos)) {
1209 base::string16::npos)) {
1210 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin); 1206 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin);
1211 CookieTreeDatabasesNode* databases_node = 1207 CookieTreeDatabasesNode* databases_node =
1212 host_node->GetOrCreateDatabasesNode(); 1208 host_node->GetOrCreateDatabasesNode();
1213 databases_node->AddDatabaseNode( 1209 databases_node->AddDatabaseNode(
1214 new CookieTreeDatabaseNode(database_info)); 1210 new CookieTreeDatabaseNode(database_info));
1215 } 1211 }
1216 } 1212 }
1217 } 1213 }
1218 1214
1219 void CookiesTreeModel::PopulateLocalStorageInfoWithFilter( 1215 void CookiesTreeModel::PopulateLocalStorageInfoWithFilter(
1220 LocalDataContainer* container, 1216 LocalDataContainer* container,
1221 ScopedBatchUpdateNotifier* notifier, 1217 ScopedBatchUpdateNotifier* notifier,
1222 const base::string16& filter) { 1218 const base::string16& filter) {
1223 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); 1219 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot());
1224 1220
1225 if (container->local_storage_info_list_.empty()) 1221 if (container->local_storage_info_list_.empty())
1226 return; 1222 return;
1227 1223
1228 notifier->StartBatchUpdate(); 1224 notifier->StartBatchUpdate();
1229 for (LocalStorageInfoList::iterator local_storage_info = 1225 for (LocalStorageInfoList::iterator local_storage_info =
1230 container->local_storage_info_list_.begin(); 1226 container->local_storage_info_list_.begin();
1231 local_storage_info != container->local_storage_info_list_.end(); 1227 local_storage_info != container->local_storage_info_list_.end();
1232 ++local_storage_info) { 1228 ++local_storage_info) {
1233 const GURL& origin(local_storage_info->origin_url); 1229 const GURL& origin(local_storage_info->origin_url);
1234 1230
1235 if (!filter.size() || 1231 if (filter.empty() || (CookieTreeHostNode::TitleForUrl(origin)
1236 (CookieTreeHostNode::TitleForUrl(origin).find(filter) != 1232 .find(filter) != std::string::npos)) {
1237 std::string::npos)) {
1238 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin); 1233 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin);
1239 CookieTreeLocalStoragesNode* local_storages_node = 1234 CookieTreeLocalStoragesNode* local_storages_node =
1240 host_node->GetOrCreateLocalStoragesNode(); 1235 host_node->GetOrCreateLocalStoragesNode();
1241 local_storages_node->AddLocalStorageNode( 1236 local_storages_node->AddLocalStorageNode(
1242 new CookieTreeLocalStorageNode(local_storage_info)); 1237 new CookieTreeLocalStorageNode(local_storage_info));
1243 } 1238 }
1244 } 1239 }
1245 } 1240 }
1246 1241
1247 void CookiesTreeModel::PopulateSessionStorageInfoWithFilter( 1242 void CookiesTreeModel::PopulateSessionStorageInfoWithFilter(
1248 LocalDataContainer* container, 1243 LocalDataContainer* container,
1249 ScopedBatchUpdateNotifier* notifier, 1244 ScopedBatchUpdateNotifier* notifier,
1250 const base::string16& filter) { 1245 const base::string16& filter) {
1251 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); 1246 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot());
1252 1247
1253 if (container->session_storage_info_list_.empty()) 1248 if (container->session_storage_info_list_.empty())
1254 return; 1249 return;
1255 1250
1256 notifier->StartBatchUpdate(); 1251 notifier->StartBatchUpdate();
1257 for (LocalStorageInfoList::iterator session_storage_info = 1252 for (LocalStorageInfoList::iterator session_storage_info =
1258 container->session_storage_info_list_.begin(); 1253 container->session_storage_info_list_.begin();
1259 session_storage_info != container->session_storage_info_list_.end(); 1254 session_storage_info != container->session_storage_info_list_.end();
1260 ++session_storage_info) { 1255 ++session_storage_info) {
1261 const GURL& origin = session_storage_info->origin_url; 1256 const GURL& origin = session_storage_info->origin_url;
1262 1257
1263 if (!filter.size() || 1258 if (filter.empty() || (CookieTreeHostNode::TitleForUrl(origin)
1264 (CookieTreeHostNode::TitleForUrl(origin).find(filter) != 1259 .find(filter) != base::string16::npos)) {
1265 base::string16::npos)) {
1266 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin); 1260 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin);
1267 CookieTreeSessionStoragesNode* session_storages_node = 1261 CookieTreeSessionStoragesNode* session_storages_node =
1268 host_node->GetOrCreateSessionStoragesNode(); 1262 host_node->GetOrCreateSessionStoragesNode();
1269 session_storages_node->AddSessionStorageNode( 1263 session_storages_node->AddSessionStorageNode(
1270 new CookieTreeSessionStorageNode(session_storage_info)); 1264 new CookieTreeSessionStorageNode(session_storage_info));
1271 } 1265 }
1272 } 1266 }
1273 } 1267 }
1274 1268
1275 void CookiesTreeModel::PopulateIndexedDBInfoWithFilter( 1269 void CookiesTreeModel::PopulateIndexedDBInfoWithFilter(
1276 LocalDataContainer* container, 1270 LocalDataContainer* container,
1277 ScopedBatchUpdateNotifier* notifier, 1271 ScopedBatchUpdateNotifier* notifier,
1278 const base::string16& filter) { 1272 const base::string16& filter) {
1279 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); 1273 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot());
1280 1274
1281 if (container->indexed_db_info_list_.empty()) 1275 if (container->indexed_db_info_list_.empty())
1282 return; 1276 return;
1283 1277
1284 notifier->StartBatchUpdate(); 1278 notifier->StartBatchUpdate();
1285 for (IndexedDBInfoList::iterator indexed_db_info = 1279 for (IndexedDBInfoList::iterator indexed_db_info =
1286 container->indexed_db_info_list_.begin(); 1280 container->indexed_db_info_list_.begin();
1287 indexed_db_info != container->indexed_db_info_list_.end(); 1281 indexed_db_info != container->indexed_db_info_list_.end();
1288 ++indexed_db_info) { 1282 ++indexed_db_info) {
1289 const GURL& origin = indexed_db_info->origin_; 1283 const GURL& origin = indexed_db_info->origin_;
1290 1284
1291 if (!filter.size() || 1285 if (filter.empty() || (CookieTreeHostNode::TitleForUrl(origin)
1292 (CookieTreeHostNode::TitleForUrl(origin).find(filter) != 1286 .find(filter) != base::string16::npos)) {
1293 base::string16::npos)) {
1294 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin); 1287 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin);
1295 CookieTreeIndexedDBsNode* indexed_dbs_node = 1288 CookieTreeIndexedDBsNode* indexed_dbs_node =
1296 host_node->GetOrCreateIndexedDBsNode(); 1289 host_node->GetOrCreateIndexedDBsNode();
1297 indexed_dbs_node->AddIndexedDBNode( 1290 indexed_dbs_node->AddIndexedDBNode(
1298 new CookieTreeIndexedDBNode(indexed_db_info)); 1291 new CookieTreeIndexedDBNode(indexed_db_info));
1299 } 1292 }
1300 } 1293 }
1301 } 1294 }
1302 1295
1303 void CookiesTreeModel::PopulateChannelIDInfoWithFilter( 1296 void CookiesTreeModel::PopulateChannelIDInfoWithFilter(
(...skipping 12 matching lines...) Expand all
1316 ++channel_id_info) { 1309 ++channel_id_info) {
1317 GURL origin(channel_id_info->server_identifier()); 1310 GURL origin(channel_id_info->server_identifier());
1318 if (!origin.is_valid()) { 1311 if (!origin.is_valid()) {
1319 // Channel ID. Make a valid URL to satisfy the 1312 // Channel ID. Make a valid URL to satisfy the
1320 // CookieTreeRootNode::GetOrCreateHostNode interface. 1313 // CookieTreeRootNode::GetOrCreateHostNode interface.
1321 origin = GURL(std::string(url::kHttpsScheme) + 1314 origin = GURL(std::string(url::kHttpsScheme) +
1322 url::kStandardSchemeSeparator + 1315 url::kStandardSchemeSeparator +
1323 channel_id_info->server_identifier() + "/"); 1316 channel_id_info->server_identifier() + "/");
1324 } 1317 }
1325 base::string16 title = CookieTreeHostNode::TitleForUrl(origin); 1318 base::string16 title = CookieTreeHostNode::TitleForUrl(origin);
1326 if (!filter.size() || title.find(filter) != base::string16::npos) { 1319 if (filter.empty() || title.find(filter) != base::string16::npos) {
1327 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin); 1320 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin);
1328 CookieTreeChannelIDsNode* channel_ids_node = 1321 CookieTreeChannelIDsNode* channel_ids_node =
1329 host_node->GetOrCreateChannelIDsNode(); 1322 host_node->GetOrCreateChannelIDsNode();
1330 channel_ids_node->AddChannelIDNode( 1323 channel_ids_node->AddChannelIDNode(
1331 new CookieTreeChannelIDNode(channel_id_info)); 1324 new CookieTreeChannelIDNode(channel_id_info));
1332 } 1325 }
1333 } 1326 }
1334 } 1327 }
1335 1328
1336 void CookiesTreeModel::PopulateServiceWorkerUsageInfoWithFilter( 1329 void CookiesTreeModel::PopulateServiceWorkerUsageInfoWithFilter(
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1369 if (container->file_system_info_list_.empty()) 1362 if (container->file_system_info_list_.empty())
1370 return; 1363 return;
1371 1364
1372 notifier->StartBatchUpdate(); 1365 notifier->StartBatchUpdate();
1373 for (FileSystemInfoList::iterator file_system_info = 1366 for (FileSystemInfoList::iterator file_system_info =
1374 container->file_system_info_list_.begin(); 1367 container->file_system_info_list_.begin();
1375 file_system_info != container->file_system_info_list_.end(); 1368 file_system_info != container->file_system_info_list_.end();
1376 ++file_system_info) { 1369 ++file_system_info) {
1377 GURL origin(file_system_info->origin); 1370 GURL origin(file_system_info->origin);
1378 1371
1379 if (!filter.size() || 1372 if (filter.empty() || (CookieTreeHostNode::TitleForUrl(origin)
1380 (CookieTreeHostNode::TitleForUrl(origin).find(filter) != 1373 .find(filter) != base::string16::npos)) {
1381 base::string16::npos)) {
1382 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin); 1374 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin);
1383 CookieTreeFileSystemsNode* file_systems_node = 1375 CookieTreeFileSystemsNode* file_systems_node =
1384 host_node->GetOrCreateFileSystemsNode(); 1376 host_node->GetOrCreateFileSystemsNode();
1385 file_systems_node->AddFileSystemNode( 1377 file_systems_node->AddFileSystemNode(
1386 new CookieTreeFileSystemNode(file_system_info)); 1378 new CookieTreeFileSystemNode(file_system_info));
1387 } 1379 }
1388 } 1380 }
1389 } 1381 }
1390 1382
1391 void CookiesTreeModel::PopulateQuotaInfoWithFilter( 1383 void CookiesTreeModel::PopulateQuotaInfoWithFilter(
1392 LocalDataContainer* container, 1384 LocalDataContainer* container,
1393 ScopedBatchUpdateNotifier* notifier, 1385 ScopedBatchUpdateNotifier* notifier,
1394 const base::string16& filter) { 1386 const base::string16& filter) {
1395 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); 1387 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot());
1396 1388
1397 if (container->quota_info_list_.empty()) 1389 if (container->quota_info_list_.empty())
1398 return; 1390 return;
1399 1391
1400 notifier->StartBatchUpdate(); 1392 notifier->StartBatchUpdate();
1401 for (QuotaInfoList::iterator quota_info = container->quota_info_list_.begin(); 1393 for (QuotaInfoList::iterator quota_info = container->quota_info_list_.begin();
1402 quota_info != container->quota_info_list_.end(); 1394 quota_info != container->quota_info_list_.end();
1403 ++quota_info) { 1395 ++quota_info) {
1404 if (!filter.size() || 1396 if (filter.empty() || (base::UTF8ToUTF16(quota_info->host).find(filter) !=
1405 (base::UTF8ToUTF16(quota_info->host).find(filter) != 1397 base::string16::npos)) {
1406 base::string16::npos)) {
1407 CookieTreeHostNode* host_node = 1398 CookieTreeHostNode* host_node =
1408 root->GetOrCreateHostNode(GURL("http://" + quota_info->host)); 1399 root->GetOrCreateHostNode(GURL("http://" + quota_info->host));
1409 host_node->UpdateOrCreateQuotaNode(quota_info); 1400 host_node->UpdateOrCreateQuotaNode(quota_info);
1410 } 1401 }
1411 } 1402 }
1412 } 1403 }
1413 1404
1414 void CookiesTreeModel::PopulateFlashLSOInfoWithFilter( 1405 void CookiesTreeModel::PopulateFlashLSOInfoWithFilter(
1415 LocalDataContainer* container, 1406 LocalDataContainer* container,
1416 ScopedBatchUpdateNotifier* notifier, 1407 ScopedBatchUpdateNotifier* notifier,
1417 const base::string16& filter) { 1408 const base::string16& filter) {
1418 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); 1409 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot());
1419 1410
1420 if (container->flash_lso_domain_list_.empty()) 1411 if (container->flash_lso_domain_list_.empty())
1421 return; 1412 return;
1422 1413
1423 std::string filter_utf8 = base::UTF16ToUTF8(filter); 1414 std::string filter_utf8 = base::UTF16ToUTF8(filter);
1424 notifier->StartBatchUpdate(); 1415 notifier->StartBatchUpdate();
1425 for (std::vector<std::string>::iterator it = 1416 for (std::vector<std::string>::iterator it =
1426 container->flash_lso_domain_list_.begin(); 1417 container->flash_lso_domain_list_.begin();
1427 it != container->flash_lso_domain_list_.end(); ++it) { 1418 it != container->flash_lso_domain_list_.end(); ++it) {
1428 if (!filter_utf8.size() || it->find(filter_utf8) != std::string::npos) { 1419 if (filter_utf8.empty() || it->find(filter_utf8) != std::string::npos) {
1429 // Create a fake origin for GetOrCreateHostNode(). 1420 // Create a fake origin for GetOrCreateHostNode().
1430 GURL origin("http://" + *it); 1421 GURL origin("http://" + *it);
1431 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin); 1422 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin);
1432 host_node->GetOrCreateFlashLSONode(*it); 1423 host_node->GetOrCreateFlashLSONode(*it);
1433 } 1424 }
1434 } 1425 }
1435 } 1426 }
1436 1427
1437 void CookiesTreeModel::NotifyObserverBeginBatch() { 1428 void CookiesTreeModel::NotifyObserverBeginBatch() {
1438 // Only notify the model once if we're batching in a nested manner. 1429 // Only notify the model once if we're batching in a nested manner.
1439 if (batch_update_++ == 0) { 1430 if (batch_update_++ == 0) {
1440 FOR_EACH_OBSERVER(Observer, 1431 FOR_EACH_OBSERVER(Observer,
1441 cookies_observer_list_, 1432 cookies_observer_list_,
1442 TreeModelBeginBatch(this)); 1433 TreeModelBeginBatch(this));
1443 } 1434 }
1444 } 1435 }
1445 1436
1446 void CookiesTreeModel::NotifyObserverEndBatch() { 1437 void CookiesTreeModel::NotifyObserverEndBatch() {
1447 // Only notify the observers if this is the outermost call to EndBatch() if 1438 // Only notify the observers if this is the outermost call to EndBatch() if
1448 // called in a nested manner. 1439 // called in a nested manner.
1449 if (--batch_update_ == 0) { 1440 if (--batch_update_ == 0) {
1450 FOR_EACH_OBSERVER(Observer, 1441 FOR_EACH_OBSERVER(Observer,
1451 cookies_observer_list_, 1442 cookies_observer_list_,
1452 TreeModelEndBatch(this)); 1443 TreeModelEndBatch(this));
1453 } 1444 }
1454 } 1445 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698