Index: content/browser/storage_partition_impl.cc |
diff --git a/content/browser/storage_partition_impl.cc b/content/browser/storage_partition_impl.cc |
index 52497c902953e3280b480456e82ee548641c3cbf..ce048e86f937a0958d35ce6bbebbbb0e0673e770 100644 |
--- a/content/browser/storage_partition_impl.cc |
+++ b/content/browser/storage_partition_impl.cc |
@@ -73,6 +73,24 @@ void ClearCookiesOnIOThread( |
} |
} |
+void ClearCookiesOnIOThreadWithCookieMatcher( |
+ const scoped_refptr<net::URLRequestContextGetter>& rq_context, |
+ const base::Time begin, |
+ const base::Time end, |
+ const StoragePartition::CookieMatcherFunction& cookie_matcher, |
+ const base::Closure& callback) { |
+ DCHECK_CURRENTLY_ON(BrowserThread::IO); |
+ net::CookieStore* cookie_store = |
+ rq_context->GetURLRequestContext()->cookie_store(); |
+ if (cookie_matcher.is_null()) { |
+ cookie_store->DeleteAllCreatedBetweenAsync( |
+ begin, end, base::Bind(&OnClearedCookies, callback)); |
+ } else { |
+ cookie_store->DeleteAllCreatedBetweenWithPredicateAsync( |
+ begin, end, cookie_matcher, base::Bind(&OnClearedCookies, callback)); |
+ } |
+} |
+ |
void CheckQuotaManagedDataDeletionStatus(size_t* deletion_task_count, |
const base::Closure& callback) { |
DCHECK_CURRENTLY_ON(BrowserThread::IO); |
@@ -247,6 +265,7 @@ struct StoragePartitionImpl::QuotaManagedDataDeletionHelper { |
const StoragePartition::OriginMatcherFunction& origin_matcher); |
void ClearOriginsOnIOThread( |
+ |
storage::QuotaManager* quota_manager, |
const scoped_refptr<storage::SpecialStoragePolicy>& |
special_storage_policy, |
@@ -288,6 +307,7 @@ struct StoragePartitionImpl::DataDeletionHelper { |
void ClearDataOnUIThread( |
const GURL& storage_origin, |
const OriginMatcherFunction& origin_matcher, |
+ const CookieMatcherFunction& cookie_matcher, |
const base::FilePath& path, |
net::URLRequestContextGetter* rq_context, |
DOMStorageContextWrapper* dom_storage_context, |
@@ -601,6 +621,7 @@ void StoragePartitionImpl::ClearDataImpl( |
uint32_t quota_storage_remove_mask, |
const GURL& storage_origin, |
const OriginMatcherFunction& origin_matcher, |
+ const CookieMatcherFunction& cookie_matcher, |
net::URLRequestContextGetter* rq_context, |
const base::Time begin, |
const base::Time end, |
@@ -611,16 +632,10 @@ void StoragePartitionImpl::ClearDataImpl( |
callback); |
// |helper| deletes itself when done in |
// DataDeletionHelper::DecrementTaskCountOnUI(). |
- helper->ClearDataOnUIThread(storage_origin, |
- origin_matcher, |
- GetPath(), |
- rq_context, |
- dom_storage_context_.get(), |
- quota_manager_.get(), |
- special_storage_policy_.get(), |
- webrtc_identity_store_.get(), |
- begin, |
- end); |
+ helper->ClearDataOnUIThread( |
+ storage_origin, origin_matcher, cookie_matcher, GetPath(), rq_context, |
+ dom_storage_context_.get(), quota_manager_.get(), |
+ special_storage_policy_.get(), webrtc_identity_store_.get(), begin, end); |
} |
void StoragePartitionImpl:: |
@@ -765,6 +780,7 @@ void StoragePartitionImpl::DataDeletionHelper::DecrementTaskCountOnUI() { |
void StoragePartitionImpl::DataDeletionHelper::ClearDataOnUIThread( |
const GURL& storage_origin, |
const OriginMatcherFunction& origin_matcher, |
+ const CookieMatcherFunction& cookie_matcher, |
const base::FilePath& path, |
net::URLRequestContextGetter* rq_context, |
DOMStorageContextWrapper* dom_storage_context, |
@@ -783,11 +799,19 @@ void StoragePartitionImpl::DataDeletionHelper::ClearDataOnUIThread( |
if (remove_mask & REMOVE_DATA_MASK_COOKIES) { |
// Handle the cookies. |
IncrementTaskCountOnUI(); |
- BrowserThread::PostTask( |
- BrowserThread::IO, FROM_HERE, |
- base::Bind(&ClearCookiesOnIOThread, |
- make_scoped_refptr(rq_context), begin, end, storage_origin, |
- decrement_callback)); |
+ // We will never have both a storage_origin and a cookie_matcher. |
+ if (cookie_matcher.is_null()) { |
+ BrowserThread::PostTask( |
+ BrowserThread::IO, FROM_HERE, |
+ base::Bind(&ClearCookiesOnIOThread, make_scoped_refptr(rq_context), |
+ begin, end, storage_origin, decrement_callback)); |
+ } else { |
+ BrowserThread::PostTask( |
+ BrowserThread::IO, FROM_HERE, |
+ base::Bind(&ClearCookiesOnIOThreadWithCookieMatcher, |
+ make_scoped_refptr(rq_context), begin, end, cookie_matcher, |
+ decrement_callback)); |
+ } |
} |
if (remove_mask & REMOVE_DATA_MASK_INDEXEDDB || |
@@ -861,13 +885,9 @@ void StoragePartitionImpl::ClearDataForOrigin( |
net::URLRequestContextGetter* request_context_getter, |
const base::Closure& callback) { |
DCHECK_CURRENTLY_ON(BrowserThread::UI); |
- ClearDataImpl(remove_mask, |
- quota_storage_remove_mask, |
- storage_origin, |
- OriginMatcherFunction(), |
- request_context_getter, |
- base::Time(), |
- base::Time::Max(), |
+ ClearDataImpl(remove_mask, quota_storage_remove_mask, storage_origin, |
+ OriginMatcherFunction(), CookieMatcherFunction(), |
+ request_context_getter, base::Time(), base::Time::Max(), |
callback); |
} |
@@ -880,7 +900,20 @@ void StoragePartitionImpl::ClearData( |
const base::Time end, |
const base::Closure& callback) { |
ClearDataImpl(remove_mask, quota_storage_remove_mask, storage_origin, |
- origin_matcher, GetURLRequestContext(), begin, end, callback); |
+ origin_matcher, CookieMatcherFunction(), GetURLRequestContext(), |
+ begin, end, callback); |
+} |
+ |
+void StoragePartitionImpl::ClearData( |
+ uint32_t remove_mask, |
+ uint32_t quota_storage_remove_mask, |
+ const OriginMatcherFunction& origin_matcher, |
+ const CookieMatcherFunction& cookie_matcher, |
+ const base::Time begin, |
+ const base::Time end, |
+ const base::Closure& callback) { |
+ ClearDataImpl(remove_mask, quota_storage_remove_mask, GURL(), origin_matcher, |
+ cookie_matcher, GetURLRequestContext(), begin, end, callback); |
} |
void StoragePartitionImpl::Flush() { |