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 | |
131 // Returns the cookie source when cookies are set for |url|. This function | 128 // Returns the cookie source when cookies are set for |url|. This function |
132 // is public for unit test purposes only. | 129 // is public for unit test purposes only. |
133 static std::string GetCookieSourceFromURL(const GURL& url); | 130 static std::string GetCookieSourceFromURL(const GURL& url); |
134 static std::string CanonPath(const GURL& url, const ParsedCookie& pc); | 131 static std::string CanonPath(const GURL& url, const ParsedCookie& pc); |
135 static base::Time CanonExpiration(const ParsedCookie& pc, | 132 static base::Time CanonExpiration(const ParsedCookie& pc, |
136 const base::Time& current, | 133 const base::Time& current, |
137 const base::Time& server_time); | 134 const base::Time& server_time); |
138 | 135 |
139 private: | 136 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 | |
143 // The source member of a canonical cookie is the origin of the URL that tried | 137 // The source member of a canonical cookie is the origin of the URL that tried |
144 // to set this cookie, minus the port number if any. This field is not | 138 // to set this cookie, minus the port number if any. This field is not |
145 // persistent though; its only used in the in-tab cookies dialog to show the | 139 // persistent though; its only used in the in-tab cookies dialog to show the |
146 // user the source URL. This is used for both allowed and blocked cookies. | 140 // user the source URL. This is used for both allowed and blocked cookies. |
147 // When a CanonicalCookie is constructed from the backing store (common case) | 141 // When a CanonicalCookie is constructed from the backing store (common case) |
148 // this field will be null. CanonicalCookie consumers should not rely on | 142 // this field will be null. CanonicalCookie consumers should not rely on |
149 // this field unless they guarantee that the creator of those | 143 // this field unless they guarantee that the creator of those |
150 // CanonicalCookies properly initialized the field. | 144 // CanonicalCookies properly initialized the field. |
151 std::string source_; | 145 std::string source_; |
152 std::string name_; | 146 std::string name_; |
153 std::string value_; | 147 std::string value_; |
154 std::string domain_; | 148 std::string domain_; |
155 std::string path_; | 149 std::string path_; |
156 base::Time creation_date_; | 150 base::Time creation_date_; |
157 base::Time expiry_date_; | 151 base::Time expiry_date_; |
158 base::Time last_access_date_; | 152 base::Time last_access_date_; |
159 bool secure_; | 153 bool secure_; |
160 bool httponly_; | 154 bool httponly_; |
161 CookiePriority priority_; | 155 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. | |
165 }; | 156 }; |
166 | 157 |
167 typedef std::vector<CanonicalCookie> CookieList; | 158 typedef std::vector<CanonicalCookie> CookieList; |
168 | 159 |
169 } // namespace net | 160 } // namespace net |
170 | 161 |
171 #endif // NET_COOKIES_CANONICAL_COOKIE_H_ | 162 #endif // NET_COOKIES_CANONICAL_COOKIE_H_ |
OLD | NEW |