diff options
author | ajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-03 19:55:42 +0000 |
---|---|---|
committer | ajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-03 19:55:42 +0000 |
commit | 07aaae69b6a8ea45f8e38973ea51697f2aa1c1ed (patch) | |
tree | 81f10d61210a6dac7f684d9aeced876dcdc0beac /net/cookies/cookie_monster.h | |
parent | 6dbbaa2bd49d9796faccb96f0d19424705f37048 (diff) | |
download | chromium_src-07aaae69b6a8ea45f8e38973ea51697f2aa1c1ed.zip chromium_src-07aaae69b6a8ea45f8e38973ea51697f2aa1c1ed.tar.gz chromium_src-07aaae69b6a8ea45f8e38973ea51697f2aa1c1ed.tar.bz2 |
Make CookieMonster::Delegate top-level and remove global CookieMonster::EnableFileScheme().
Relanding parts of https://chromiumcodereview.appspot.com/12546016
R=rsleevi@chromium.org
TBR=jam
BUG=159193,331424
Review URL: https://codereview.chromium.org/93593005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@242913 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/cookies/cookie_monster.h')
-rw-r--r-- | net/cookies/cookie_monster.h | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/net/cookies/cookie_monster.h b/net/cookies/cookie_monster.h index 3e2ed6d..455484e 100644 --- a/net/cookies/cookie_monster.h +++ b/net/cookies/cookie_monster.h @@ -37,6 +37,7 @@ class TimeTicks; namespace net { +class CookieMonsterDelegate; class ParsedCookie; // The cookie monster is the system for storing and retrieving cookies. It has @@ -65,8 +66,8 @@ class ParsedCookie; // - Verify that our domain enforcement and non-dotted handling is correct class NET_EXPORT CookieMonster : public CookieStore { public: - class Delegate; class PersistentCookieStore; + typedef CookieMonsterDelegate Delegate; // Terminology: // * The 'top level domain' (TLD) of an internet domain name is @@ -138,11 +139,11 @@ class NET_EXPORT CookieMonster : public CookieStore { // monster's existence. If |store| is NULL, then no backing store will be // updated. If |delegate| is non-NULL, it will be notified on // creation/deletion of cookies. - CookieMonster(PersistentCookieStore* store, Delegate* delegate); + CookieMonster(PersistentCookieStore* store, CookieMonsterDelegate* delegate); // Only used during unit testing. CookieMonster(PersistentCookieStore* store, - Delegate* delegate, + CookieMonsterDelegate* delegate, int last_access_threshold_milliseconds); // Helper function that adds all cookies from |list| into this instance. @@ -216,6 +217,10 @@ class NET_EXPORT CookieMonster : public CookieStore { // Resets the list of cookieable schemes to kDefaultCookieableSchemes with or // without 'file' being included. + // + // There are some unknowns about how to correctly handle file:// cookies, + // and our implementation for this is not robust enough. This allows you + // to enable support, but it should only be used for testing. Bug 1157243. void SetEnableFileScheme(bool accept); // Instructs the cookie monster to not delete expired cookies. This is used @@ -226,12 +231,6 @@ class NET_EXPORT CookieMonster : public CookieStore { // Protects session cookies from deletion on shutdown. void SetForceKeepSessionState(); - // There are some unknowns about how to correctly handle file:// cookies, - // and our implementation for this is not robust enough. This allows you - // to enable support, but it should only be used for testing. Bug 1157243. - // Must be called before creating a CookieMonster instance. - static void EnableFileScheme(); - // Flush the backing store (if any) to disk and post the given callback when // done. // WARNING: THE CALLBACK WILL RUN ON A RANDOM THREAD. IT MUST BE THREAD SAFE. @@ -352,8 +351,8 @@ class NET_EXPORT CookieMonster : public CookieStore { // and to provide a public cause for onCookieChange notifications. // // If you add or remove causes from this list, please be sure to also update - // the Delegate::ChangeCause mapping inside ChangeCauseMapping. Moreover, - // these are used as array indexes, so avoid reordering to keep the + // the CookieMonsterDelegate::ChangeCause mapping inside ChangeCauseMapping. + // Moreover, these are used as array indexes, so avoid reordering to keep the // histogram buckets consistent. New items (if necessary) should be added // at the end of the list, just before DELETE_COOKIE_LAST_ENTRY. enum DeletionCause { @@ -546,9 +545,9 @@ class NET_EXPORT CookieMonster : public CookieStore { const base::Time& current_time); // |deletion_cause| argument is used for collecting statistics and choosing - // the correct Delegate::ChangeCause for OnCookieChanged notifications. - // Guarantee: All iterators to cookies_ except to the deleted entry remain - // vaild. + // the correct CookieMonsterDelegate::ChangeCause for OnCookieChanged + // notifications. Guarantee: All iterators to cookies_ except to the + // deleted entry remain vaild. void InternalDeleteCookie(CookieMap::iterator it, bool sync_to_store, DeletionCause deletion_cause); @@ -670,7 +669,7 @@ class NET_EXPORT CookieMonster : public CookieStore { std::vector<std::string> cookieable_schemes_; - scoped_refptr<Delegate> delegate_; + scoped_refptr<CookieMonsterDelegate> delegate_; // Lock for thread-safety base::Lock lock_; @@ -688,8 +687,8 @@ class NET_EXPORT CookieMonster : public CookieStore { DISALLOW_COPY_AND_ASSIGN(CookieMonster); }; -class NET_EXPORT CookieMonster::Delegate - : public base::RefCountedThreadSafe<CookieMonster::Delegate> { +class NET_EXPORT CookieMonsterDelegate + : public base::RefCountedThreadSafe<CookieMonsterDelegate> { public: // The publicly relevant reasons a cookie might be changed. enum ChangeCause { @@ -721,8 +720,8 @@ class NET_EXPORT CookieMonster::Delegate bool removed, ChangeCause cause) = 0; protected: - friend class base::RefCountedThreadSafe<CookieMonster::Delegate>; - virtual ~Delegate() {} + friend class base::RefCountedThreadSafe<CookieMonsterDelegate>; + virtual ~CookieMonsterDelegate() {} }; typedef base::RefCountedThreadSafe<CookieMonster::PersistentCookieStore> |