Home | History | Annotate | Download | only in base
      1 // Copyright (c) 2006-2009 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.
      4 
      5 // Brought to you by number 42.
      6 
      7 #ifndef NET_BASE_COOKIE_OPTIONS_H_
      8 #define NET_BASE_COOKIE_OPTIONS_H_
      9 #pragma once
     10 
     11 namespace net {
     12 
     13 class CookieOptions {
     14  public:
     15   // Default is to exclude httponly, which means:
     16   // - reading operations will not return httponly cookies.
     17   // - writing operations will not write httponly cookies.
     18   CookieOptions()
     19       : exclude_httponly_(true),
     20         force_session_(false) {
     21   }
     22 
     23   void set_exclude_httponly() { exclude_httponly_ = true; }
     24   void set_include_httponly() { exclude_httponly_ = false; }
     25   bool exclude_httponly() const { return exclude_httponly_; }
     26 
     27   // Forces a cookie to be saved as a session cookie. If the expiration time of
     28   // the cookie is in the past, i.e. the cookie would end up being deleted, this
     29   // option is ignored. See CookieMonsterTest.ForceSessionOnly.
     30   void set_force_session() { force_session_ = true; }
     31   bool force_session() const { return force_session_; }
     32 
     33  private:
     34   bool exclude_httponly_;
     35   bool force_session_;
     36 };
     37 }  // namespace net
     38 
     39 #endif  // NET_BASE_COOKIE_OPTIONS_H_
     40 
     41