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 same_site, | 41 CookieSameSite 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(const CanonicalCookie& other); | 49 CanonicalCookie(const CanonicalCookie& other); |
50 | 50 |
51 ~CanonicalCookie(); | 51 ~CanonicalCookie(); |
(...skipping 13 matching lines...) Expand all Loading... |
65 // value is invalid. | 65 // value is invalid. |
66 static scoped_ptr<CanonicalCookie> Create(const GURL& url, | 66 static scoped_ptr<CanonicalCookie> Create(const GURL& url, |
67 const std::string& name, | 67 const std::string& name, |
68 const std::string& value, | 68 const std::string& value, |
69 const std::string& domain, | 69 const std::string& domain, |
70 const std::string& path, | 70 const std::string& path, |
71 const base::Time& creation, | 71 const base::Time& creation, |
72 const base::Time& expiration, | 72 const base::Time& expiration, |
73 bool secure, | 73 bool secure, |
74 bool http_only, | 74 bool http_only, |
75 bool same_site, | 75 CookieSameSite same_site, |
76 bool enforce_strict_secure, | 76 bool enforce_strict_secure, |
77 CookiePriority priority); | 77 CookiePriority priority); |
78 | 78 |
79 const GURL& Source() const { return source_; } | 79 const GURL& Source() const { return source_; } |
80 const std::string& Name() const { return name_; } | 80 const std::string& Name() const { return name_; } |
81 const std::string& Value() const { return value_; } | 81 const std::string& Value() const { return value_; } |
82 const std::string& Domain() const { return domain_; } | 82 const std::string& Domain() const { return domain_; } |
83 const std::string& Path() const { return path_; } | 83 const std::string& Path() const { return path_; } |
84 const base::Time& CreationDate() const { return creation_date_; } | 84 const base::Time& CreationDate() const { return creation_date_; } |
85 const base::Time& LastAccessDate() const { return last_access_date_; } | 85 const base::Time& LastAccessDate() const { return last_access_date_; } |
86 bool IsPersistent() const { return !expiry_date_.is_null(); } | 86 bool IsPersistent() const { return !expiry_date_.is_null(); } |
87 const base::Time& ExpiryDate() const { return expiry_date_; } | 87 const base::Time& ExpiryDate() const { return expiry_date_; } |
88 bool IsSecure() const { return secure_; } | 88 bool IsSecure() const { return secure_; } |
89 bool IsHttpOnly() const { return httponly_; } | 89 bool IsHttpOnly() const { return httponly_; } |
90 bool IsSameSite() const { return same_site_; } | 90 CookieSameSite SameSite() const { return same_site_; } |
91 CookiePriority Priority() const { return priority_; } | 91 CookiePriority Priority() const { return priority_; } |
92 bool IsDomainCookie() const { | 92 bool IsDomainCookie() const { |
93 return !domain_.empty() && domain_[0] == '.'; } | 93 return !domain_.empty() && domain_[0] == '.'; } |
94 bool IsHostCookie() const { return !IsDomainCookie(); } | 94 bool IsHostCookie() const { return !IsDomainCookie(); } |
95 | 95 |
96 bool IsExpired(const base::Time& current) const { | 96 bool IsExpired(const base::Time& current) const { |
97 return !expiry_date_.is_null() && current >= expiry_date_; | 97 return !expiry_date_.is_null() && current >= expiry_date_; |
98 } | 98 } |
99 | 99 |
100 // Are the cookies considered equivalent in the eyes of RFC 2965. | 100 // Are the cookies considered equivalent in the eyes of RFC 2965. |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 GURL source_; | 199 GURL source_; |
200 std::string name_; | 200 std::string name_; |
201 std::string value_; | 201 std::string value_; |
202 std::string domain_; | 202 std::string domain_; |
203 std::string path_; | 203 std::string path_; |
204 base::Time creation_date_; | 204 base::Time creation_date_; |
205 base::Time expiry_date_; | 205 base::Time expiry_date_; |
206 base::Time last_access_date_; | 206 base::Time last_access_date_; |
207 bool secure_; | 207 bool secure_; |
208 bool httponly_; | 208 bool httponly_; |
209 bool same_site_; | 209 CookieSameSite same_site_; |
210 CookiePriority priority_; | 210 CookiePriority priority_; |
211 }; | 211 }; |
212 | 212 |
213 typedef std::vector<CanonicalCookie> CookieList; | 213 typedef std::vector<CanonicalCookie> CookieList; |
214 | 214 |
215 } // namespace net | 215 } // namespace net |
216 | 216 |
217 #endif // NET_COOKIES_CANONICAL_COOKIE_H_ | 217 #endif // NET_COOKIES_CANONICAL_COOKIE_H_ |
OLD | NEW |