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