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 #ifndef NET_COOKIES_CANONICAL_COOKIE_H_ | 5 #ifndef NET_COOKIES_CANONICAL_COOKIE_H_ |
6 #define NET_COOKIES_CANONICAL_COOKIE_H_ | 6 #define NET_COOKIES_CANONICAL_COOKIE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 const base::Time& CreationDate() const { return creation_date_; } | 75 const base::Time& CreationDate() const { return creation_date_; } |
76 const base::Time& LastAccessDate() const { return last_access_date_; } | 76 const base::Time& LastAccessDate() const { return last_access_date_; } |
77 bool IsPersistent() const { return !expiry_date_.is_null(); } | 77 bool IsPersistent() const { return !expiry_date_.is_null(); } |
78 const base::Time& ExpiryDate() const { return expiry_date_; } | 78 const base::Time& ExpiryDate() const { return expiry_date_; } |
79 bool IsSecure() const { return secure_; } | 79 bool IsSecure() const { return secure_; } |
80 bool IsHttpOnly() const { return httponly_; } | 80 bool IsHttpOnly() const { return httponly_; } |
81 bool IsDomainCookie() const { | 81 bool IsDomainCookie() const { |
82 return !domain_.empty() && domain_[0] == '.'; } | 82 return !domain_.empty() && domain_[0] == '.'; } |
83 bool IsHostCookie() const { return !IsDomainCookie(); } | 83 bool IsHostCookie() const { return !IsDomainCookie(); } |
84 | 84 |
85 bool IsExpired(const base::Time& current) { | 85 bool IsExpired(const base::Time& current) const { |
86 return !expiry_date_.is_null() && current >= expiry_date_; | 86 return !expiry_date_.is_null() && current >= expiry_date_; |
87 } | 87 } |
88 | 88 |
89 // Are the cookies considered equivalent in the eyes of RFC 2965. | 89 // Are the cookies considered equivalent in the eyes of RFC 2965. |
90 // The RFC says that name must match (case-sensitive), domain must | 90 // The RFC says that name must match (case-sensitive), domain must |
91 // match (case insensitive), and path must match (case sensitive). | 91 // match (case insensitive), and path must match (case sensitive). |
92 // For the case insensitive domain compare, we rely on the domain | 92 // For the case insensitive domain compare, we rely on the domain |
93 // having been canonicalized (in | 93 // having been canonicalized (in |
94 // GetCookieDomainWithString->CanonicalizeHost). | 94 // GetCookieDomainWithString->CanonicalizeHost). |
95 bool IsEquivalent(const CanonicalCookie& ecc) const { | 95 bool IsEquivalent(const CanonicalCookie& ecc) const { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 base::Time last_access_date_; | 148 base::Time last_access_date_; |
149 bool secure_; | 149 bool secure_; |
150 bool httponly_; | 150 bool httponly_; |
151 }; | 151 }; |
152 | 152 |
153 typedef std::vector<CanonicalCookie> CookieList; | 153 typedef std::vector<CanonicalCookie> CookieList; |
154 | 154 |
155 } // namespace net | 155 } // namespace net |
156 | 156 |
157 #endif // NET_COOKIES_CANONICAL_COOKIE_H_ | 157 #endif // NET_COOKIES_CANONICAL_COOKIE_H_ |
OLD | NEW |