OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // Portions of this code based on Mozilla: | 5 // Portions of this code based on Mozilla: |
6 // (netwerk/cookie/src/nsCookieService.cpp) | 6 // (netwerk/cookie/src/nsCookieService.cpp) |
7 /* ***** BEGIN LICENSE BLOCK ***** | 7 /* ***** BEGIN LICENSE BLOCK ***** |
8 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 8 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
9 * | 9 * |
10 * The contents of this file are subject to the Mozilla Public License Version | 10 * The contents of this file are subject to the Mozilla Public License Version |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 std::string name; | 156 std::string name; |
157 std::string domain; | 157 std::string domain; |
158 std::string path; | 158 std::string path; |
159 }; | 159 }; |
160 | 160 |
161 // Returns the effective TLD+1 for a given host. This only makes sense for http | 161 // Returns the effective TLD+1 for a given host. This only makes sense for http |
162 // and https schemes. For other schemes, the host will be returned unchanged | 162 // and https schemes. For other schemes, the host will be returned unchanged |
163 // (minus any leading period). | 163 // (minus any leading period). |
164 std::string GetEffectiveDomain(const std::string& scheme, | 164 std::string GetEffectiveDomain(const std::string& scheme, |
165 const std::string& host) { | 165 const std::string& host) { |
166 if (scheme == "http" || scheme == "https") | 166 if (scheme == "http" || scheme == "https" || scheme == "httpsv") |
167 return RegistryControlledDomainService::GetDomainAndRegistry(host); | 167 return RegistryControlledDomainService::GetDomainAndRegistry(host); |
168 | 168 |
169 if (!CookieMonster::DomainIsHostOnly(host)) | 169 if (!CookieMonster::DomainIsHostOnly(host)) |
170 return host.substr(1); | 170 return host.substr(1); |
171 return host; | 171 return host; |
172 } | 172 } |
173 | 173 |
174 // Determine the actual cookie domain based on the domain string passed | 174 // Determine the actual cookie domain based on the domain string passed |
175 // (if any) and the URL from which the cookie came. | 175 // (if any) and the URL from which the cookie came. |
176 // On success returns true, and sets cookie_domain to either a | 176 // On success returns true, and sets cookie_domain to either a |
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
974 DELETE_COOKIE_DUPLICATE_IN_BACKING_STORE); | 974 DELETE_COOKIE_DUPLICATE_IN_BACKING_STORE); |
975 } | 975 } |
976 } | 976 } |
977 DCHECK_EQ(num_duplicates, num_duplicates_found); | 977 DCHECK_EQ(num_duplicates, num_duplicates_found); |
978 | 978 |
979 return num_duplicates; | 979 return num_duplicates; |
980 } | 980 } |
981 | 981 |
982 void CookieMonster::SetDefaultCookieableSchemes() { | 982 void CookieMonster::SetDefaultCookieableSchemes() { |
983 // Note: file must be the last scheme. | 983 // Note: file must be the last scheme. |
984 static const char* kDefaultCookieableSchemes[] = { "http", "https", "file" }; | 984 static const char* kDefaultCookieableSchemes[] = |
985 int num_schemes = enable_file_scheme_ ? 3 : 2; | 985 { "http", "https", "httpsv", "file" }; |
| 986 int num_schemes = enable_file_scheme_ ? 4 : 3; |
986 SetCookieableSchemes(kDefaultCookieableSchemes, num_schemes); | 987 SetCookieableSchemes(kDefaultCookieableSchemes, num_schemes); |
987 } | 988 } |
988 | 989 |
989 | 990 |
990 void CookieMonster::FindCookiesForHostAndDomain( | 991 void CookieMonster::FindCookiesForHostAndDomain( |
991 const GURL& url, | 992 const GURL& url, |
992 const CookieOptions& options, | 993 const CookieOptions& options, |
993 bool update_access_time, | 994 bool update_access_time, |
994 std::vector<CanonicalCookie*>* cookies) { | 995 std::vector<CanonicalCookie*>* cookies) { |
995 lock_.AssertAcquired(); | 996 lock_.AssertAcquired(); |
(...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2015 std::string CookieMonster::CanonicalCookie::DebugString() const { | 2016 std::string CookieMonster::CanonicalCookie::DebugString() const { |
2016 return base::StringPrintf( | 2017 return base::StringPrintf( |
2017 "name: %s value: %s domain: %s path: %s creation: %" | 2018 "name: %s value: %s domain: %s path: %s creation: %" |
2018 PRId64, | 2019 PRId64, |
2019 name_.c_str(), value_.c_str(), | 2020 name_.c_str(), value_.c_str(), |
2020 domain_.c_str(), path_.c_str(), | 2021 domain_.c_str(), path_.c_str(), |
2021 static_cast<int64>(creation_date_.ToTimeT())); | 2022 static_cast<int64>(creation_date_.ToTimeT())); |
2022 } | 2023 } |
2023 | 2024 |
2024 } // namespace | 2025 } // namespace |
OLD | NEW |