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 <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 const std::string& domain, | 79 const std::string& domain, |
80 const std::string& path, | 80 const std::string& path, |
81 const base::Time& creation, | 81 const base::Time& creation, |
82 const base::Time& expiration, | 82 const base::Time& expiration, |
83 const base::Time& last_access, | 83 const base::Time& last_access, |
84 bool secure, | 84 bool secure, |
85 bool http_only, | 85 bool http_only, |
86 CookieSameSite same_site, | 86 CookieSameSite same_site, |
87 CookiePriority priority); | 87 CookiePriority priority); |
88 | 88 |
89 const GURL& Source() const { return source_; } | |
90 const std::string& Name() const { return name_; } | 89 const std::string& Name() const { return name_; } |
91 const std::string& Value() const { return value_; } | 90 const std::string& Value() const { return value_; } |
92 const std::string& Domain() const { return domain_; } | 91 const std::string& Domain() const { return domain_; } |
93 const std::string& Path() const { return path_; } | 92 const std::string& Path() const { return path_; } |
94 const base::Time& CreationDate() const { return creation_date_; } | 93 const base::Time& CreationDate() const { return creation_date_; } |
95 const base::Time& LastAccessDate() const { return last_access_date_; } | 94 const base::Time& LastAccessDate() const { return last_access_date_; } |
96 bool IsPersistent() const { return !expiry_date_.is_null(); } | 95 bool IsPersistent() const { return !expiry_date_.is_null(); } |
97 const base::Time& ExpiryDate() const { return expiry_date_; } | 96 const base::Time& ExpiryDate() const { return expiry_date_; } |
98 bool IsSecure() const { return secure_; } | 97 bool IsSecure() const { return secure_; } |
99 bool IsHttpOnly() const { return httponly_; } | 98 bool IsHttpOnly() const { return httponly_; } |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 // Records histograms to measure how often cookie prefixes appear in | 190 // Records histograms to measure how often cookie prefixes appear in |
192 // the wild and how often they would be blocked. | 191 // the wild and how often they would be blocked. |
193 static void RecordCookiePrefixMetrics(CookiePrefix prefix, | 192 static void RecordCookiePrefixMetrics(CookiePrefix prefix, |
194 bool is_cookie_valid); | 193 bool is_cookie_valid); |
195 // Returns true if a prefixed cookie does not violate any of the rules | 194 // Returns true if a prefixed cookie does not violate any of the rules |
196 // for that cookie. | 195 // for that cookie. |
197 static bool IsCookiePrefixValid(CookiePrefix prefix, | 196 static bool IsCookiePrefixValid(CookiePrefix prefix, |
198 const GURL& url, | 197 const GURL& url, |
199 const ParsedCookie& parsed_cookie); | 198 const ParsedCookie& parsed_cookie); |
200 | 199 |
| 200 const GURL& Source() const { return source_; } |
| 201 |
201 // The source member of a canonical cookie is the origin of the URL that tried | 202 // The source member of a canonical cookie is the origin of the URL that tried |
202 // to set this cookie. This field is not persistent though; its only used in | 203 // to set this cookie. This field is not persistent though; its only used in |
203 // the in-tab cookies dialog to show the user the source URL. This is used for | 204 // the in-tab cookies dialog to show the user the source URL. This is used for |
204 // both allowed and blocked cookies. | 205 // both allowed and blocked cookies. |
205 // When a CanonicalCookie is constructed from the backing store (common case) | 206 // When a CanonicalCookie is constructed from the backing store (common case) |
206 // this field will be null. CanonicalCookie consumers should not rely on | 207 // this field will be null. CanonicalCookie consumers should not rely on |
207 // this field unless they guarantee that the creator of those | 208 // this field unless they guarantee that the creator of those |
208 // CanonicalCookies properly initialized the field. | 209 // CanonicalCookies properly initialized the field. |
209 GURL source_; | 210 GURL source_; |
210 std::string name_; | 211 std::string name_; |
211 std::string value_; | 212 std::string value_; |
212 std::string domain_; | 213 std::string domain_; |
213 std::string path_; | 214 std::string path_; |
214 base::Time creation_date_; | 215 base::Time creation_date_; |
215 base::Time expiry_date_; | 216 base::Time expiry_date_; |
216 base::Time last_access_date_; | 217 base::Time last_access_date_; |
217 bool secure_; | 218 bool secure_; |
218 bool httponly_; | 219 bool httponly_; |
219 CookieSameSite same_site_; | 220 CookieSameSite same_site_; |
220 CookiePriority priority_; | 221 CookiePriority priority_; |
221 }; | 222 }; |
222 | 223 |
223 typedef std::vector<CanonicalCookie> CookieList; | 224 typedef std::vector<CanonicalCookie> CookieList; |
224 | 225 |
225 } // namespace net | 226 } // namespace net |
226 | 227 |
227 #endif // NET_COOKIES_CANONICAL_COOKIE_H_ | 228 #endif // NET_COOKIES_CANONICAL_COOKIE_H_ |
OLD | NEW |