| 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 <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 bool secure, | 40 bool secure, |
| 41 bool httponly, | 41 bool httponly, |
| 42 CookieSameSite same_site, | 42 CookieSameSite same_site, |
| 43 CookiePriority priority); | 43 CookiePriority priority); |
| 44 | 44 |
| 45 ~CanonicalCookie(); | 45 ~CanonicalCookie(); |
| 46 | 46 |
| 47 // Supports the default copy constructor. | 47 // Supports the default copy constructor. |
| 48 | 48 |
| 49 // Creates a new |CanonicalCookie| from the |cookie_line| and the | 49 // Creates a new |CanonicalCookie| from the |cookie_line| and the |
| 50 // |creation_time|. Canonicalizes and validates inputs. May return NULL if | 50 // |creation_time|. Canonicalizes and validates inputs. May return NULL if |
| 51 // an attribute value is invalid. | 51 // an attribute value is invalid. |creation_time| may not be null. |
| 52 static std::unique_ptr<CanonicalCookie> Create( | 52 static std::unique_ptr<CanonicalCookie> Create( |
| 53 const GURL& url, | 53 const GURL& url, |
| 54 const std::string& cookie_line, | 54 const std::string& cookie_line, |
| 55 const base::Time& creation_time, | 55 const base::Time& creation_time, |
| 56 const CookieOptions& options); | 56 const CookieOptions& options); |
| 57 | 57 |
| 58 const std::string& Name() const { return name_; } | 58 const std::string& Name() const { return name_; } |
| 59 const std::string& Value() const { return value_; } | 59 const std::string& Value() const { return value_; } |
| 60 const std::string& Domain() const { return domain_; } | 60 const std::string& Domain() const { return domain_; } |
| 61 const std::string& Path() const { return path_; } | 61 const std::string& Path() const { return path_; } |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 // Returns true if the cookie is less than |other|, considering only name, | 137 // Returns true if the cookie is less than |other|, considering only name, |
| 138 // domain and path. In particular, two equivalent cookies (see IsEquivalent()) | 138 // domain and path. In particular, two equivalent cookies (see IsEquivalent()) |
| 139 // are identical for PartialCompare(). | 139 // are identical for PartialCompare(). |
| 140 bool PartialCompare(const CanonicalCookie& other) const; | 140 bool PartialCompare(const CanonicalCookie& other) const; |
| 141 | 141 |
| 142 // Returns true if the cookie is less than |other|, considering all fields. | 142 // Returns true if the cookie is less than |other|, considering all fields. |
| 143 // FullCompare() is consistent with PartialCompare(): cookies sorted using | 143 // FullCompare() is consistent with PartialCompare(): cookies sorted using |
| 144 // FullCompare() are also sorted with respect to PartialCompare(). | 144 // FullCompare() are also sorted with respect to PartialCompare(). |
| 145 bool FullCompare(const CanonicalCookie& other) const; | 145 bool FullCompare(const CanonicalCookie& other) const; |
| 146 | 146 |
| 147 // Return whether this object is a valid CanonicalCookie(). Invalid |
| 148 // cookies may be constructed by the detailed constructor. |
| 149 bool IsCanonical() const; |
| 150 |
| 151 // Sets the creation date of the cookie to the specified value. It |
| 152 // is only valid to call this method if the existing creation date |
| 153 // is null. |
| 154 void SetCreationDate(base::Time new_creation_date); |
| 155 |
| 147 private: | 156 private: |
| 148 FRIEND_TEST_ALL_PREFIXES(CanonicalCookieTest, TestPrefixHistograms); | 157 FRIEND_TEST_ALL_PREFIXES(CanonicalCookieTest, TestPrefixHistograms); |
| 149 | 158 |
| 150 // The special cookie prefixes as defined in | 159 // The special cookie prefixes as defined in |
| 151 // https://tools.ietf.org/html/draft-west-cookie-prefixes | 160 // https://tools.ietf.org/html/draft-west-cookie-prefixes |
| 152 // | 161 // |
| 153 // This enum is being histogrammed; do not reorder or remove values. | 162 // This enum is being histogrammed; do not reorder or remove values. |
| 154 enum CookiePrefix { | 163 enum CookiePrefix { |
| 155 COOKIE_PREFIX_NONE = 0, | 164 COOKIE_PREFIX_NONE = 0, |
| 156 COOKIE_PREFIX_SECURE, | 165 COOKIE_PREFIX_SECURE, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 185 bool httponly_; | 194 bool httponly_; |
| 186 CookieSameSite same_site_; | 195 CookieSameSite same_site_; |
| 187 CookiePriority priority_; | 196 CookiePriority priority_; |
| 188 }; | 197 }; |
| 189 | 198 |
| 190 typedef std::vector<CanonicalCookie> CookieList; | 199 typedef std::vector<CanonicalCookie> CookieList; |
| 191 | 200 |
| 192 } // namespace net | 201 } // namespace net |
| 193 | 202 |
| 194 #endif // NET_COOKIES_CANONICAL_COOKIE_H_ | 203 #endif // NET_COOKIES_CANONICAL_COOKIE_H_ |
| OLD | NEW |