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 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 118 |
119 // Returns true if the cookie should be included for the given request |url|. | 119 // Returns true if the cookie should be included for the given request |url|. |
120 // HTTP only cookies can be filter by using appropriate cookie |options|. | 120 // HTTP only cookies can be filter by using appropriate cookie |options|. |
121 // PLEASE NOTE that this method does not check whether a cookie is expired or | 121 // PLEASE NOTE that this method does not check whether a cookie is expired or |
122 // not! | 122 // not! |
123 bool IncludeForRequestURL(const GURL& url, | 123 bool IncludeForRequestURL(const GURL& url, |
124 const CookieOptions& options) const; | 124 const CookieOptions& options) const; |
125 | 125 |
126 std::string DebugString() const; | 126 std::string DebugString() const; |
127 | 127 |
| 128 // Returns a duplicate of this cookie. |
| 129 CanonicalCookie* Duplicate(); |
| 130 |
128 // Returns the cookie source when cookies are set for |url|. This function | 131 // Returns the cookie source when cookies are set for |url|. This function |
129 // is public for unit test purposes only. | 132 // is public for unit test purposes only. |
130 static std::string GetCookieSourceFromURL(const GURL& url); | 133 static std::string GetCookieSourceFromURL(const GURL& url); |
131 static std::string CanonPath(const GURL& url, const ParsedCookie& pc); | 134 static std::string CanonPath(const GURL& url, const ParsedCookie& pc); |
132 static base::Time CanonExpiration(const ParsedCookie& pc, | 135 static base::Time CanonExpiration(const ParsedCookie& pc, |
133 const base::Time& current, | 136 const base::Time& current, |
134 const base::Time& server_time); | 137 const base::Time& server_time); |
135 | 138 |
136 private: | 139 private: |
| 140 // NOTE: When any new members are added below, the implementation of |
| 141 // Duplicate() must be updated to copy the new member accordingly. |
| 142 |
137 // The source member of a canonical cookie is the origin of the URL that tried | 143 // The source member of a canonical cookie is the origin of the URL that tried |
138 // to set this cookie, minus the port number if any. This field is not | 144 // to set this cookie, minus the port number if any. This field is not |
139 // persistent though; its only used in the in-tab cookies dialog to show the | 145 // persistent though; its only used in the in-tab cookies dialog to show the |
140 // user the source URL. This is used for both allowed and blocked cookies. | 146 // user the source URL. This is used for both allowed and blocked cookies. |
141 // When a CanonicalCookie is constructed from the backing store (common case) | 147 // When a CanonicalCookie is constructed from the backing store (common case) |
142 // this field will be null. CanonicalCookie consumers should not rely on | 148 // this field will be null. CanonicalCookie consumers should not rely on |
143 // this field unless they guarantee that the creator of those | 149 // this field unless they guarantee that the creator of those |
144 // CanonicalCookies properly initialized the field. | 150 // CanonicalCookies properly initialized the field. |
145 std::string source_; | 151 std::string source_; |
146 std::string name_; | 152 std::string name_; |
147 std::string value_; | 153 std::string value_; |
148 std::string domain_; | 154 std::string domain_; |
149 std::string path_; | 155 std::string path_; |
150 base::Time creation_date_; | 156 base::Time creation_date_; |
151 base::Time expiry_date_; | 157 base::Time expiry_date_; |
152 base::Time last_access_date_; | 158 base::Time last_access_date_; |
153 bool secure_; | 159 bool secure_; |
154 bool httponly_; | 160 bool httponly_; |
155 CookiePriority priority_; | 161 CookiePriority priority_; |
| 162 // NOTE: When any new members are added above this comment, the |
| 163 // implementation of Duplicate() must be updated to copy the new member |
| 164 // accordingly. |
156 }; | 165 }; |
157 | 166 |
158 typedef std::vector<CanonicalCookie> CookieList; | 167 typedef std::vector<CanonicalCookie> CookieList; |
159 | 168 |
160 } // namespace net | 169 } // namespace net |
161 | 170 |
162 #endif // NET_COOKIES_CANONICAL_COOKIE_H_ | 171 #endif // NET_COOKIES_CANONICAL_COOKIE_H_ |
OLD | NEW |