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

Unified Diff: ios/net/cookies/cookie_store_ios.h

Issue 1428673003: Injecting an NSHTTPCookieStorage dependency into CookieStoreIOS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months 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 side-by-side diff with in-line comments
Download patch
Index: ios/net/cookies/cookie_store_ios.h
diff --git a/ios/net/cookies/cookie_store_ios.h b/ios/net/cookies/cookie_store_ios.h
index ad56bb511a34a27687e19274414726082a23189a..2a4bfbe58600ee9568ca279060ffaeb5d50cc643 100644
--- a/ios/net/cookies/cookie_store_ios.h
+++ b/ios/net/cookies/cookie_store_ios.h
@@ -22,9 +22,11 @@
#if defined(__OBJC__)
@class NSHTTPCookie;
+@class NSHTTPCookieStorage;
@class NSArray;
#else
class NSHTTPCookie;
+class NSHTTPCookieStorage;
class NSArray;
#endif
@@ -64,20 +66,26 @@ class CookieNotificationObserver {
class CookieStoreIOS : public net::CookieStore,
public CookieNotificationObserver {
public:
+ // Creates a CookieStoreIOS with a default value of
+ // |NSHTTPCookieStorage sharedCookieStorage| as the system's cookie store.
explicit CookieStoreIOS(
net::CookieMonster::PersistentCookieStore* persistent_store);
+ explicit CookieStoreIOS(
+ net::CookieMonster::PersistentCookieStore* persistent_store,
+ NSHTTPCookieStorage* system_store);
+
enum CookiePolicy { ALLOW, BLOCK };
// Must be called on the thread where CookieStoreIOS instances live.
static void SetCookiePolicy(CookiePolicy setting);
// Create an instance of CookieStoreIOS that is generated from the cookies
- // stored in the system NSHTTPCookieStorage. The caller is responsible for
- // deleting the cookie store.
- // Apple does not persist the cookies' creation dates in the system store,
+ // stored in |cookie_storage|. The CookieStoreIOS uses the |cookie_storage|
+ // as its default backend.
+ // Apple does not persist the cookies' creation dates in NSHTTPCookieStorage,
// so callers should not expect these values to be populated.
- static CookieStoreIOS* CreateCookieStoreFromNSHTTPCookieStorage();
+ static CookieStoreIOS* CreateCookieStore(NSHTTPCookieStorage* cookie_storage);
// As there is only one system store, only one CookieStoreIOS at a time may
// be synchronized with it.
@@ -175,6 +183,7 @@ class CookieStoreIOS : public net::CookieStore,
const DeleteCallback& callback);
scoped_refptr<net::CookieMonster> cookie_monster_;
+ NSHTTPCookieStorage* system_store_;
scoped_ptr<CookieCreationTimeManager> creation_time_manager_;
bool metrics_enabled_;
base::TimeDelta flush_delay_;

Powered by Google App Engine
This is Rietveld 408576698