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
3 // found in the LICENSE file.
5 // Brought to you by number 42.
7 #ifndef NET_COOKIES_COOKIE_OPTIONS_H_
8 #define NET_COOKIES_COOKIE_OPTIONS_H_
10 #include "base/time/time.h"
11 #include "net/base/net_export.h"
16 class NET_EXPORT CookieOptions
{
18 // Default is to exclude httponly completely, and exclude first-party from
19 // being read, which means:
20 // - reading operations will not return httponly or first-party cookies.
21 // - writing operations will not write httponly cookies (first-party will be
24 // If a first-party URL is set, then first-party cookies which match that URL
28 void set_exclude_httponly() { exclude_httponly_
= true; }
29 void set_include_httponly() { exclude_httponly_
= false; }
30 bool exclude_httponly() const { return exclude_httponly_
; }
32 void set_include_first_party_only() { include_first_party_only_
= true; }
33 bool include_first_party_only() const { return include_first_party_only_
; }
35 void set_first_party_url(const GURL
& url
) { first_party_url_
= url
; }
36 GURL
first_party_url() const { return first_party_url_
; }
38 // |server_time| indicates what the server sending us the Cookie thought the
39 // current time was when the cookie was produced. This is used to adjust for
40 // clock skew between server and host.
41 void set_server_time(const base::Time
& server_time
) {
42 server_time_
= server_time
;
44 bool has_server_time() const { return !server_time_
.is_null(); }
45 base::Time
server_time() const { return server_time_
; }
48 bool exclude_httponly_
;
49 bool include_first_party_only_
;
50 GURL first_party_url_
;
51 base::Time server_time_
;
56 #endif // NET_COOKIES_COOKIE_OPTIONS_H_