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/cookies_tree_model.h" | 5 #include "chrome/browser/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 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 for (CookieList::iterator it = cookie_list_.begin(); | 872 for (CookieList::iterator it = cookie_list_.begin(); |
873 it != cookie_list_.end(); ++it) { | 873 it != cookie_list_.end(); ++it) { |
874 std::string source_string = it->Source(); | 874 std::string source_string = it->Source(); |
875 if (source_string.empty() || !use_cookie_source_) { | 875 if (source_string.empty() || !use_cookie_source_) { |
876 std::string domain = it->Domain(); | 876 std::string domain = it->Domain(); |
877 if (domain.length() > 1 && domain[0] == '.') | 877 if (domain.length() > 1 && domain[0] == '.') |
878 domain = domain.substr(1); | 878 domain = domain.substr(1); |
879 | 879 |
880 // We treat secure cookies just the same as normal ones. | 880 // We treat secure cookies just the same as normal ones. |
881 source_string = std::string(chrome::kHttpScheme) + | 881 source_string = std::string(chrome::kHttpScheme) + |
882 chrome::kStandardSchemeSeparator + domain + "/"; | 882 content::kStandardSchemeSeparator + domain + "/"; |
883 } | 883 } |
884 | 884 |
885 GURL source(source_string); | 885 GURL source(source_string); |
886 if (!filter.size() || | 886 if (!filter.size() || |
887 (CookieTreeOriginNode::TitleForUrl(source).find(filter) != | 887 (CookieTreeOriginNode::TitleForUrl(source).find(filter) != |
888 std::string::npos)) { | 888 std::string::npos)) { |
889 CookieTreeOriginNode* origin_node = | 889 CookieTreeOriginNode* origin_node = |
890 root->GetOrCreateOriginNode(source); | 890 root->GetOrCreateOriginNode(source); |
891 CookieTreeCookiesNode* cookies_node = | 891 CookieTreeCookiesNode* cookies_node = |
892 origin_node->GetOrCreateCookiesNode(); | 892 origin_node->GetOrCreateCookiesNode(); |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1102 NotifyObserverBeginBatch(); | 1102 NotifyObserverBeginBatch(); |
1103 for (ServerBoundCertList::iterator cert_info = | 1103 for (ServerBoundCertList::iterator cert_info = |
1104 server_bound_cert_list_.begin(); | 1104 server_bound_cert_list_.begin(); |
1105 cert_info != server_bound_cert_list_.end(); | 1105 cert_info != server_bound_cert_list_.end(); |
1106 ++cert_info) { | 1106 ++cert_info) { |
1107 GURL origin(cert_info->server_identifier()); | 1107 GURL origin(cert_info->server_identifier()); |
1108 if (!origin.is_valid()) { | 1108 if (!origin.is_valid()) { |
1109 // Domain Bound Cert. Make a valid URL to satisfy the | 1109 // Domain Bound Cert. Make a valid URL to satisfy the |
1110 // CookieTreeRootNode::GetOrCreateOriginNode interface. | 1110 // CookieTreeRootNode::GetOrCreateOriginNode interface. |
1111 origin = GURL(std::string(chrome::kHttpsScheme) + | 1111 origin = GURL(std::string(chrome::kHttpsScheme) + |
1112 chrome::kStandardSchemeSeparator + | 1112 content::kStandardSchemeSeparator + |
1113 cert_info->server_identifier() + "/"); | 1113 cert_info->server_identifier() + "/"); |
1114 } | 1114 } |
1115 std::wstring title = CookieTreeOriginNode::TitleForUrl(origin); | 1115 std::wstring title = CookieTreeOriginNode::TitleForUrl(origin); |
1116 | 1116 |
1117 if (!filter.size() || title.find(filter) != std::wstring::npos) { | 1117 if (!filter.size() || title.find(filter) != std::wstring::npos) { |
1118 CookieTreeOriginNode* origin_node = | 1118 CookieTreeOriginNode* origin_node = |
1119 root->GetOrCreateOriginNode(origin); | 1119 root->GetOrCreateOriginNode(origin); |
1120 CookieTreeServerBoundCertsNode* server_bound_certs_node = | 1120 CookieTreeServerBoundCertsNode* server_bound_certs_node = |
1121 origin_node->GetOrCreateServerBoundCertsNode(); | 1121 origin_node->GetOrCreateServerBoundCertsNode(); |
1122 server_bound_certs_node->AddServerBoundCertNode( | 1122 server_bound_certs_node->AddServerBoundCertNode( |
(...skipping 15 matching lines...) Expand all Loading... |
1138 | 1138 |
1139 void CookiesTreeModel::NotifyObserverEndBatch() { | 1139 void CookiesTreeModel::NotifyObserverEndBatch() { |
1140 // Only notify the observers if this is the outermost call to EndBatch() if | 1140 // Only notify the observers if this is the outermost call to EndBatch() if |
1141 // called in a nested manner. | 1141 // called in a nested manner. |
1142 if (--batch_update_ == 0) { | 1142 if (--batch_update_ == 0) { |
1143 FOR_EACH_OBSERVER(Observer, | 1143 FOR_EACH_OBSERVER(Observer, |
1144 cookies_observer_list_, | 1144 cookies_observer_list_, |
1145 TreeModelEndBatch(this)); | 1145 TreeModelEndBatch(this)); |
1146 } | 1146 } |
1147 } | 1147 } |
OLD | NEW |