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 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1081 notifier->StartBatchUpdate(); | 1081 notifier->StartBatchUpdate(); |
1082 for (CookieList::iterator it = container->cookie_list_.begin(); | 1082 for (CookieList::iterator it = container->cookie_list_.begin(); |
1083 it != container->cookie_list_.end(); ++it) { | 1083 it != container->cookie_list_.end(); ++it) { |
1084 std::string source_string = it->Source(); | 1084 std::string source_string = it->Source(); |
1085 if (source_string.empty() || !group_by_cookie_source_) { | 1085 if (source_string.empty() || !group_by_cookie_source_) { |
1086 std::string domain = it->Domain(); | 1086 std::string domain = it->Domain(); |
1087 if (domain.length() > 1 && domain[0] == '.') | 1087 if (domain.length() > 1 && domain[0] == '.') |
1088 domain = domain.substr(1); | 1088 domain = domain.substr(1); |
1089 | 1089 |
1090 // We treat secure cookies just the same as normal ones. | 1090 // We treat secure cookies just the same as normal ones. |
1091 source_string = std::string(content::kHttpScheme) + | 1091 source_string = std::string(url::kHttpScheme) + |
1092 content::kStandardSchemeSeparator + domain + "/"; | 1092 content::kStandardSchemeSeparator + domain + "/"; |
1093 } | 1093 } |
1094 | 1094 |
1095 GURL source(source_string); | 1095 GURL source(source_string); |
1096 if (!filter.size() || | 1096 if (!filter.size() || |
1097 (CookieTreeHostNode::TitleForUrl(source).find(filter) != | 1097 (CookieTreeHostNode::TitleForUrl(source).find(filter) != |
1098 base::string16::npos)) { | 1098 base::string16::npos)) { |
1099 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(source); | 1099 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(source); |
1100 CookieTreeCookiesNode* cookies_node = | 1100 CookieTreeCookiesNode* cookies_node = |
1101 host_node->GetOrCreateCookiesNode(); | 1101 host_node->GetOrCreateCookiesNode(); |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1228 | 1228 |
1229 notifier->StartBatchUpdate(); | 1229 notifier->StartBatchUpdate(); |
1230 for (ServerBoundCertList::iterator cert_info = | 1230 for (ServerBoundCertList::iterator cert_info = |
1231 container->server_bound_cert_list_.begin(); | 1231 container->server_bound_cert_list_.begin(); |
1232 cert_info != container->server_bound_cert_list_.end(); | 1232 cert_info != container->server_bound_cert_list_.end(); |
1233 ++cert_info) { | 1233 ++cert_info) { |
1234 GURL origin(cert_info->server_identifier()); | 1234 GURL origin(cert_info->server_identifier()); |
1235 if (!origin.is_valid()) { | 1235 if (!origin.is_valid()) { |
1236 // Domain Bound Cert. Make a valid URL to satisfy the | 1236 // Domain Bound Cert. Make a valid URL to satisfy the |
1237 // CookieTreeRootNode::GetOrCreateHostNode interface. | 1237 // CookieTreeRootNode::GetOrCreateHostNode interface. |
1238 origin = GURL(std::string(content::kHttpsScheme) + | 1238 origin = GURL(std::string(url::kHttpsScheme) + |
1239 content::kStandardSchemeSeparator + | 1239 content::kStandardSchemeSeparator + |
1240 cert_info->server_identifier() + "/"); | 1240 cert_info->server_identifier() + "/"); |
1241 } | 1241 } |
1242 base::string16 title = CookieTreeHostNode::TitleForUrl(origin); | 1242 base::string16 title = CookieTreeHostNode::TitleForUrl(origin); |
1243 if (!filter.size() || title.find(filter) != base::string16::npos) { | 1243 if (!filter.size() || title.find(filter) != base::string16::npos) { |
1244 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin); | 1244 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin); |
1245 CookieTreeServerBoundCertsNode* server_bound_certs_node = | 1245 CookieTreeServerBoundCertsNode* server_bound_certs_node = |
1246 host_node->GetOrCreateServerBoundCertsNode(); | 1246 host_node->GetOrCreateServerBoundCertsNode(); |
1247 server_bound_certs_node->AddServerBoundCertNode( | 1247 server_bound_certs_node->AddServerBoundCertNode( |
1248 new CookieTreeServerBoundCertNode(cert_info)); | 1248 new CookieTreeServerBoundCertNode(cert_info)); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1335 | 1335 |
1336 void CookiesTreeModel::NotifyObserverEndBatch() { | 1336 void CookiesTreeModel::NotifyObserverEndBatch() { |
1337 // Only notify the observers if this is the outermost call to EndBatch() if | 1337 // Only notify the observers if this is the outermost call to EndBatch() if |
1338 // called in a nested manner. | 1338 // called in a nested manner. |
1339 if (--batch_update_ == 0) { | 1339 if (--batch_update_ == 0) { |
1340 FOR_EACH_OBSERVER(Observer, | 1340 FOR_EACH_OBSERVER(Observer, |
1341 cookies_observer_list_, | 1341 cookies_observer_list_, |
1342 TreeModelEndBatch(this)); | 1342 TreeModelEndBatch(this)); |
1343 } | 1343 } |
1344 } | 1344 } |
OLD | NEW |