Chromium Code Reviews| 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 | 43 // It does not do any canonicalization. |
| 44 // value is invalid. | 44 // |name| and |path| may not be empty. |
|
mmenke
2017/05/09 16:51:09
I think this is a MUST and not a MAY. :)
Randy Smith (Not in Mondays)
2017/05/09 23:52:35
Done :-}.
| |
| 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. | |
| 59 static std::unique_ptr<CanonicalCookie> Create(const std::string& name, | 45 static std::unique_ptr<CanonicalCookie> Create(const std::string& name, |
| 60 const std::string& value, | 46 const std::string& value, |
| 61 const std::string& domain, | 47 const std::string& domain, |
| 62 const std::string& path, | 48 const std::string& path, |
| 63 const base::Time& creation, | 49 const base::Time& creation, |
| 64 const base::Time& expiration, | 50 const base::Time& expiration, |
| 65 const base::Time& last_access, | 51 const base::Time& last_access, |
| 66 bool secure, | 52 bool secure, |
| 67 bool http_only, | 53 bool http_only, |
| 68 CookieSameSite same_site, | 54 CookieSameSite same_site, |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 130 | 116 |
| 131 // Returns true if the cookie should be included for the given request |url|. | 117 // 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|. | 118 // 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 | 119 // PLEASE NOTE that this method does not check whether a cookie is expired or |
| 134 // not! | 120 // not! |
| 135 bool IncludeForRequestURL(const GURL& url, | 121 bool IncludeForRequestURL(const GURL& url, |
| 136 const CookieOptions& options) const; | 122 const CookieOptions& options) const; |
| 137 | 123 |
| 138 std::string DebugString() const; | 124 std::string DebugString() const; |
| 139 | 125 |
| 140 static std::string CanonPath(const GURL& url, const ParsedCookie& pc); | 126 static std::string CanonPathWithString(const GURL& url, |
| 127 const std::string& path_string); | |
|
mmenke
2017/05/09 16:51:09
Does this need to be public (Or even outside a pri
Randy Smith (Not in Mondays)
2017/05/09 23:52:35
It's used in cookie_monster.cc. We could look int
| |
| 141 | 128 |
| 142 // Returns a "null" time if expiration was unspecified or invalid. | 129 // Returns a "null" time if expiration was unspecified or invalid. |
| 143 static base::Time CanonExpiration(const ParsedCookie& pc, | 130 static base::Time CanonExpiration(const ParsedCookie& pc, |
| 144 const base::Time& current, | 131 const base::Time& current, |
| 145 const base::Time& server_time); | 132 const base::Time& server_time); |
| 146 | 133 |
| 147 // Cookie ordering methods. | 134 // Cookie ordering methods. |
| 148 | 135 |
| 149 // Returns true if the cookie is less than |other|, considering only name, | 136 // Returns true if the cookie is less than |other|, considering only name, |
| 150 // domain and path. In particular, two equivalent cookies (see IsEquivalent()) | 137 // 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_; | 200 bool httponly_; |
| 214 CookieSameSite same_site_; | 201 CookieSameSite same_site_; |
| 215 CookiePriority priority_; | 202 CookiePriority priority_; |
| 216 }; | 203 }; |
| 217 | 204 |
| 218 typedef std::vector<CanonicalCookie> CookieList; | 205 typedef std::vector<CanonicalCookie> CookieList; |
| 219 | 206 |
| 220 } // namespace net | 207 } // namespace net |
| 221 | 208 |
| 222 #endif // NET_COOKIES_CANONICAL_COOKIE_H_ | 209 #endif // NET_COOKIES_CANONICAL_COOKIE_H_ |
| OLD | NEW |