Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(343)

Side by Side Diff: net/cookies/canonical_cookie.h

Issue 2861063003: Remove dangerous CanonicalCookie::Create method. (Closed)
Patch Set: Use creation_time for last_access_time as per Elly's suggestion. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ios/net/cookies/cookie_store_ios_test_util.mm ('k') | net/cookies/canonical_cookie.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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| must not be empty.
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
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);
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
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_
OLDNEW
« no previous file with comments | « ios/net/cookies/cookie_store_ios_test_util.mm ('k') | net/cookies/canonical_cookie.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698