Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(423)

Side by Side Diff: net/base/cookie_monster.h

Issue 5430004: Refactored cookies persistent store clean-up on shutdown. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added unit test and moved flag to the persistence store itself. Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 PersistentCookieStore* GetPersistentCookieStore() {
210 return store_.get();
211 }
212
213 void DetachPersistentCookieStore() {
214 store_ = NULL;
jochen (gone - plz use gerrit) 2010/12/02 15:09:51 still required?
pastarmovj 2010/12/02 16:29:07 Nope sorry.
215 }
216
209 // There are some unknowns about how to correctly handle file:// cookies, 217 // There are some unknowns about how to correctly handle file:// cookies,
210 // and our implementation for this is not robust enough. This allows you 218 // 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. 219 // to enable support, but it should only be used for testing. Bug 1157243.
212 // Must be called before creating a CookieMonster instance. 220 // Must be called before creating a CookieMonster instance.
213 static void EnableFileScheme(); 221 static void EnableFileScheme();
214 static bool enable_file_scheme_; 222 static bool enable_file_scheme_;
215 223
216 private: 224 private:
217 ~CookieMonster(); 225 ~CookieMonster();
218 226
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 677
670 DISALLOW_COPY_AND_ASSIGN(ParsedCookie); 678 DISALLOW_COPY_AND_ASSIGN(ParsedCookie);
671 }; 679 };
672 680
673 typedef base::RefCountedThreadSafe<CookieMonster::PersistentCookieStore> 681 typedef base::RefCountedThreadSafe<CookieMonster::PersistentCookieStore>
674 RefcountedPersistentCookieStore; 682 RefcountedPersistentCookieStore;
675 683
676 class CookieMonster::PersistentCookieStore 684 class CookieMonster::PersistentCookieStore
677 : public RefcountedPersistentCookieStore { 685 : public RefcountedPersistentCookieStore {
678 public: 686 public:
679 virtual ~PersistentCookieStore() { } 687 virtual ~PersistentCookieStore() {}
680 688
681 // Initializes the store and retrieves the existing cookies. This will be 689 // Initializes the store and retrieves the existing cookies. This will be
682 // called only once at startup. 690 // called only once at startup.
683 virtual bool Load(std::vector<CookieMonster::CanonicalCookie*>*) = 0; 691 virtual bool Load(std::vector<CookieMonster::CanonicalCookie*>* cookies) = 0;
684 692
685 virtual void AddCookie(const CanonicalCookie&) = 0; 693 virtual void AddCookie(const CanonicalCookie& cc) = 0;
686 virtual void UpdateCookieAccessTime(const CanonicalCookie&) = 0; 694 virtual void UpdateCookieAccessTime(const CanonicalCookie& cc) = 0;
687 virtual void DeleteCookie(const CanonicalCookie&) = 0; 695 virtual void DeleteCookie(const CanonicalCookie& cc) = 0;
696
697 // Sets the value of the user preference whether the persistent storage
698 // must be deleted upon destruction.
699 virtual void SetClearLocalStateOnExit(bool clear_local_state) = 0;
688 700
689 protected: 701 protected:
690 PersistentCookieStore() { } 702 PersistentCookieStore() {}
691 703
692 private: 704 private:
693 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore); 705 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore);
694 }; 706 };
695 707
696 } // namespace net 708 } // namespace net
697 709
698 #endif // NET_BASE_COOKIE_MONSTER_H_ 710 #endif // NET_BASE_COOKIE_MONSTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698