Move remaining resources from java_staging/res to java/res.
[chromium-blink-merge.git] / net / cookies / cookie_options.h
bloba7ed5a9aac64eca34e4223799a698fdd5581ee43
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 "url/gurl.h"
12 namespace net {
14 class CookieOptions {
15 public:
16 // Default is to exclude httponly completely, and exclude first-party from
17 // being read, which means:
18 // - reading operations will not return httponly or first-party cookies.
19 // - writing operations will not write httponly cookies (first-party will be
20 // written).
22 // If a first-party URL is set, then first-party cookies which match that URL
23 // will be returned.
24 CookieOptions()
25 : exclude_httponly_(true),
26 include_first_party_only_(false),
27 server_time_() {}
29 void set_exclude_httponly() { exclude_httponly_ = true; }
30 void set_include_httponly() { exclude_httponly_ = false; }
31 bool exclude_httponly() const { return exclude_httponly_; }
33 void set_include_first_party_only() { include_first_party_only_ = true; }
34 bool include_first_party_only() const { return include_first_party_only_; }
36 void set_first_party_url(const GURL& url) { first_party_url_ = url; }
37 GURL first_party_url() const { return first_party_url_; }
39 // |server_time| indicates what the server sending us the Cookie thought the
40 // current time was when the cookie was produced. This is used to adjust for
41 // clock skew between server and host.
42 void set_server_time(const base::Time& server_time) {
43 server_time_ = server_time;
45 bool has_server_time() const { return !server_time_.is_null(); }
46 base::Time server_time() const { return server_time_; }
48 private:
49 bool exclude_httponly_;
50 bool include_first_party_only_;
51 GURL first_party_url_;
52 base::Time server_time_;
55 } // namespace net
57 #endif // NET_COOKIES_COOKIE_OPTIONS_H_