| Index: content/browser/storage_partition_impl.cc
|
| diff --git a/content/browser/storage_partition_impl.cc b/content/browser/storage_partition_impl.cc
|
| index 28b0eb13450342a737477b57648e1f57fde54821..f78f9a456f7a2c8437004a3e7fbc316b45b2ae89 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"
|
| @@ -28,6 +29,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"
|
| @@ -38,6 +40,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)) {
|
| @@ -65,10 +72,13 @@ void ClearCookiesOnIOThread(
|
| end,
|
| base::Bind(&OnClearedCookies, callback));
|
| } else {
|
| - cookie_store->DeleteAllCreatedBetweenForHostAsync(
|
| - begin,
|
| - end,
|
| - storage_origin, base::Bind(&OnClearedCookies, callback));
|
| + // TODO(mkwst): It's not clear whether removing host cookies is the correct
|
| + // behavior. We might want to remove all domain-matching cookies instead.
|
| + // Also, this code path may be dead anyways.
|
| + cookie_store->DeleteAllCreatedBetweenWithPredicateAsync(
|
| + begin, end,
|
| + StoragePartitionImpl::CreatePredicateForHostCookies(storage_origin),
|
| + base::Bind(&OnClearedCookies, callback));
|
| }
|
| }
|
|
|
| @@ -221,6 +231,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.
|
|
|