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

Unified Diff: content/browser/storage_partition_impl.cc

Issue 1844243002: [CookieStore] Upgrading host-based deleting to predicate-based deleting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments, and ios 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: content/browser/storage_partition_impl.cc
diff --git a/content/browser/storage_partition_impl.cc b/content/browser/storage_partition_impl.cc
index e102445330aa80d3d0e18e50d1cca68e3514e013..ab78608c4b31fdeb0083e9c60b2ae32cdeec5ad1 100644
--- a/content/browser/storage_partition_impl.cc
+++ b/content/browser/storage_partition_impl.cc
@@ -9,6 +9,7 @@
#include <set>
#include <vector>
+#include "base/bind.h"
#include "base/location.h"
#include "base/sequenced_task_runner.h"
#include "base/single_thread_task_runner.h"
@@ -29,6 +30,7 @@
#include "content/public/browser/session_storage_usage_info.h"
#include "net/base/completion_callback.h"
#include "net/base/net_errors.h"
+#include "net/cookies/canonical_cookie.h"
#include "net/cookies/cookie_monster.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_getter.h"
@@ -39,6 +41,11 @@ namespace content {
namespace {
+bool DoesCookieMatchHost(const std::string& host,
+ const net::CanonicalCookie& cookie) {
+ return cookie.IsHostCookie() && cookie.IsDomainMatch(host);
+}
+
void OnClearedCookies(const base::Closure& callback, int num_deleted) {
// The final callback needs to happen from UI thread.
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
@@ -66,10 +73,10 @@ void ClearCookiesOnIOThread(
end,
base::Bind(&OnClearedCookies, callback));
} else {
- cookie_store->DeleteAllCreatedBetweenForHostAsync(
- begin,
- end,
- storage_origin, base::Bind(&OnClearedCookies, callback));
+ cookie_store->DeleteAllCreatedBetweenWithPredicateAsync(
Mike West 2016/04/02 05:12:40 Nit: Can you add a "TODO(mkwst): It's not clear wh
dmurph 2016/04/04 18:28:32 Done.
+ begin, end,
+ StoragePartitionImpl::CreatePredicateForHostCookies(storage_origin),
+ base::Bind(&OnClearedCookies, callback));
}
}
@@ -222,6 +229,12 @@ int StoragePartitionImpl::GenerateQuotaClientMask(uint32_t remove_mask) {
return quota_client_mask;
}
+// static
+net::CookieStore::CookiePredicate
+StoragePartitionImpl::CreatePredicateForHostCookies(const GURL& url) {
+ return base::Bind(&DoesCookieMatchHost, url.host());
+}
+
// Helper for deleting quota managed data from a partition.
//
// Most of the operations in this class are done on IO thread.

Powered by Google App Engine
This is Rietveld 408576698