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

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

Issue 1773133002: SameSite: Implement 'Strict'/'Lax' attribute parsing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ios? Created 4 years, 9 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
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_PARSED_COOKIE_H_ 5 #ifndef NET_COOKIES_PARSED_COOKIE_H_
6 #define NET_COOKIES_PARSED_COOKIE_H_ 6 #define NET_COOKIES_PARSED_COOKIE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 bool HasPath() const { return path_index_ != 0; } 43 bool HasPath() const { return path_index_ != 0; }
44 const std::string& Path() const { return pairs_[path_index_].second; } 44 const std::string& Path() const { return pairs_[path_index_].second; }
45 bool HasDomain() const { return domain_index_ != 0; } 45 bool HasDomain() const { return domain_index_ != 0; }
46 const std::string& Domain() const { return pairs_[domain_index_].second; } 46 const std::string& Domain() const { return pairs_[domain_index_].second; }
47 bool HasExpires() const { return expires_index_ != 0; } 47 bool HasExpires() const { return expires_index_ != 0; }
48 const std::string& Expires() const { return pairs_[expires_index_].second; } 48 const std::string& Expires() const { return pairs_[expires_index_].second; }
49 bool HasMaxAge() const { return maxage_index_ != 0; } 49 bool HasMaxAge() const { return maxage_index_ != 0; }
50 const std::string& MaxAge() const { return pairs_[maxage_index_].second; } 50 const std::string& MaxAge() const { return pairs_[maxage_index_].second; }
51 bool IsSecure() const { return secure_index_ != 0; } 51 bool IsSecure() const { return secure_index_ != 0; }
52 bool IsHttpOnly() const { return httponly_index_ != 0; } 52 bool IsHttpOnly() const { return httponly_index_ != 0; }
53 bool IsSameSite() const { return same_site_index_ != 0; } 53 bool HasSameSite() const { return same_site_index_ != 0; }
mmenke 2016/03/11 18:09:07 Also, is this needed?
Mike West 2016/03/14 10:18:54 Not anymore. Removed.
54 CookieSameSite SameSite() const;
54 CookiePriority Priority() const; 55 CookiePriority Priority() const;
55 56
56 // Returns the number of attributes, for example, returning 2 for: 57 // Returns the number of attributes, for example, returning 2 for:
57 // "BLAH=hah; path=/; domain=.google.com" 58 // "BLAH=hah; path=/; domain=.google.com"
58 size_t NumberOfAttributes() const { return pairs_.size() - 1; } 59 size_t NumberOfAttributes() const { return pairs_.size() - 1; }
59 60
60 // These functions set the respective properties of the cookie. If the 61 // These functions set the respective properties of the cookie. If the
61 // parameters are empty, the respective properties are cleared. 62 // parameters are empty, the respective properties are cleared.
62 // The functions return false in case an error occurred. 63 // The functions return false in case an error occurred.
63 // The cookie needs to be assigned a name/value before setting the other 64 // The cookie needs to be assigned a name/value before setting the other
64 // attributes. 65 // attributes.
65 bool SetName(const std::string& name); 66 bool SetName(const std::string& name);
66 bool SetValue(const std::string& value); 67 bool SetValue(const std::string& value);
67 bool SetPath(const std::string& path); 68 bool SetPath(const std::string& path);
68 bool SetDomain(const std::string& domain); 69 bool SetDomain(const std::string& domain);
69 bool SetExpires(const std::string& expires); 70 bool SetExpires(const std::string& expires);
70 bool SetMaxAge(const std::string& maxage); 71 bool SetMaxAge(const std::string& maxage);
71 bool SetIsSecure(bool is_secure); 72 bool SetIsSecure(bool is_secure);
72 bool SetIsHttpOnly(bool is_http_only); 73 bool SetIsHttpOnly(bool is_http_only);
73 bool SetIsSameSite(bool is_same_site); 74 bool SetSameSite(const std::string& same_site);
74 bool SetPriority(const std::string& priority); 75 bool SetPriority(const std::string& priority);
75 76
76 // Returns the cookie description as it appears in a HTML response header. 77 // Returns the cookie description as it appears in a HTML response header.
77 std::string ToCookieLine() const; 78 std::string ToCookieLine() const;
78 79
79 // Returns an iterator pointing to the first terminator character found in 80 // Returns an iterator pointing to the first terminator character found in
80 // the given string. 81 // the given string.
81 static std::string::const_iterator FindFirstTerminator(const std::string& s); 82 static std::string::const_iterator FindFirstTerminator(const std::string& s);
82 83
83 // Given iterators pointing to the beginning and end of a string segment, 84 // Given iterators pointing to the beginning and end of a string segment,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 size_t httponly_index_; 143 size_t httponly_index_;
143 size_t same_site_index_; 144 size_t same_site_index_;
144 size_t priority_index_; 145 size_t priority_index_;
145 146
146 DISALLOW_COPY_AND_ASSIGN(ParsedCookie); 147 DISALLOW_COPY_AND_ASSIGN(ParsedCookie);
147 }; 148 };
148 149
149 } // namespace net 150 } // namespace net
150 151
151 #endif // NET_COOKIES_COOKIE_MONSTER_H_ 152 #endif // NET_COOKIES_COOKIE_MONSTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698