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

Unified Diff: net/cookies/parsed_cookie.cc

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/cookies/parsed_cookie.h ('k') | net/cookies/parsed_cookie_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cookies/parsed_cookie.cc
diff --git a/net/cookies/parsed_cookie.cc b/net/cookies/parsed_cookie.cc
index 5294f077f8d64191102be98743d21e034ff80308..a6c1e950689b19a40ee1ae8318c55f82fa7a95b5 100644
--- a/net/cookies/parsed_cookie.cc
+++ b/net/cookies/parsed_cookie.cc
@@ -182,6 +182,12 @@ bool ParsedCookie::IsValid() const {
return !pairs_.empty();
}
+CookieSameSite ParsedCookie::SameSite() const {
+ return (same_site_index_ == 0)
+ ? CookieSameSite::DEFAULT_MODE
+ : StringToCookieSameSite(pairs_[same_site_index_].second);
+}
+
CookiePriority ParsedCookie::Priority() const {
return (priority_index_ == 0)
? COOKIE_PRIORITY_DEFAULT
@@ -230,8 +236,8 @@ bool ParsedCookie::SetIsHttpOnly(bool is_http_only) {
return SetBool(&httponly_index_, kHttpOnlyTokenName, is_http_only);
}
-bool ParsedCookie::SetIsSameSite(bool is_same_site) {
- return SetBool(&same_site_index_, kSameSiteTokenName, is_same_site);
+bool ParsedCookie::SetSameSite(const std::string& is_same_site) {
+ return SetString(&same_site_index_, kSameSiteTokenName, is_same_site);
}
bool ParsedCookie::SetPriority(const std::string& priority) {
@@ -244,8 +250,7 @@ std::string ParsedCookie::ToCookieLine() const {
if (!out.empty())
out.append("; ");
out.append(it->first);
- if (it->first != kSecureTokenName && it->first != kHttpOnlyTokenName &&
- it->first != kSameSiteTokenName) {
+ if (it->first != kSecureTokenName && it->first != kHttpOnlyTokenName) {
out.append("=");
out.append(it->second);
}
« no previous file with comments | « net/cookies/parsed_cookie.h ('k') | net/cookies/parsed_cookie_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698