| 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 22 matching lines...) Expand all Loading... |
| 33 // Creates a new |CanonicalCookie| from the |cookie_line| and the | 33 // Creates a new |CanonicalCookie| from the |cookie_line| and the |
| 34 // |creation_time|. Canonicalizes and validates inputs. May return NULL if | 34 // |creation_time|. Canonicalizes and validates inputs. May return NULL if |
| 35 // an attribute value is invalid. | 35 // an attribute value is invalid. |
| 36 static std::unique_ptr<CanonicalCookie> Create( | 36 static std::unique_ptr<CanonicalCookie> Create( |
| 37 const GURL& url, | 37 const GURL& url, |
| 38 const std::string& cookie_line, | 38 const std::string& cookie_line, |
| 39 const base::Time& creation_time, | 39 const base::Time& creation_time, |
| 40 const CookieOptions& options); | 40 const CookieOptions& options); |
| 41 | 41 |
| 42 // Creates a canonical cookie from unparsed attribute values. | 42 // Creates a canonical cookie from unparsed attribute values. |
| 43 // Canonicalizes and validates inputs. May return NULL if an attribute | |
| 44 // value is invalid. | |
| 45 static std::unique_ptr<CanonicalCookie> Create(const GURL& url, | |
| 46 const std::string& name, | |
| 47 const std::string& value, | |
| 48 const std::string& domain, | |
| 49 const std::string& path, | |
| 50 const base::Time& creation, | |
| 51 const base::Time& expiration, | |
| 52 bool secure, | |
| 53 bool http_only, | |
| 54 CookieSameSite same_site, | |
| 55 CookiePriority priority); | |
| 56 | |
| 57 // Creates a canonical cookie from unparsed attribute values. | |
| 58 // It does not do any validation. | 43 // It does not do any validation. |
| 59 static std::unique_ptr<CanonicalCookie> Create(const std::string& name, | 44 static std::unique_ptr<CanonicalCookie> Create(const std::string& name, |
| 60 const std::string& value, | 45 const std::string& value, |
| 61 const std::string& domain, | 46 const std::string& domain, |
| 62 const std::string& path, | 47 const std::string& path, |
| 63 const base::Time& creation, | 48 const base::Time& creation, |
| 64 const base::Time& expiration, | 49 const base::Time& expiration, |
| 65 const base::Time& last_access, | 50 const base::Time& last_access, |
| 66 bool secure, | 51 bool secure, |
| 67 bool http_only, | 52 bool http_only, |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 115 |
| 131 // Returns true if the cookie should be included for the given request |url|. | 116 // Returns true if the cookie should be included for the given request |url|. |
| 132 // HTTP only cookies can be filter by using appropriate cookie |options|. | 117 // HTTP only cookies can be filter by using appropriate cookie |options|. |
| 133 // PLEASE NOTE that this method does not check whether a cookie is expired or | 118 // PLEASE NOTE that this method does not check whether a cookie is expired or |
| 134 // not! | 119 // not! |
| 135 bool IncludeForRequestURL(const GURL& url, | 120 bool IncludeForRequestURL(const GURL& url, |
| 136 const CookieOptions& options) const; | 121 const CookieOptions& options) const; |
| 137 | 122 |
| 138 std::string DebugString() const; | 123 std::string DebugString() const; |
| 139 | 124 |
| 140 static std::string CanonPath(const GURL& url, const ParsedCookie& pc); | 125 static std::string CanonPathWithString(const GURL& url, |
| 126 const std::string& path_string); |
| 141 | 127 |
| 142 // Returns a "null" time if expiration was unspecified or invalid. | 128 // Returns a "null" time if expiration was unspecified or invalid. |
| 143 static base::Time CanonExpiration(const ParsedCookie& pc, | 129 static base::Time CanonExpiration(const ParsedCookie& pc, |
| 144 const base::Time& current, | 130 const base::Time& current, |
| 145 const base::Time& server_time); | 131 const base::Time& server_time); |
| 146 | 132 |
| 147 // Cookie ordering methods. | 133 // Cookie ordering methods. |
| 148 | 134 |
| 149 // Returns true if the cookie is less than |other|, considering only name, | 135 // Returns true if the cookie is less than |other|, considering only name, |
| 150 // domain and path. In particular, two equivalent cookies (see IsEquivalent()) | 136 // domain and path. In particular, two equivalent cookies (see IsEquivalent()) |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 bool httponly_; | 199 bool httponly_; |
| 214 CookieSameSite same_site_; | 200 CookieSameSite same_site_; |
| 215 CookiePriority priority_; | 201 CookiePriority priority_; |
| 216 }; | 202 }; |
| 217 | 203 |
| 218 typedef std::vector<CanonicalCookie> CookieList; | 204 typedef std::vector<CanonicalCookie> CookieList; |
| 219 | 205 |
| 220 } // namespace net | 206 } // namespace net |
| 221 | 207 |
| 222 #endif // NET_COOKIES_CANONICAL_COOKIE_H_ | 208 #endif // NET_COOKIES_CANONICAL_COOKIE_H_ |
| OLD | NEW |