Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_BASE_COOKIE_MONSTER_H_ | 7 #ifndef NET_BASE_COOKIE_MONSTER_H_ |
| 8 #define NET_BASE_COOKIE_MONSTER_H_ | 8 #define NET_BASE_COOKIE_MONSTER_H_ |
| 9 #pragma once | 9 #pragma once |
| 10 | 10 |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 199 // "enable_file_scheme_". | 199 // "enable_file_scheme_". |
| 200 // If this this method is called, it must be called before first use of | 200 // If this this method is called, it must be called before first use of |
| 201 // the instance (i.e. as part of the instance initialization process). | 201 // the instance (i.e. as part of the instance initialization process). |
| 202 void SetCookieableSchemes(const char* schemes[], size_t num_schemes); | 202 void SetCookieableSchemes(const char* schemes[], size_t num_schemes); |
| 203 | 203 |
| 204 // Overrides the default key and expiry scheme. See comments | 204 // Overrides the default key and expiry scheme. See comments |
| 205 // before CookieMap and Garbage collection constants for details. This | 205 // before CookieMap and Garbage collection constants for details. This |
| 206 // function must be called before initialization. | 206 // function must be called before initialization. |
| 207 void SetExpiryAndKeyScheme(ExpiryAndKeyScheme key_scheme); | 207 void SetExpiryAndKeyScheme(ExpiryAndKeyScheme key_scheme); |
| 208 | 208 |
| 209 // Retrieves the persistent store if it exists. This function will return | |
| 210 // NULL for incognito mode. | |
| 211 PersistentCookieStore* GetPersistentCookieStore() { | |
| 212 return store_.get(); | |
|
jochen (gone - plz use gerrit)
2010/12/02 16:48:44
instead of this, add SetClearLocalStateOnExit() to
Randy Smith (Not in Mondays)
2010/12/02 21:19:26
Seconded; to the extent possible, I'd like to hide
pastarmovj
2010/12/03 16:43:02
Done.
| |
| 213 } | |
| 214 | |
| 209 // There are some unknowns about how to correctly handle file:// cookies, | 215 // There are some unknowns about how to correctly handle file:// cookies, |
| 210 // and our implementation for this is not robust enough. This allows you | 216 // and our implementation for this is not robust enough. This allows you |
| 211 // to enable support, but it should only be used for testing. Bug 1157243. | 217 // to enable support, but it should only be used for testing. Bug 1157243. |
| 212 // Must be called before creating a CookieMonster instance. | 218 // Must be called before creating a CookieMonster instance. |
| 213 static void EnableFileScheme(); | 219 static void EnableFileScheme(); |
| 214 static bool enable_file_scheme_; | 220 static bool enable_file_scheme_; |
| 215 | 221 |
| 216 private: | 222 private: |
| 217 ~CookieMonster(); | 223 ~CookieMonster(); |
| 218 | 224 |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 669 | 675 |
| 670 DISALLOW_COPY_AND_ASSIGN(ParsedCookie); | 676 DISALLOW_COPY_AND_ASSIGN(ParsedCookie); |
| 671 }; | 677 }; |
| 672 | 678 |
| 673 typedef base::RefCountedThreadSafe<CookieMonster::PersistentCookieStore> | 679 typedef base::RefCountedThreadSafe<CookieMonster::PersistentCookieStore> |
| 674 RefcountedPersistentCookieStore; | 680 RefcountedPersistentCookieStore; |
| 675 | 681 |
| 676 class CookieMonster::PersistentCookieStore | 682 class CookieMonster::PersistentCookieStore |
| 677 : public RefcountedPersistentCookieStore { | 683 : public RefcountedPersistentCookieStore { |
| 678 public: | 684 public: |
| 679 virtual ~PersistentCookieStore() { } | 685 virtual ~PersistentCookieStore() {} |
| 680 | 686 |
| 681 // Initializes the store and retrieves the existing cookies. This will be | 687 // Initializes the store and retrieves the existing cookies. This will be |
| 682 // called only once at startup. | 688 // called only once at startup. |
| 683 virtual bool Load(std::vector<CookieMonster::CanonicalCookie*>*) = 0; | 689 virtual bool Load(std::vector<CookieMonster::CanonicalCookie*>* cookies) = 0; |
| 684 | 690 |
| 685 virtual void AddCookie(const CanonicalCookie&) = 0; | 691 virtual void AddCookie(const CanonicalCookie& cc) = 0; |
| 686 virtual void UpdateCookieAccessTime(const CanonicalCookie&) = 0; | 692 virtual void UpdateCookieAccessTime(const CanonicalCookie& cc) = 0; |
| 687 virtual void DeleteCookie(const CanonicalCookie&) = 0; | 693 virtual void DeleteCookie(const CanonicalCookie& cc) = 0; |
| 694 | |
| 695 // Sets the value of the user preference whether the persistent storage | |
| 696 // must be deleted upon destruction. | |
| 697 virtual void SetClearLocalStateOnExit(bool clear_local_state) = 0; | |
| 688 | 698 |
| 689 protected: | 699 protected: |
| 690 PersistentCookieStore() { } | 700 PersistentCookieStore() {} |
| 691 | 701 |
| 692 private: | 702 private: |
| 693 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore); | 703 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore); |
| 694 }; | 704 }; |
| 695 | 705 |
| 696 } // namespace net | 706 } // namespace net |
| 697 | 707 |
| 698 #endif // NET_BASE_COOKIE_MONSTER_H_ | 708 #endif // NET_BASE_COOKIE_MONSTER_H_ |
| OLD | NEW |