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

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

Issue 2649083002: Divide CookieStoreIOS into two different classes with different backends (Closed)
Patch Set: fix compilation Created 3 years, 11 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_persistent.h
diff --git a/ios/net/cookies/cookie_store_ios_persistent.h b/ios/net/cookies/cookie_store_ios_persistent.h
new file mode 100644
index 0000000000000000000000000000000000000000..ce3bd4708f34c328a9d686bca4255f3e5d296741
--- /dev/null
+++ b/ios/net/cookies/cookie_store_ios_persistent.h
@@ -0,0 +1,89 @@
+// Copyright 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_NET_COOKIES_COOKIE_STORE_IOS_PERSISTENT_H_
+#define IOS_NET_COOKIES_COOKIE_STORE_IOS_PERSISTENT_H_
+
+#include "base/callback.h"
+#include "base/macros.h"
+#include "base/time/time.h"
+#import "ios/net/cookies/cookie_store_ios.h"
+#include "net/cookies/cookie_monster.h"
+#include "net/cookies/cookie_store.h"
+#include "url/gurl.h"
+
+@class NSHTTPCookieStorage;
+
+namespace net {
+
+// The CookieStoreIOSPersistent is an implementation of CookieStore relying on
+// on backing CookieStore.
+// CookieStoreIOSPersistent is not thread safe.
+//
+// All the changes are written back to the backing CookieStore.
+// For synchronized CookieStore, please see CookieStoreIOS.
+//
+// TODO(crbug.com/686147): evaluate if inheritance is
+// needed here.
+class CookieStoreIOSPersistent : public CookieStoreIOS {
+ public:
+ // Creates a CookieStoreIOS with a default value of
+ // |NSHTTPCookieStorage sharedCookieStorage| as the system's cookie store.
+ explicit CookieStoreIOSPersistent(
+ net::CookieMonster::PersistentCookieStore* persistent_store);
+
+ ~CookieStoreIOSPersistent() override;
+
+ // Inherited CookieStore methods.
+ void SetCookieWithOptionsAsync(const GURL& url,
+ const std::string& cookie_line,
+ const net::CookieOptions& options,
+ const SetCookiesCallback& callback) override;
+ void SetCookieWithDetailsAsync(const GURL& url,
+ const std::string& name,
+ const std::string& value,
+ const std::string& domain,
+ const std::string& path,
+ base::Time creation_time,
+ base::Time expiration_time,
+ base::Time last_access_time,
+ bool secure,
+ bool http_only,
+ CookieSameSite same_site,
+ CookiePriority priority,
+ const SetCookiesCallback& callback) override;
+ void GetCookiesWithOptionsAsync(const GURL& url,
+ const net::CookieOptions& options,
+ const GetCookiesCallback& callback) override;
+ void GetCookieListWithOptionsAsync(
+ const GURL& url,
+ const net::CookieOptions& options,
+ const GetCookieListCallback& callback) override;
+ void GetAllCookiesAsync(const GetCookieListCallback& callback) override;
+ void DeleteCookieAsync(const GURL& url,
+ const std::string& cookie_name,
+ const base::Closure& callback) override;
+ void DeleteCanonicalCookieAsync(const CanonicalCookie& cookie,
+ const DeleteCallback& callback) override;
+ void DeleteAllCreatedBetweenAsync(const base::Time& delete_begin,
+ const base::Time& delete_end,
+ const DeleteCallback& callback) override;
+ void DeleteAllCreatedBetweenWithPredicateAsync(
+ const base::Time& delete_begin,
+ const base::Time& delete_end,
+ const CookiePredicate& predicate,
+ const DeleteCallback& callback) override;
+ void DeleteSessionCookiesAsync(const DeleteCallback& callback) override;
+
+ private:
+ // No-op functions for this class.
+ void WriteToCookieMonster(NSArray* system_cookies) override;
+ void OnSystemCookiesChanged() override;
+
+ DISALLOW_COPY_AND_ASSIGN(CookieStoreIOSPersistent);
+};
+
+} // namespace net
+
+#endif // IOS_NET_COOKIES_COOKIE_STORE_IOS_PERSISTENT_H_

Powered by Google App Engine
This is Rietveld 408576698