| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <functional> | 10 #include <functional> |
| (...skipping 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1214 void CookiesTreeModel::PopulateCookieInfoWithFilter( | 1214 void CookiesTreeModel::PopulateCookieInfoWithFilter( |
| 1215 LocalDataContainer* container, | 1215 LocalDataContainer* container, |
| 1216 ScopedBatchUpdateNotifier* notifier, | 1216 ScopedBatchUpdateNotifier* notifier, |
| 1217 const base::string16& filter) { | 1217 const base::string16& filter) { |
| 1218 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); | 1218 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot()); |
| 1219 | 1219 |
| 1220 notifier->StartBatchUpdate(); | 1220 notifier->StartBatchUpdate(); |
| 1221 for (CookieList::iterator it = container->cookie_list_.begin(); | 1221 for (CookieList::iterator it = container->cookie_list_.begin(); |
| 1222 it != container->cookie_list_.end(); ++it) { | 1222 it != container->cookie_list_.end(); ++it) { |
| 1223 GURL source = CanonicalizeCookieSource(*it); | 1223 GURL source = CanonicalizeCookieSource(*it); |
| 1224 if (!source.SchemeIsHTTPOrHTTPS()) | |
| 1225 continue; | |
| 1226 if (source.is_empty() || !group_by_cookie_source_) { | 1224 if (source.is_empty() || !group_by_cookie_source_) { |
| 1227 std::string domain = it->Domain(); | 1225 std::string domain = it->Domain(); |
| 1228 if (domain.length() > 1 && domain[0] == '.') | 1226 if (domain.length() > 1 && domain[0] == '.') |
| 1229 domain = domain.substr(1); | 1227 domain = domain.substr(1); |
| 1230 | 1228 |
| 1231 // We treat secure cookies just the same as normal ones. | 1229 // We treat secure cookies just the same as normal ones. |
| 1232 source = GURL(std::string(url::kHttpScheme) + | 1230 source = GURL(std::string(url::kHttpScheme) + |
| 1233 url::kStandardSchemeSeparator + domain + "/"); | 1231 url::kStandardSchemeSeparator + domain + "/"); |
| 1234 } | 1232 } |
| 1233 if (!source.SchemeIsHTTPOrHTTPS()) |
| 1234 continue; |
| 1235 | 1235 |
| 1236 if (filter.empty() || (CookieTreeHostNode::TitleForUrl(source) | 1236 if (filter.empty() || (CookieTreeHostNode::TitleForUrl(source) |
| 1237 .find(filter) != base::string16::npos)) { | 1237 .find(filter) != base::string16::npos)) { |
| 1238 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(source); | 1238 CookieTreeHostNode* host_node = root->GetOrCreateHostNode(source); |
| 1239 CookieTreeCookiesNode* cookies_node = | 1239 CookieTreeCookiesNode* cookies_node = |
| 1240 host_node->GetOrCreateCookiesNode(); | 1240 host_node->GetOrCreateCookiesNode(); |
| 1241 CookieTreeCookieNode* new_cookie = new CookieTreeCookieNode(it); | 1241 CookieTreeCookieNode* new_cookie = new CookieTreeCookieNode(it); |
| 1242 cookies_node->AddCookieNode(new_cookie); | 1242 cookies_node->AddCookieNode(new_cookie); |
| 1243 } | 1243 } |
| 1244 } | 1244 } |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1543 void CookiesTreeModel::MaybeNotifyBatchesEnded() { | 1543 void CookiesTreeModel::MaybeNotifyBatchesEnded() { |
| 1544 // Only notify the observers if this is the outermost call to EndBatch() if | 1544 // Only notify the observers if this is the outermost call to EndBatch() if |
| 1545 // called in a nested manner. | 1545 // called in a nested manner. |
| 1546 if (batches_ended_ == batches_started_ && | 1546 if (batches_ended_ == batches_started_ && |
| 1547 batches_seen_ == batches_expected_) { | 1547 batches_seen_ == batches_expected_) { |
| 1548 FOR_EACH_OBSERVER(Observer, | 1548 FOR_EACH_OBSERVER(Observer, |
| 1549 cookies_observer_list_, | 1549 cookies_observer_list_, |
| 1550 TreeModelEndBatch(this)); | 1550 TreeModelEndBatch(this)); |
| 1551 } | 1551 } |
| 1552 } | 1552 } |
| OLD | NEW |