| 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 20 matching lines...) Expand all Loading... |
| 31 CanonicalCookie(const GURL& url, | 31 CanonicalCookie(const GURL& url, |
| 32 const std::string& name, | 32 const std::string& name, |
| 33 const std::string& value, | 33 const std::string& value, |
| 34 const std::string& domain, | 34 const std::string& domain, |
| 35 const std::string& path, | 35 const std::string& path, |
| 36 const base::Time& creation, | 36 const base::Time& creation, |
| 37 const base::Time& expiration, | 37 const base::Time& expiration, |
| 38 const base::Time& last_access, | 38 const base::Time& last_access, |
| 39 bool secure, | 39 bool secure, |
| 40 bool httponly, | 40 bool httponly, |
| 41 bool firstpartyonly, | 41 bool same_site, |
| 42 CookiePriority priority); | 42 CookiePriority priority); |
| 43 | 43 |
| 44 // This constructor does canonicalization but not validation. | 44 // This constructor does canonicalization but not validation. |
| 45 // The result of this constructor should not be relied on in contexts | 45 // The result of this constructor should not be relied on in contexts |
| 46 // in which pre-validation of the ParsedCookie has not been done. | 46 // in which pre-validation of the ParsedCookie has not been done. |
| 47 CanonicalCookie(const GURL& url, const ParsedCookie& pc); | 47 CanonicalCookie(const GURL& url, const ParsedCookie& pc); |
| 48 | 48 |
| 49 ~CanonicalCookie(); | 49 ~CanonicalCookie(); |
| 50 | 50 |
| 51 // Supports the default copy constructor. | 51 // Supports the default copy constructor. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 63 // value is invalid. | 63 // value is invalid. |
| 64 static scoped_ptr<CanonicalCookie> Create(const GURL& url, | 64 static scoped_ptr<CanonicalCookie> Create(const GURL& url, |
| 65 const std::string& name, | 65 const std::string& name, |
| 66 const std::string& value, | 66 const std::string& value, |
| 67 const std::string& domain, | 67 const std::string& domain, |
| 68 const std::string& path, | 68 const std::string& path, |
| 69 const base::Time& creation, | 69 const base::Time& creation, |
| 70 const base::Time& expiration, | 70 const base::Time& expiration, |
| 71 bool secure, | 71 bool secure, |
| 72 bool http_only, | 72 bool http_only, |
| 73 bool first_party_only, | 73 bool same_site, |
| 74 bool enforce_strict_secure, | 74 bool enforce_strict_secure, |
| 75 CookiePriority priority); | 75 CookiePriority priority); |
| 76 | 76 |
| 77 const GURL& Source() const { return source_; } | 77 const GURL& Source() const { return source_; } |
| 78 const std::string& Name() const { return name_; } | 78 const std::string& Name() const { return name_; } |
| 79 const std::string& Value() const { return value_; } | 79 const std::string& Value() const { return value_; } |
| 80 const std::string& Domain() const { return domain_; } | 80 const std::string& Domain() const { return domain_; } |
| 81 const std::string& Path() const { return path_; } | 81 const std::string& Path() const { return path_; } |
| 82 const base::Time& CreationDate() const { return creation_date_; } | 82 const base::Time& CreationDate() const { return creation_date_; } |
| 83 const base::Time& LastAccessDate() const { return last_access_date_; } | 83 const base::Time& LastAccessDate() const { return last_access_date_; } |
| 84 bool IsPersistent() const { return !expiry_date_.is_null(); } | 84 bool IsPersistent() const { return !expiry_date_.is_null(); } |
| 85 const base::Time& ExpiryDate() const { return expiry_date_; } | 85 const base::Time& ExpiryDate() const { return expiry_date_; } |
| 86 bool IsSecure() const { return secure_; } | 86 bool IsSecure() const { return secure_; } |
| 87 bool IsHttpOnly() const { return httponly_; } | 87 bool IsHttpOnly() const { return httponly_; } |
| 88 bool IsFirstPartyOnly() const { return first_party_only_; } | 88 bool IsSameSite() const { return same_site_; } |
| 89 CookiePriority Priority() const { return priority_; } | 89 CookiePriority Priority() const { return priority_; } |
| 90 bool IsDomainCookie() const { | 90 bool IsDomainCookie() const { |
| 91 return !domain_.empty() && domain_[0] == '.'; } | 91 return !domain_.empty() && domain_[0] == '.'; } |
| 92 bool IsHostCookie() const { return !IsDomainCookie(); } | 92 bool IsHostCookie() const { return !IsDomainCookie(); } |
| 93 | 93 |
| 94 bool IsExpired(const base::Time& current) const { | 94 bool IsExpired(const base::Time& current) const { |
| 95 return !expiry_date_.is_null() && current >= expiry_date_; | 95 return !expiry_date_.is_null() && current >= expiry_date_; |
| 96 } | 96 } |
| 97 | 97 |
| 98 // Are the cookies considered equivalent in the eyes of RFC 2965. | 98 // Are the cookies considered equivalent in the eyes of RFC 2965. |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 GURL source_; | 197 GURL source_; |
| 198 std::string name_; | 198 std::string name_; |
| 199 std::string value_; | 199 std::string value_; |
| 200 std::string domain_; | 200 std::string domain_; |
| 201 std::string path_; | 201 std::string path_; |
| 202 base::Time creation_date_; | 202 base::Time creation_date_; |
| 203 base::Time expiry_date_; | 203 base::Time expiry_date_; |
| 204 base::Time last_access_date_; | 204 base::Time last_access_date_; |
| 205 bool secure_; | 205 bool secure_; |
| 206 bool httponly_; | 206 bool httponly_; |
| 207 bool first_party_only_; | 207 bool same_site_; |
| 208 CookiePriority priority_; | 208 CookiePriority priority_; |
| 209 }; | 209 }; |
| 210 | 210 |
| 211 typedef std::vector<CanonicalCookie> CookieList; | 211 typedef std::vector<CanonicalCookie> CookieList; |
| 212 | 212 |
| 213 } // namespace net | 213 } // namespace net |
| 214 | 214 |
| 215 #endif // NET_COOKIES_CANONICAL_COOKIE_H_ | 215 #endif // NET_COOKIES_CANONICAL_COOKIE_H_ |
| OLD | NEW |