Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 // Brought to you by number 42. | 5 // Brought to you by number 42. |
| 6 | 6 |
| 7 #ifndef NET_COOKIES_COOKIE_OPTIONS_H_ | 7 #ifndef NET_COOKIES_COOKIE_OPTIONS_H_ |
| 8 #define NET_COOKIES_COOKIE_OPTIONS_H_ | 8 #define NET_COOKIES_COOKIE_OPTIONS_H_ |
| 9 | 9 |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 11 #include "net/base/net_export.h" | 11 #include "net/base/net_export.h" |
| 12 #include "url/gurl.h" | 12 #include "url/gurl.h" |
| 13 #include "url/origin.h" | 13 #include "url/origin.h" |
|
mmenke
2015/10/21 15:36:38
Don't need the last two of these any more.
| |
| 14 | 14 |
| 15 namespace net { | 15 namespace net { |
| 16 | 16 |
| 17 class NET_EXPORT CookieOptions { | 17 class NET_EXPORT CookieOptions { |
| 18 public: | 18 public: |
| 19 // Default is to exclude httponly completely, and exclude first-party from | 19 // Default is to exclude httponly completely, and exclude first-party from |
| 20 // being read, which means: | 20 // being read, which means: |
| 21 // - reading operations will not return httponly or first-party cookies. | 21 // - reading operations will not return httponly or first-party cookies. |
| 22 // - writing operations will not write httponly cookies (first-party will be | 22 // - writing operations will not write httponly cookies (first-party will be |
| 23 // written). | 23 // written). |
| 24 // | 24 // |
| 25 // If a first-party URL is set, then first-party cookies which match that URL | 25 // If a first-party URL is set, then first-party cookies which match that URL |
| 26 // will be returned. | 26 // will be returned. |
| 27 CookieOptions(); | 27 CookieOptions(); |
| 28 | 28 |
| 29 void set_exclude_httponly() { exclude_httponly_ = true; } | 29 void set_exclude_httponly() { exclude_httponly_ = true; } |
| 30 void set_include_httponly() { exclude_httponly_ = false; } | 30 void set_include_httponly() { exclude_httponly_ = false; } |
| 31 bool exclude_httponly() const { return exclude_httponly_; } | 31 bool exclude_httponly() const { return exclude_httponly_; } |
| 32 | 32 |
| 33 void set_include_first_party_only() { include_first_party_only_ = true; } | 33 void set_include_first_party_only() { include_first_party_only_ = true; } |
| 34 bool include_first_party_only() const { return include_first_party_only_; } | 34 bool include_first_party_only() const { return include_first_party_only_; } |
|
mmenke
2015/10/21 15:36:38
Can we rename this to "include_first_party_only_co
Mike West
2015/10/22 13:17:02
Sure. Done.
| |
| 35 | 35 |
| 36 void set_first_party(const url::Origin& origin) { first_party_ = origin; } | |
| 37 const url::Origin& first_party() const { return first_party_; } | |
| 38 | |
| 39 // TODO(estark): Remove once we decide whether to ship cookie | 36 // TODO(estark): Remove once we decide whether to ship cookie |
| 40 // prefixes. https://crbug.com/541511 | 37 // prefixes. https://crbug.com/541511 |
| 41 void set_enforce_prefixes() { enforce_prefixes_ = true; } | 38 void set_enforce_prefixes() { enforce_prefixes_ = true; } |
| 42 bool enforce_prefixes() const { return enforce_prefixes_; } | 39 bool enforce_prefixes() const { return enforce_prefixes_; } |
| 43 | 40 |
| 44 // |server_time| indicates what the server sending us the Cookie thought the | 41 // |server_time| indicates what the server sending us the Cookie thought the |
| 45 // current time was when the cookie was produced. This is used to adjust for | 42 // current time was when the cookie was produced. This is used to adjust for |
| 46 // clock skew between server and host. | 43 // clock skew between server and host. |
| 47 void set_server_time(const base::Time& server_time) { | 44 void set_server_time(const base::Time& server_time) { |
| 48 server_time_ = server_time; | 45 server_time_ = server_time; |
| 49 } | 46 } |
| 50 bool has_server_time() const { return !server_time_.is_null(); } | 47 bool has_server_time() const { return !server_time_.is_null(); } |
| 51 base::Time server_time() const { return server_time_; } | 48 base::Time server_time() const { return server_time_; } |
| 52 | 49 |
| 53 private: | 50 private: |
| 54 bool exclude_httponly_; | 51 bool exclude_httponly_; |
| 55 bool include_first_party_only_; | 52 bool include_first_party_only_; |
| 56 url::Origin first_party_; | |
| 57 bool enforce_prefixes_; | 53 bool enforce_prefixes_; |
| 58 base::Time server_time_; | 54 base::Time server_time_; |
| 59 }; | 55 }; |
| 60 | 56 |
| 61 } // namespace net | 57 } // namespace net |
| 62 | 58 |
| 63 #endif // NET_COOKIES_COOKIE_OPTIONS_H_ | 59 #endif // NET_COOKIES_COOKIE_OPTIONS_H_ |
| OLD | NEW |