OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // A struct for managing data being dropped on a webview. This represents a | 5 // A struct for managing data being dropped on a webview. This represents a |
6 // union of all the types of data that can be dropped in a platform neutral | 6 // union of all the types of data that can be dropped in a platform neutral |
7 // way. | 7 // way. |
8 | 8 |
9 #ifndef WEBKIT_GLUE_WEBCOOKIE_H_ | 9 #ifndef WEBKIT_GLUE_WEBCOOKIE_H_ |
10 #define WEBKIT_GLUE_WEBCOOKIE_H_ | 10 #define WEBKIT_GLUE_WEBCOOKIE_H_ |
11 | 11 |
12 #include "net/base/cookie_monster.h" | 12 #include "net/base/cookie_monster.h" |
13 | 13 |
14 namespace webkit_glue { | 14 namespace webkit_glue { |
15 | 15 |
16 struct WebCookie { | 16 struct WebCookie { |
17 | 17 WebCookie(); |
| 18 explicit WebCookie(const net::CookieMonster::CanonicalCookie& c); |
18 WebCookie(const std::string& name, const std::string& value, | 19 WebCookie(const std::string& name, const std::string& value, |
19 const std::string& domain, const std::string& path, double expires, | 20 const std::string& domain, const std::string& path, double expires, |
20 bool http_only, bool secure, bool session) | 21 bool http_only, bool secure, bool session); |
21 : name(name), | 22 ~WebCookie(); |
22 value(value), | |
23 domain(domain), | |
24 path(path), | |
25 expires(expires), | |
26 http_only(http_only), | |
27 secure(secure), | |
28 session(session) { | |
29 } | |
30 | |
31 explicit WebCookie(const net::CookieMonster::CanonicalCookie& c) | |
32 : name(c.Name()), | |
33 value(c.Value()), | |
34 domain(c.Domain()), | |
35 path(c.Path()), | |
36 expires(c.ExpiryDate().ToDoubleT() * 1000), | |
37 http_only(c.IsHttpOnly()), | |
38 secure(c.IsSecure()), | |
39 session(!c.IsPersistent()) { | |
40 } | |
41 | |
42 // For default constructions. | |
43 WebCookie() | |
44 : expires(0), | |
45 http_only(false), | |
46 secure(false), | |
47 session(false) { | |
48 } | |
49 | 23 |
50 // Cookie name. | 24 // Cookie name. |
51 std::string name; | 25 std::string name; |
52 | 26 |
53 // Cookie value. | 27 // Cookie value. |
54 std::string value; | 28 std::string value; |
55 | 29 |
56 // Cookie domain. | 30 // Cookie domain. |
57 std::string domain; | 31 std::string domain; |
58 | 32 |
59 // Cookie path. | 33 // Cookie path. |
60 std::string path; | 34 std::string path; |
61 | 35 |
62 // Cookie expires param if any. | 36 // Cookie expires param if any. |
63 double expires; | 37 double expires; |
64 | 38 |
65 // Cookie HTTPOnly param. | 39 // Cookie HTTPOnly param. |
66 bool http_only; | 40 bool http_only; |
67 | 41 |
68 // Cookie secure param. | 42 // Cookie secure param. |
69 bool secure; | 43 bool secure; |
70 | 44 |
71 // Session cookie flag. | 45 // Session cookie flag. |
72 bool session; | 46 bool session; |
73 }; | 47 }; |
74 | 48 |
75 } // namespace webkit_glue | 49 } // namespace webkit_glue |
76 | 50 |
77 #endif // WEBKIT_GLUE_WEBCOOKIE_H_ | 51 #endif // WEBKIT_GLUE_WEBCOOKIE_H_ |
OLD | NEW |