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

Unified Diff: net/cookies/cookie_options.h

Issue 876973003: Implement the "first-party-only" cookie flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: FirstPartyOnly. Created 5 years, 10 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/cookie_monster_unittest.cc ('k') | net/cookies/parsed_cookie.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cookies/cookie_options.h
diff --git a/net/cookies/cookie_options.h b/net/cookies/cookie_options.h
index 975b8c8fd93ad7c3e4c29e9d5139d1239957f313..a7ed5a9aac64eca34e4223799a698fdd5581ee43 100644
--- a/net/cookies/cookie_options.h
+++ b/net/cookies/cookie_options.h
@@ -7,19 +7,35 @@
#ifndef NET_COOKIES_COOKIE_OPTIONS_H_
#define NET_COOKIES_COOKIE_OPTIONS_H_
+#include "url/gurl.h"
+
namespace net {
class CookieOptions {
public:
- // Default is to exclude httponly, which means:
- // - reading operations will not return httponly cookies.
- // - writing operations will not write httponly cookies.
- CookieOptions() : exclude_httponly_(true), server_time_() {}
+ // Default is to exclude httponly completely, and exclude first-party from
+ // being read, which means:
+ // - reading operations will not return httponly or first-party cookies.
+ // - writing operations will not write httponly cookies (first-party will be
+ // written).
+ //
+ // If a first-party URL is set, then first-party cookies which match that URL
+ // will be returned.
+ CookieOptions()
+ : exclude_httponly_(true),
+ include_first_party_only_(false),
+ server_time_() {}
void set_exclude_httponly() { exclude_httponly_ = true; }
void set_include_httponly() { exclude_httponly_ = false; }
bool exclude_httponly() const { return exclude_httponly_; }
+ void set_include_first_party_only() { include_first_party_only_ = true; }
+ bool include_first_party_only() const { return include_first_party_only_; }
+
+ void set_first_party_url(const GURL& url) { first_party_url_ = url; }
+ GURL first_party_url() const { return first_party_url_; }
+
// |server_time| indicates what the server sending us the Cookie thought the
// current time was when the cookie was produced. This is used to adjust for
// clock skew between server and host.
@@ -31,8 +47,11 @@ class CookieOptions {
private:
bool exclude_httponly_;
+ bool include_first_party_only_;
+ GURL first_party_url_;
base::Time server_time_;
};
+
} // namespace net
#endif // NET_COOKIES_COOKIE_OPTIONS_H_
« no previous file with comments | « net/cookies/cookie_monster_unittest.cc ('k') | net/cookies/parsed_cookie.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698