| 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 19 matching lines...) Expand all Loading... |
| 30 CanonicalCookie(const GURL& url, | 30 CanonicalCookie(const GURL& url, |
| 31 const std::string& name, | 31 const std::string& name, |
| 32 const std::string& value, | 32 const std::string& value, |
| 33 const std::string& domain, | 33 const std::string& domain, |
| 34 const std::string& path, | 34 const std::string& path, |
| 35 const base::Time& creation, | 35 const base::Time& creation, |
| 36 const base::Time& expiration, | 36 const base::Time& expiration, |
| 37 const base::Time& last_access, | 37 const base::Time& last_access, |
| 38 bool secure, | 38 bool secure, |
| 39 bool httponly, | 39 bool httponly, |
| 40 bool firstpartyonly, |
| 40 CookiePriority priority); | 41 CookiePriority priority); |
| 41 | 42 |
| 42 // This constructor does canonicalization but not validation. | 43 // This constructor does canonicalization but not validation. |
| 43 // The result of this constructor should not be relied on in contexts | 44 // The result of this constructor should not be relied on in contexts |
| 44 // in which pre-validation of the ParsedCookie has not been done. | 45 // in which pre-validation of the ParsedCookie has not been done. |
| 45 CanonicalCookie(const GURL& url, const ParsedCookie& pc); | 46 CanonicalCookie(const GURL& url, const ParsedCookie& pc); |
| 46 | 47 |
| 47 ~CanonicalCookie(); | 48 ~CanonicalCookie(); |
| 48 | 49 |
| 49 // Supports the default copy constructor. | 50 // Supports the default copy constructor. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 61 // value is invalid. | 62 // value is invalid. |
| 62 static CanonicalCookie* Create(const GURL& url, | 63 static CanonicalCookie* Create(const GURL& url, |
| 63 const std::string& name, | 64 const std::string& name, |
| 64 const std::string& value, | 65 const std::string& value, |
| 65 const std::string& domain, | 66 const std::string& domain, |
| 66 const std::string& path, | 67 const std::string& path, |
| 67 const base::Time& creation, | 68 const base::Time& creation, |
| 68 const base::Time& expiration, | 69 const base::Time& expiration, |
| 69 bool secure, | 70 bool secure, |
| 70 bool http_only, | 71 bool http_only, |
| 72 bool first_party_only, |
| 71 CookiePriority priority); | 73 CookiePriority priority); |
| 72 | 74 |
| 73 const std::string& Source() const { return source_; } | 75 const std::string& Source() const { return source_; } |
| 74 const std::string& Name() const { return name_; } | 76 const std::string& Name() const { return name_; } |
| 75 const std::string& Value() const { return value_; } | 77 const std::string& Value() const { return value_; } |
| 76 const std::string& Domain() const { return domain_; } | 78 const std::string& Domain() const { return domain_; } |
| 77 const std::string& Path() const { return path_; } | 79 const std::string& Path() const { return path_; } |
| 78 const base::Time& CreationDate() const { return creation_date_; } | 80 const base::Time& CreationDate() const { return creation_date_; } |
| 79 const base::Time& LastAccessDate() const { return last_access_date_; } | 81 const base::Time& LastAccessDate() const { return last_access_date_; } |
| 80 bool IsPersistent() const { return !expiry_date_.is_null(); } | 82 bool IsPersistent() const { return !expiry_date_.is_null(); } |
| 81 const base::Time& ExpiryDate() const { return expiry_date_; } | 83 const base::Time& ExpiryDate() const { return expiry_date_; } |
| 82 bool IsSecure() const { return secure_; } | 84 bool IsSecure() const { return secure_; } |
| 83 bool IsHttpOnly() const { return httponly_; } | 85 bool IsHttpOnly() const { return httponly_; } |
| 86 bool IsFirstPartyOnly() const { return first_party_only_; } |
| 84 CookiePriority Priority() const { return priority_; } | 87 CookiePriority Priority() const { return priority_; } |
| 85 bool IsDomainCookie() const { | 88 bool IsDomainCookie() const { |
| 86 return !domain_.empty() && domain_[0] == '.'; } | 89 return !domain_.empty() && domain_[0] == '.'; } |
| 87 bool IsHostCookie() const { return !IsDomainCookie(); } | 90 bool IsHostCookie() const { return !IsDomainCookie(); } |
| 88 | 91 |
| 89 bool IsExpired(const base::Time& current) const { | 92 bool IsExpired(const base::Time& current) const { |
| 90 return !expiry_date_.is_null() && current >= expiry_date_; | 93 return !expiry_date_.is_null() && current >= expiry_date_; |
| 91 } | 94 } |
| 92 | 95 |
| 93 // Are the cookies considered equivalent in the eyes of RFC 2965. | 96 // Are the cookies considered equivalent in the eyes of RFC 2965. |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 std::string source_; | 154 std::string source_; |
| 152 std::string name_; | 155 std::string name_; |
| 153 std::string value_; | 156 std::string value_; |
| 154 std::string domain_; | 157 std::string domain_; |
| 155 std::string path_; | 158 std::string path_; |
| 156 base::Time creation_date_; | 159 base::Time creation_date_; |
| 157 base::Time expiry_date_; | 160 base::Time expiry_date_; |
| 158 base::Time last_access_date_; | 161 base::Time last_access_date_; |
| 159 bool secure_; | 162 bool secure_; |
| 160 bool httponly_; | 163 bool httponly_; |
| 164 bool first_party_only_; |
| 161 CookiePriority priority_; | 165 CookiePriority priority_; |
| 162 // NOTE: When any new members are added above this comment, the | 166 // NOTE: When any new members are added above this comment, the |
| 163 // implementation of Duplicate() must be updated to copy the new member | 167 // implementation of Duplicate() must be updated to copy the new member |
| 164 // accordingly. | 168 // accordingly. |
| 165 }; | 169 }; |
| 166 | 170 |
| 167 typedef std::vector<CanonicalCookie> CookieList; | 171 typedef std::vector<CanonicalCookie> CookieList; |
| 168 | 172 |
| 169 } // namespace net | 173 } // namespace net |
| 170 | 174 |
| 171 #endif // NET_COOKIES_CANONICAL_COOKIE_H_ | 175 #endif // NET_COOKIES_CANONICAL_COOKIE_H_ |
| OLD | NEW |