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

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

Issue 1741123002: Add removal filter support for Cookies, Storage, and Content Settings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ios fix, and fixed test Created 4 years, 9 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.mm
diff --git a/ios/net/cookies/cookie_store_ios.mm b/ios/net/cookies/cookie_store_ios.mm
index 0d5f0017571ba4724b405ab567c76800fef90b76..b6a3ed1c76ac5558e49a1953801ff277d56a58a1 100644
--- a/ios/net/cookies/cookie_store_ios.mm
+++ b/ios/net/cookies/cookie_store_ios.mm
@@ -261,6 +261,21 @@ bool IsCookieCreatedBetweenForHost(base::Time time_begin,
IsCookieCreatedBetween(time_begin, time_end, cookie, creation_time);
}
+// Tests whether the |creation_time| of |cookie| is in the time range defined
+// by |time_begin| and |time_end| and the cookie host match |host|. A null
+// |time_end| means end-of-time.
+bool IsCookieCreatedBetweenWithPredicate(
+ base::Time time_begin,
+ base::Time time_end,
+ const net::CookieStore::CookiePredicate& predicate,
+ NSHTTPCookie* cookie,
+ base::Time creation_time) {
+ CanonicalCookie canonical_cookie = CanonicalCookieFromSystemCookie(
+ cookie, creation_time);
+ return IsCookieCreatedBetween(time_begin, time_end, cookie, creation_time) &&
+ predicate.Run(canonical_cookie);
+}
+
// Adds cookies in |cookies| with name |name| to |filtered|.
void OnlyCookiesWithName(const net::CookieList& cookies,
const std::string& name,
@@ -718,6 +733,36 @@ void CookieStoreIOS::DeleteAllCreatedBetweenForHostAsync(
}
}
+void CookieStoreIOS::DeleteAllCreatedBetweenWithPredicateAsync(
+ const base::Time& delete_begin,
+ const base::Time& delete_end,
+ const CookiePredicate& predicate,
+ const DeleteCallback& callback) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+
+ if (metrics_enabled_)
+ ResetCookieCountMetrics();
+
+ switch (synchronization_state_) {
+ case NOT_SYNCHRONIZED:
+ cookie_monster_->DeleteAllCreatedBetweenWithPredicateAsync(
+ delete_begin, delete_end, predicate, WrapDeleteCallback(callback));
+ break;
+ case SYNCHRONIZING:
+ tasks_pending_synchronization_.push_back(
+ base::Bind(&CookieStoreIOS::DeleteAllCreatedBetweenWithPredicateAsync,
+ weak_factory_.GetWeakPtr(), delete_begin, delete_end,
+ predicate, WrapDeleteCallback(callback)));
+ break;
+ case SYNCHRONIZED:
+ CookieFilterFunction filter =
+ base::Bind(IsCookieCreatedBetweenWithPredicate,
+ delete_begin, delete_end, predicate);
+ DeleteCookiesWithFilter(filter, callback);
+ break;
+ }
+}
+
void CookieStoreIOS::DeleteSessionCookiesAsync(const DeleteCallback& callback) {
DCHECK(thread_checker_.CalledOnValidThread());

Powered by Google App Engine
This is Rietveld 408576698