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

Side by Side Diff: content/browser/storage_partition_impl.cc

Issue 1979733002: Add ability to clear content licenses (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: seperate file Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/storage_partition_impl.h" 5 #include "content/browser/storage_partition_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 18 matching lines...) Expand all
29 #include "content/public/browser/session_storage_usage_info.h" 29 #include "content/public/browser/session_storage_usage_info.h"
30 #include "net/base/completion_callback.h" 30 #include "net/base/completion_callback.h"
31 #include "net/base/net_errors.h" 31 #include "net/base/net_errors.h"
32 #include "net/cookies/canonical_cookie.h" 32 #include "net/cookies/canonical_cookie.h"
33 #include "net/cookies/cookie_monster.h" 33 #include "net/cookies/cookie_monster.h"
34 #include "net/url_request/url_request_context.h" 34 #include "net/url_request/url_request_context.h"
35 #include "net/url_request/url_request_context_getter.h" 35 #include "net/url_request/url_request_context_getter.h"
36 #include "storage/browser/database/database_tracker.h" 36 #include "storage/browser/database/database_tracker.h"
37 #include "storage/browser/quota/quota_manager.h" 37 #include "storage/browser/quota/quota_manager.h"
38 38
39 #if defined(ENABLE_PLUGINS)
40 #include "content/browser/plugin_private_storage_helper.h"
41 #endif // defined(ENABLE_PLUGINS)
42
39 namespace content { 43 namespace content {
40 44
41 namespace { 45 namespace {
42 46
43 bool DoesCookieMatchHost(const std::string& host, 47 bool DoesCookieMatchHost(const std::string& host,
44 const net::CanonicalCookie& cookie) { 48 const net::CanonicalCookie& cookie) {
45 return cookie.IsHostCookie() && cookie.IsDomainMatch(host); 49 return cookie.IsHostCookie() && cookie.IsDomainMatch(host);
46 } 50 }
47 51
48 void OnClearedCookies(const base::Closure& callback, int num_deleted) { 52 void OnClearedCookies(const base::Closure& callback, int num_deleted) {
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 void ClearDataOnUIThread( 313 void ClearDataOnUIThread(
310 const GURL& storage_origin, 314 const GURL& storage_origin,
311 const OriginMatcherFunction& origin_matcher, 315 const OriginMatcherFunction& origin_matcher,
312 const CookieMatcherFunction& cookie_matcher, 316 const CookieMatcherFunction& cookie_matcher,
313 const base::FilePath& path, 317 const base::FilePath& path,
314 net::URLRequestContextGetter* rq_context, 318 net::URLRequestContextGetter* rq_context,
315 DOMStorageContextWrapper* dom_storage_context, 319 DOMStorageContextWrapper* dom_storage_context,
316 storage::QuotaManager* quota_manager, 320 storage::QuotaManager* quota_manager,
317 storage::SpecialStoragePolicy* special_storage_policy, 321 storage::SpecialStoragePolicy* special_storage_policy,
318 WebRTCIdentityStore* webrtc_identity_store, 322 WebRTCIdentityStore* webrtc_identity_store,
323 storage::FileSystemContext* filesystem_context,
319 const base::Time begin, 324 const base::Time begin,
320 const base::Time end); 325 const base::Time end);
321 326
322 void ClearQuotaManagedDataOnIOThread( 327 void ClearQuotaManagedDataOnIOThread(
323 const scoped_refptr<storage::QuotaManager>& quota_manager, 328 const scoped_refptr<storage::QuotaManager>& quota_manager,
324 const base::Time begin, 329 const base::Time begin,
325 const GURL& storage_origin, 330 const GURL& storage_origin,
326 const scoped_refptr<storage::SpecialStoragePolicy>& 331 const scoped_refptr<storage::SpecialStoragePolicy>&
327 special_storage_policy, 332 special_storage_policy,
328 const StoragePartition::OriginMatcherFunction& origin_matcher, 333 const StoragePartition::OriginMatcherFunction& origin_matcher,
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 const base::Closure& callback) { 633 const base::Closure& callback) {
629 DCHECK_CURRENTLY_ON(BrowserThread::UI); 634 DCHECK_CURRENTLY_ON(BrowserThread::UI);
630 DataDeletionHelper* helper = new DataDeletionHelper(remove_mask, 635 DataDeletionHelper* helper = new DataDeletionHelper(remove_mask,
631 quota_storage_remove_mask, 636 quota_storage_remove_mask,
632 callback); 637 callback);
633 // |helper| deletes itself when done in 638 // |helper| deletes itself when done in
634 // DataDeletionHelper::DecrementTaskCountOnUI(). 639 // DataDeletionHelper::DecrementTaskCountOnUI().
635 helper->ClearDataOnUIThread( 640 helper->ClearDataOnUIThread(
636 storage_origin, origin_matcher, cookie_matcher, GetPath(), rq_context, 641 storage_origin, origin_matcher, cookie_matcher, GetPath(), rq_context,
637 dom_storage_context_.get(), quota_manager_.get(), 642 dom_storage_context_.get(), quota_manager_.get(),
638 special_storage_policy_.get(), webrtc_identity_store_.get(), begin, end); 643 special_storage_policy_.get(), webrtc_identity_store_.get(),
644 filesystem_context_.get(), begin, end);
639 } 645 }
640 646
641 void StoragePartitionImpl:: 647 void StoragePartitionImpl::
642 QuotaManagedDataDeletionHelper::IncrementTaskCountOnIO() { 648 QuotaManagedDataDeletionHelper::IncrementTaskCountOnIO() {
643 DCHECK_CURRENTLY_ON(BrowserThread::IO); 649 DCHECK_CURRENTLY_ON(BrowserThread::IO);
644 ++task_count; 650 ++task_count;
645 } 651 }
646 652
647 void StoragePartitionImpl:: 653 void StoragePartitionImpl::
648 QuotaManagedDataDeletionHelper::DecrementTaskCountOnIO() { 654 QuotaManagedDataDeletionHelper::DecrementTaskCountOnIO() {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 void StoragePartitionImpl::DataDeletionHelper::ClearDataOnUIThread( 774 void StoragePartitionImpl::DataDeletionHelper::ClearDataOnUIThread(
769 const GURL& storage_origin, 775 const GURL& storage_origin,
770 const OriginMatcherFunction& origin_matcher, 776 const OriginMatcherFunction& origin_matcher,
771 const CookieMatcherFunction& cookie_matcher, 777 const CookieMatcherFunction& cookie_matcher,
772 const base::FilePath& path, 778 const base::FilePath& path,
773 net::URLRequestContextGetter* rq_context, 779 net::URLRequestContextGetter* rq_context,
774 DOMStorageContextWrapper* dom_storage_context, 780 DOMStorageContextWrapper* dom_storage_context,
775 storage::QuotaManager* quota_manager, 781 storage::QuotaManager* quota_manager,
776 storage::SpecialStoragePolicy* special_storage_policy, 782 storage::SpecialStoragePolicy* special_storage_policy,
777 WebRTCIdentityStore* webrtc_identity_store, 783 WebRTCIdentityStore* webrtc_identity_store,
784 storage::FileSystemContext* filesystem_context,
778 const base::Time begin, 785 const base::Time begin,
779 const base::Time end) { 786 const base::Time end) {
780 DCHECK_NE(remove_mask, 0u); 787 DCHECK_NE(remove_mask, 0u);
781 DCHECK(!callback.is_null()); 788 DCHECK(!callback.is_null());
782 789
783 IncrementTaskCountOnUI(); 790 IncrementTaskCountOnUI();
784 base::Closure decrement_callback = base::Bind( 791 base::Closure decrement_callback = base::Bind(
785 &DataDeletionHelper::DecrementTaskCountOnUI, base::Unretained(this)); 792 &DataDeletionHelper::DecrementTaskCountOnUI, base::Unretained(this));
786 793
787 if (remove_mask & REMOVE_DATA_MASK_COOKIES) { 794 if (remove_mask & REMOVE_DATA_MASK_COOKIES) {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 BrowserThread::PostTask( 855 BrowserThread::PostTask(
849 BrowserThread::IO, 856 BrowserThread::IO,
850 FROM_HERE, 857 FROM_HERE,
851 base::Bind(&WebRTCIdentityStore::DeleteBetween, 858 base::Bind(&WebRTCIdentityStore::DeleteBetween,
852 webrtc_identity_store, 859 webrtc_identity_store,
853 begin, 860 begin,
854 end, 861 end,
855 decrement_callback)); 862 decrement_callback));
856 } 863 }
857 864
865 #if defined(ENABLE_PLUGINS)
866 if (remove_mask & REMOVE_DATA_MASK_PLUGIN_PRIVATE_DATA) {
867 IncrementTaskCountOnUI();
868 filesystem_context->default_file_task_runner()->PostTask(
869 FROM_HERE, base::Bind(&ClearPluginPrivateDataOnFileTaskRunner,
870 make_scoped_refptr(filesystem_context),
871 storage_origin, begin, end, decrement_callback));
872 }
873 #endif // defined(ENABLE_PLUGINS)
874
858 DecrementTaskCountOnUI(); 875 DecrementTaskCountOnUI();
859 } 876 }
860 877
861 void StoragePartitionImpl::ClearDataForOrigin( 878 void StoragePartitionImpl::ClearDataForOrigin(
862 uint32_t remove_mask, 879 uint32_t remove_mask,
863 uint32_t quota_storage_remove_mask, 880 uint32_t quota_storage_remove_mask,
864 const GURL& storage_origin, 881 const GURL& storage_origin,
865 net::URLRequestContextGetter* request_context_getter, 882 net::URLRequestContextGetter* request_context_getter,
866 const base::Closure& callback) { 883 const base::Closure& callback) {
867 DCHECK_CURRENTLY_ON(BrowserThread::UI); 884 DCHECK_CURRENTLY_ON(BrowserThread::UI);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 net::URLRequestContextGetter* url_request_context) { 946 net::URLRequestContextGetter* url_request_context) {
930 url_request_context_ = url_request_context; 947 url_request_context_ = url_request_context;
931 } 948 }
932 949
933 void StoragePartitionImpl::SetMediaURLRequestContext( 950 void StoragePartitionImpl::SetMediaURLRequestContext(
934 net::URLRequestContextGetter* media_url_request_context) { 951 net::URLRequestContextGetter* media_url_request_context) {
935 media_url_request_context_ = media_url_request_context; 952 media_url_request_context_ = media_url_request_context;
936 } 953 }
937 954
938 } // namespace content 955 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698