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 // 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 #else | 150 #else |
151 sscanf( | 151 sscanf( |
152 #endif | 152 #endif |
153 pc.MaxAge().c_str(), " %" PRIu64, &max_age) == 1) { | 153 pc.MaxAge().c_str(), " %" PRIu64, &max_age) == 1) { |
154 return current + TimeDelta::FromSeconds(max_age); | 154 return current + TimeDelta::FromSeconds(max_age); |
155 } | 155 } |
156 | 156 |
157 // Try the Expires attribute. | 157 // Try the Expires attribute. |
158 if (pc.HasExpires() && !pc.Expires().empty()) { | 158 if (pc.HasExpires() && !pc.Expires().empty()) { |
159 // Adjust for clock skew between server and host. | 159 // Adjust for clock skew between server and host. |
160 base::Time parsed_expiry = cookie_util::ParseCookieTime(pc.Expires()); | 160 base::Time parsed_expiry = |
| 161 cookie_util::ParseCookieExpirationTime(pc.Expires()); |
161 if (!parsed_expiry.is_null()) | 162 if (!parsed_expiry.is_null()) |
162 return parsed_expiry + (current - server_time); | 163 return parsed_expiry + (current - server_time); |
163 } | 164 } |
164 | 165 |
165 // Invalid or no expiration, persistent cookie. | 166 // Invalid or no expiration, persistent cookie. |
166 return Time(); | 167 return Time(); |
167 } | 168 } |
168 | 169 |
169 // static | 170 // static |
170 std::unique_ptr<CanonicalCookie> CanonicalCookie::Create( | 171 std::unique_ptr<CanonicalCookie> CanonicalCookie::Create( |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 return true; | 523 return true; |
523 } | 524 } |
524 | 525 |
525 std::string CanonicalCookie::DomainWithoutDot() const { | 526 std::string CanonicalCookie::DomainWithoutDot() const { |
526 if (domain_.empty() || domain_[0] != '.') | 527 if (domain_.empty() || domain_[0] != '.') |
527 return domain_; | 528 return domain_; |
528 return domain_.substr(1); | 529 return domain_.substr(1); |
529 } | 530 } |
530 | 531 |
531 } // namespace net | 532 } // namespace net |
OLD | NEW |