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

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

Issue 1615773005: Rename first-party-only cookies to same-site cookies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Missed a few. Created 4 years, 11 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 IsFirstPartyOnly() const { return firstpartyonly_index_ != 0; } 53 bool IsSameSite() const { return samesite_index_ != 0; }
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 SetIsFirstPartyOnly(bool is_first_party_only); 73 bool SetIsSameSite(bool is_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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 // These will default to 0, but that should never be valid since the 133 // These will default to 0, but that should never be valid since the
134 // 0th index is the user supplied token/value, not an attribute. 134 // 0th index is the user supplied token/value, not an attribute.
135 // We're really never going to have more than like 8 attributes, so we 135 // We're really never going to have more than like 8 attributes, so we
136 // could fit these into 3 bits each if we're worried about size... 136 // could fit these into 3 bits each if we're worried about size...
137 size_t path_index_; 137 size_t path_index_;
138 size_t domain_index_; 138 size_t domain_index_;
139 size_t expires_index_; 139 size_t expires_index_;
140 size_t maxage_index_; 140 size_t maxage_index_;
141 size_t secure_index_; 141 size_t secure_index_;
142 size_t httponly_index_; 142 size_t httponly_index_;
143 size_t firstpartyonly_index_; 143 size_t samesite_index_;
mmenke 2016/01/25 18:47:10 same_site
Mike West 2016/01/26 11:05:45 Done.
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

Powered by Google App Engine
This is Rietveld 408576698