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 // Brought to you by the letter D and the number 2. | 5 // Brought to you by the letter D and the number 2. |
6 | 6 |
7 #ifndef NET_COOKIES_COOKIE_MONSTER_H_ | 7 #ifndef NET_COOKIES_COOKIE_MONSTER_H_ |
8 #define NET_COOKIES_COOKIE_MONSTER_H_ | 8 #define NET_COOKIES_COOKIE_MONSTER_H_ |
9 #pragma once | 9 #pragma once |
10 | 10 |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
173 // regardless of path. This includes all http_only and secure cookies, | 173 // regardless of path. This includes all http_only and secure cookies, |
174 // but does not include any domain cookies that may apply to this host. | 174 // but does not include any domain cookies that may apply to this host. |
175 // Returns the number of cookies deleted. | 175 // Returns the number of cookies deleted. |
176 void DeleteAllForHostAsync(const GURL& url, | 176 void DeleteAllForHostAsync(const GURL& url, |
177 const DeleteCallback& callback); | 177 const DeleteCallback& callback); |
178 | 178 |
179 // Deletes one specific cookie. | 179 // Deletes one specific cookie. |
180 void DeleteCanonicalCookieAsync(const CanonicalCookie& cookie, | 180 void DeleteCanonicalCookieAsync(const CanonicalCookie& cookie, |
181 const DeleteCookieCallback& callback); | 181 const DeleteCookieCallback& callback); |
182 | 182 |
183 // Override the default list of schemes that are allowed to be set in | 183 // Override the default list of schemes that are allowed to be set in |
erikwright (departed)
2012/06/06 18:38:54
// Resets the list of cookeiable schemes to the su
Jesse Greenwald
2012/06/06 21:55:41
Done.
| |
184 // this cookie store. Calling his overrides the value of | 184 // this cookie store. Calling his overrides the value of |
185 // "enable_file_scheme_". | 185 // "enable_file_scheme_". |
186 // If this this method is called, it must be called before first use of | 186 // If this this method is called, it must be called before first use of |
187 // the instance (i.e. as part of the instance initialization process). | 187 // the instance (i.e. as part of the instance initialization process). |
188 void SetCookieableSchemes(const char* schemes[], size_t num_schemes); | 188 void SetCookieableSchemes(const char* schemes[], size_t num_schemes); |
189 | 189 |
190 #if defined(OS_ANDROID) | |
191 // Helper method to enable or disable acceptance of file scheme cookies on | |
erikwright (departed)
2012/06/06 18:38:54
Remove #if defined
// Resets the list of cookieab
Jesse Greenwald
2012/06/06 21:55:41
Done.
| |
192 // this CookieMonster instance. | |
193 void SetEnableFileScheme(bool accept); | |
194 #endif // defined(OS_ANDROID) | |
195 | |
190 // Instructs the cookie monster to not delete expired cookies. This is used | 196 // Instructs the cookie monster to not delete expired cookies. This is used |
191 // in cases where the cookie monster is used as a data structure to keep | 197 // in cases where the cookie monster is used as a data structure to keep |
192 // arbitrary cookies. | 198 // arbitrary cookies. |
193 void SetKeepExpiredCookies(); | 199 void SetKeepExpiredCookies(); |
194 | 200 |
195 // Delegates the call to set the |clear_local_store_on_exit_| flag of the | 201 // Delegates the call to set the |clear_local_store_on_exit_| flag of the |
196 // PersistentStore if it exists. | 202 // PersistentStore if it exists. |
197 void SetClearPersistentStoreOnExit(bool clear_local_store); | 203 void SetClearPersistentStoreOnExit(bool clear_local_store); |
198 | 204 |
199 // There are some unknowns about how to correctly handle file:// cookies, | 205 // There are some unknowns about how to correctly handle file:// cookies, |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
258 // Protects session cookies from deletion on shutdown. | 264 // Protects session cookies from deletion on shutdown. |
259 void SaveSessionCookies(); | 265 void SaveSessionCookies(); |
260 | 266 |
261 // Debugging method to perform various validation checks on the map. | 267 // Debugging method to perform various validation checks on the map. |
262 // Currently just checking that there are no null CanonicalCookie pointers | 268 // Currently just checking that there are no null CanonicalCookie pointers |
263 // in the map. | 269 // in the map. |
264 // Argument |arg| is to allow retaining of arbitrary data if the CHECKs | 270 // Argument |arg| is to allow retaining of arbitrary data if the CHECKs |
265 // in the function trip. TODO(rdsmith):Remove hack. | 271 // in the function trip. TODO(rdsmith):Remove hack. |
266 void ValidateMap(int arg); | 272 void ValidateMap(int arg); |
267 | 273 |
274 #if defined(OS_ANDROID) | |
275 // Determine if the scheme of the URL is a scheme that cookies will be stored | |
erikwright (departed)
2012/06/06 18:38:54
Remove '#if defined'
'Determine' -> 'Determines'
Jesse Greenwald
2012/06/06 21:55:41
Done.
| |
276 // for. | |
277 bool IsCookieableScheme(const std::string& scheme); | |
278 #endif // defined(OS_ANDROID) | |
279 | |
268 // The default list of schemes the cookie monster can handle. | 280 // The default list of schemes the cookie monster can handle. |
269 static const char* kDefaultCookieableSchemes[]; | 281 static const char* kDefaultCookieableSchemes[]; |
270 static const int kDefaultCookieableSchemesCount; | 282 static const int kDefaultCookieableSchemesCount; |
271 | 283 |
272 private: | 284 private: |
273 // For queueing the cookie monster calls. | 285 // For queueing the cookie monster calls. |
274 class CookieMonsterTask; | 286 class CookieMonsterTask; |
275 class DeleteAllCreatedBetweenTask; | 287 class DeleteAllCreatedBetweenTask; |
276 class DeleteAllForHostTask; | 288 class DeleteAllForHostTask; |
277 class DeleteAllTask; | 289 class DeleteAllTask; |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
644 scoped_refptr<Delegate> delegate_; | 656 scoped_refptr<Delegate> delegate_; |
645 | 657 |
646 // Lock for thread-safety | 658 // Lock for thread-safety |
647 base::Lock lock_; | 659 base::Lock lock_; |
648 | 660 |
649 base::Time last_statistic_record_time_; | 661 base::Time last_statistic_record_time_; |
650 | 662 |
651 bool keep_expired_cookies_; | 663 bool keep_expired_cookies_; |
652 bool persist_session_cookies_; | 664 bool persist_session_cookies_; |
653 | 665 |
654 static bool enable_file_scheme_; | 666 // Static setting for whether or not file scheme cookies are allows when |
667 // a new CookieMonster is created, or the accepted schemes on a CookieMonster | |
668 // instance are reset back to defaults. | |
669 static bool default_enable_file_scheme_; | |
655 | 670 |
656 DISALLOW_COPY_AND_ASSIGN(CookieMonster); | 671 DISALLOW_COPY_AND_ASSIGN(CookieMonster); |
657 }; | 672 }; |
658 | 673 |
659 class NET_EXPORT CookieMonster::CanonicalCookie { | 674 class NET_EXPORT CookieMonster::CanonicalCookie { |
660 public: | 675 public: |
661 | 676 |
662 // These constructors do no validation or canonicalization of their inputs; | 677 // These constructors do no validation or canonicalization of their inputs; |
663 // the resulting CanonicalCookies should not be relied on to be canonical | 678 // the resulting CanonicalCookies should not be relied on to be canonical |
664 // unless the caller has done appropriate validation and canonicalization | 679 // unless the caller has done appropriate validation and canonicalization |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
967 friend class base::RefCountedThreadSafe<PersistentCookieStore>; | 982 friend class base::RefCountedThreadSafe<PersistentCookieStore>; |
968 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore); | 983 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore); |
969 }; | 984 }; |
970 | 985 |
971 class CookieList : public std::vector<CookieMonster::CanonicalCookie> { | 986 class CookieList : public std::vector<CookieMonster::CanonicalCookie> { |
972 }; | 987 }; |
973 | 988 |
974 } // namespace net | 989 } // namespace net |
975 | 990 |
976 #endif // NET_COOKIES_COOKIE_MONSTER_H_ | 991 #endif // NET_COOKIES_COOKIE_MONSTER_H_ |
OLD | NEW |