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

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

Issue 2898953008: Implement and test CanonicalCookie::IsCanonical() (Closed)
Patch Set: Removed vestigial code. Created 3 years, 6 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_unittest.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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 // Returns true if the cookie is less than |other|, considering only name, 137 // Returns true if the cookie is less than |other|, considering only name,
138 // domain and path. In particular, two equivalent cookies (see IsEquivalent()) 138 // domain and path. In particular, two equivalent cookies (see IsEquivalent())
139 // are identical for PartialCompare(). 139 // are identical for PartialCompare().
140 bool PartialCompare(const CanonicalCookie& other) const; 140 bool PartialCompare(const CanonicalCookie& other) const;
141 141
142 // Returns true if the cookie is less than |other|, considering all fields. 142 // Returns true if the cookie is less than |other|, considering all fields.
143 // FullCompare() is consistent with PartialCompare(): cookies sorted using 143 // FullCompare() is consistent with PartialCompare(): cookies sorted using
144 // FullCompare() are also sorted with respect to PartialCompare(). 144 // FullCompare() are also sorted with respect to PartialCompare().
145 bool FullCompare(const CanonicalCookie& other) const; 145 bool FullCompare(const CanonicalCookie& other) const;
146 146
147 // Return whether this object is a valid CanonicalCookie(). Invalid
148 // cookies may be constructed by the detailed constructor.
149 // A cookie is considered canonical if-and-only-if:
150 // * It can be created by CanonicalCookie::Create, or
151 // * It is identical to a cookie created by CanonicalCookie::Create except
152 // that the creation time is null, or
153 // * It can be derived from a cookie created by CanonicalCookie::Create by
154 // entry into and retrieval from a cookie store (specifically, this means
155 // by the setting of an creation time in place of a null creation time, and
156 // the setting of a last access time).
157 // An additional requirement on a CanonicalCookie is that if the last
158 // access time is non-null, the creation time must also be non-null and
159 // greater than the last access time.
160 bool IsCanonical() const;
161
147 private: 162 private:
148 FRIEND_TEST_ALL_PREFIXES(CanonicalCookieTest, TestPrefixHistograms); 163 FRIEND_TEST_ALL_PREFIXES(CanonicalCookieTest, TestPrefixHistograms);
149 164
150 // The special cookie prefixes as defined in 165 // The special cookie prefixes as defined in
151 // https://tools.ietf.org/html/draft-west-cookie-prefixes 166 // https://tools.ietf.org/html/draft-west-cookie-prefixes
152 // 167 //
153 // This enum is being histogrammed; do not reorder or remove values. 168 // This enum is being histogrammed; do not reorder or remove values.
154 enum CookiePrefix { 169 enum CookiePrefix {
155 COOKIE_PREFIX_NONE = 0, 170 COOKIE_PREFIX_NONE = 0,
156 COOKIE_PREFIX_SECURE, 171 COOKIE_PREFIX_SECURE,
(...skipping 28 matching lines...) Expand all
185 bool httponly_; 200 bool httponly_;
186 CookieSameSite same_site_; 201 CookieSameSite same_site_;
187 CookiePriority priority_; 202 CookiePriority priority_;
188 }; 203 };
189 204
190 typedef std::vector<CanonicalCookie> CookieList; 205 typedef std::vector<CanonicalCookie> CookieList;
191 206
192 } // namespace net 207 } // namespace net
193 208
194 #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_unittest.mm ('k') | net/cookies/canonical_cookie.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698