summaryrefslogtreecommitdiffstats
path: root/webkit/glue/webcookie.h
blob: e2f11e2bde6f59593e3911e6c0803de4b6a7e372 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// A struct for managing data being dropped on a webview.  This represents a
// union of all the types of data that can be dropped in a platform neutral
// way.

#ifndef WEBKIT_GLUE_WEBCOOKIE_H_
#define WEBKIT_GLUE_WEBCOOKIE_H_

#include "net/base/cookie_monster.h"

namespace webkit_glue {

struct WebCookie {

  WebCookie(const std::string& name, const std::string& value,
            const std::string& domain, const std::string& path, double expires,
            bool http_only, bool secure, bool session)
      : name(name),
        value(value),
        domain(domain),
        path(path),
        expires(expires),
        http_only(http_only),
        secure(secure),
        session(session) {
  }

  explicit WebCookie(const net::CookieMonster::CanonicalCookie& c)
      : name(c.Name()),
        value(c.Value()),
        domain(c.Domain()),
        path(c.Path()),
        expires(c.ExpiryDate().ToDoubleT() * 1000),
        http_only(c.IsHttpOnly()),
        secure(c.IsSecure()),
        session(!c.IsPersistent()) {
  }

  // For default constructions.
  WebCookie()
      : expires(0),
        http_only(false),
        secure(false),
        session(false) {
  }

  // Cookie name.
  std::string name;

  // Cookie value.
  std::string value;

  // Cookie domain.
  std::string domain;

  // Cookie path.
  std::string path;

  // Cookie expires param if any.
  double expires;

  // Cookie HTTPOnly param.
  bool http_only;

  // Cookie secure param.
  bool secure;

  // Session cookie flag.
  bool session;
};

}  // namespace webkit_glue

#endif  // WEBKIT_GLUE_WEBCOOKIE_H_