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

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: mmenke@ 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
« no previous file with comments | « net/cookies/cookie_store_unittest.h ('k') | net/cookies/parsed_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_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 CookieSameSite SameSite() const;
54 CookiePriority Priority() const; 54 CookiePriority Priority() const;
55 55
56 // Returns the number of attributes, for example, returning 2 for: 56 // Returns the number of attributes, for example, returning 2 for:
57 // "BLAH=hah; path=/; domain=.google.com" 57 // "BLAH=hah; path=/; domain=.google.com"
58 size_t NumberOfAttributes() const { return pairs_.size() - 1; } 58 size_t NumberOfAttributes() const { return pairs_.size() - 1; }
59 59
60 // These functions set the respective properties of the cookie. If the 60 // These functions set the respective properties of the cookie. If the
61 // parameters are empty, the respective properties are cleared. 61 // parameters are empty, the respective properties are cleared.
62 // The functions return false in case an error occurred. 62 // The functions return false in case an error occurred.
63 // The cookie needs to be assigned a name/value before setting the other 63 // The cookie needs to be assigned a name/value before setting the other
64 // attributes. 64 // attributes.
65 bool SetName(const std::string& name); 65 bool SetName(const std::string& name);
66 bool SetValue(const std::string& value); 66 bool SetValue(const std::string& value);
67 bool SetPath(const std::string& path); 67 bool SetPath(const std::string& path);
68 bool SetDomain(const std::string& domain); 68 bool SetDomain(const std::string& domain);
69 bool SetExpires(const std::string& expires); 69 bool SetExpires(const std::string& expires);
70 bool SetMaxAge(const std::string& maxage); 70 bool SetMaxAge(const std::string& maxage);
71 bool SetIsSecure(bool is_secure); 71 bool SetIsSecure(bool is_secure);
72 bool SetIsHttpOnly(bool is_http_only); 72 bool SetIsHttpOnly(bool is_http_only);
73 bool SetIsSameSite(bool is_same_site); 73 bool SetSameSite(const std::string& same_site);
74 bool SetPriority(const std::string& priority); 74 bool SetPriority(const std::string& priority);
75 75
76 // Returns the cookie description as it appears in a HTML response header. 76 // Returns the cookie description as it appears in a HTML response header.
77 std::string ToCookieLine() const; 77 std::string ToCookieLine() const;
78 78
79 // Returns an iterator pointing to the first terminator character found in 79 // Returns an iterator pointing to the first terminator character found in
80 // the given string. 80 // the given string.
81 static std::string::const_iterator FindFirstTerminator(const std::string& s); 81 static std::string::const_iterator FindFirstTerminator(const std::string& s);
82 82
83 // Given iterators pointing to the beginning and end of a string segment, 83 // 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_; 142 size_t httponly_index_;
143 size_t same_site_index_; 143 size_t same_site_index_;
144 size_t priority_index_; 144 size_t priority_index_;
145 145
146 DISALLOW_COPY_AND_ASSIGN(ParsedCookie); 146 DISALLOW_COPY_AND_ASSIGN(ParsedCookie);
147 }; 147 };
148 148
149 } // namespace net 149 } // namespace net
150 150
151 #endif // NET_COOKIES_COOKIE_MONSTER_H_ 151 #endif // NET_COOKIES_COOKIE_MONSTER_H_
OLDNEW
« no previous file with comments | « net/cookies/cookie_store_unittest.h ('k') | net/cookies/parsed_cookie.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698