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 #ifndef NET_COOKIES_CANONICAL_COOKIE_H_ | 5 #ifndef NET_COOKIES_CANONICAL_COOKIE_H_ |
6 #define NET_COOKIES_CANONICAL_COOKIE_H_ | 6 #define NET_COOKIES_CANONICAL_COOKIE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
| 12 #include "base/memory/scoped_ptr.h" |
12 #include "base/time/time.h" | 13 #include "base/time/time.h" |
13 #include "net/base/net_export.h" | 14 #include "net/base/net_export.h" |
14 #include "net/cookies/cookie_constants.h" | 15 #include "net/cookies/cookie_constants.h" |
15 #include "net/cookies/cookie_options.h" | 16 #include "net/cookies/cookie_options.h" |
16 | 17 |
17 class GURL; | 18 class GURL; |
18 | 19 |
19 namespace net { | 20 namespace net { |
20 | 21 |
21 class ParsedCookie; | 22 class ParsedCookie; |
(...skipping 23 matching lines...) Expand all Loading... |
45 // in which pre-validation of the ParsedCookie has not been done. | 46 // in which pre-validation of the ParsedCookie has not been done. |
46 CanonicalCookie(const GURL& url, const ParsedCookie& pc); | 47 CanonicalCookie(const GURL& url, const ParsedCookie& pc); |
47 | 48 |
48 ~CanonicalCookie(); | 49 ~CanonicalCookie(); |
49 | 50 |
50 // Supports the default copy constructor. | 51 // Supports the default copy constructor. |
51 | 52 |
52 // Creates a new |CanonicalCookie| from the |cookie_line| and the | 53 // Creates a new |CanonicalCookie| from the |cookie_line| and the |
53 // |creation_time|. Canonicalizes and validates inputs. May return NULL if | 54 // |creation_time|. Canonicalizes and validates inputs. May return NULL if |
54 // an attribute value is invalid. | 55 // an attribute value is invalid. |
55 static CanonicalCookie* Create(const GURL& url, | 56 static scoped_ptr<CanonicalCookie> Create(const GURL& url, |
56 const std::string& cookie_line, | 57 const std::string& cookie_line, |
57 const base::Time& creation_time, | 58 const base::Time& creation_time, |
58 const CookieOptions& options); | 59 const CookieOptions& options); |
59 | 60 |
60 // Creates a canonical cookie from unparsed attribute values. | 61 // Creates a canonical cookie from unparsed attribute values. |
61 // Canonicalizes and validates inputs. May return NULL if an attribute | 62 // Canonicalizes and validates inputs. May return NULL if an attribute |
62 // value is invalid. | 63 // value is invalid. |
63 static CanonicalCookie* Create(const GURL& url, | 64 static scoped_ptr<CanonicalCookie> Create(const GURL& url, |
64 const std::string& name, | 65 const std::string& name, |
65 const std::string& value, | 66 const std::string& value, |
66 const std::string& domain, | 67 const std::string& domain, |
67 const std::string& path, | 68 const std::string& path, |
68 const base::Time& creation, | 69 const base::Time& creation, |
69 const base::Time& expiration, | 70 const base::Time& expiration, |
70 bool secure, | 71 bool secure, |
71 bool http_only, | 72 bool http_only, |
72 bool first_party_only, | 73 bool first_party_only, |
73 bool enforce_strict_secure, | 74 bool enforce_strict_secure, |
74 CookiePriority priority); | 75 CookiePriority priority); |
75 | 76 |
76 const GURL& Source() const { return source_; } | 77 const GURL& Source() const { return source_; } |
77 const std::string& Name() const { return name_; } | 78 const std::string& Name() const { return name_; } |
78 const std::string& Value() const { return value_; } | 79 const std::string& Value() const { return value_; } |
79 const std::string& Domain() const { return domain_; } | 80 const std::string& Domain() const { return domain_; } |
80 const std::string& Path() const { return path_; } | 81 const std::string& Path() const { return path_; } |
81 const base::Time& CreationDate() const { return creation_date_; } | 82 const base::Time& CreationDate() const { return creation_date_; } |
82 const base::Time& LastAccessDate() const { return last_access_date_; } | 83 const base::Time& LastAccessDate() const { return last_access_date_; } |
83 bool IsPersistent() const { return !expiry_date_.is_null(); } | 84 bool IsPersistent() const { return !expiry_date_.is_null(); } |
84 const base::Time& ExpiryDate() const { return expiry_date_; } | 85 const base::Time& ExpiryDate() const { return expiry_date_; } |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 bool httponly_; | 206 bool httponly_; |
206 bool first_party_only_; | 207 bool first_party_only_; |
207 CookiePriority priority_; | 208 CookiePriority priority_; |
208 }; | 209 }; |
209 | 210 |
210 typedef std::vector<CanonicalCookie> CookieList; | 211 typedef std::vector<CanonicalCookie> CookieList; |
211 | 212 |
212 } // namespace net | 213 } // namespace net |
213 | 214 |
214 #endif // NET_COOKIES_CANONICAL_COOKIE_H_ | 215 #endif // NET_COOKIES_CANONICAL_COOKIE_H_ |
OLD | NEW |