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