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

Unified Diff: content/browser/storage_partition_impl.cc

Issue 12546016: Remove the Extensions URLRequestContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix silly compile error Created 7 years, 4 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 c5471869150814b3c4df2ee5f8b811b230a93aaa..5aeb109a74e4afc98aeea45c1d91c29f3fb0e50e 100644
--- a/content/browser/storage_partition_impl.cc
+++ b/content/browser/storage_partition_impl.cc
@@ -9,6 +9,7 @@
#include "content/browser/browser_main_loop.h"
#include "content/browser/fileapi/browser_file_system_helper.h"
#include "content/browser/gpu/shader_disk_cache.h"
+#include "content/browser/net/cookie_store_map.h"
#include "content/common/dom_storage/dom_storage_types.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
@@ -16,6 +17,7 @@
#include "content/public/browser/indexed_db_context.h"
#include "content/public/browser/local_storage_usage_info.h"
#include "content/public/browser/session_storage_usage_info.h"
+#include "content/public/common/url_constants.h"
#include "net/base/completion_callback.h"
#include "net/base/net_errors.h"
#include "net/cookies/cookie_monster.h"
@@ -43,40 +45,6 @@ int GenerateQuotaClientMask(uint32 remove_mask) {
return quota_client_mask;
}
-void OnClearedCookies(const base::Closure& callback, int num_deleted) {
- // The final callback needs to happen from UI thread.
- if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
- BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
- base::Bind(&OnClearedCookies, callback, num_deleted));
- return;
- }
-
- callback.Run();
-}
-
-void ClearCookiesOnIOThread(
- const scoped_refptr<net::URLRequestContextGetter>& rq_context,
- const base::Time begin,
- const base::Time end,
- const GURL& remove_origin,
- const base::Closure& callback) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- net::CookieStore* cookie_store = rq_context->
- GetURLRequestContext()->cookie_store();
- if (remove_origin.is_empty()) {
- cookie_store->GetCookieMonster()->DeleteAllCreatedBetweenAsync(
- begin,
- end,
- base::Bind(&OnClearedCookies, callback));
- } else {
- cookie_store->GetCookieMonster()->DeleteAllCreatedBetweenForHostAsync(
- begin,
- end,
- remove_origin, base::Bind(&OnClearedCookies, callback));
- }
-}
-
void OnQuotaManagedOriginDeleted(const GURL& origin,
quota::StorageType type,
size_t* origins_to_delete_count,
@@ -249,7 +217,7 @@ struct StoragePartitionImpl::DataDeletionHelper {
uint32 quota_storage_remove_mask,
const GURL& remove_origin,
const base::FilePath& path,
- net::URLRequestContextGetter* rq_context,
+ CookieStoreMap* cookie_store_map,
DOMStorageContextWrapper* dom_storage_context,
quota::QuotaManager* quota_manager,
WebRTCIdentityStore* webrtc_identity_store,
@@ -285,6 +253,7 @@ StoragePartitionImpl::StoragePartitionImpl(
webkit_database::DatabaseTracker* database_tracker,
DOMStorageContextWrapper* dom_storage_context,
IndexedDBContextImpl* indexed_db_context,
+ scoped_ptr<CookieStoreMap> cookie_store_map,
WebRTCIdentityStore* webrtc_identity_store)
: partition_path_(partition_path),
quota_manager_(quota_manager),
@@ -293,7 +262,9 @@ StoragePartitionImpl::StoragePartitionImpl(
database_tracker_(database_tracker),
dom_storage_context_(dom_storage_context),
indexed_db_context_(indexed_db_context),
- webrtc_identity_store_(webrtc_identity_store) {}
+ cookie_store_map_(cookie_store_map.Pass()),
+ webrtc_identity_store_(webrtc_identity_store) {
+}
StoragePartitionImpl::~StoragePartitionImpl() {
// These message loop checks are just to avoid leaks in unittests.
@@ -317,7 +288,8 @@ StoragePartitionImpl::~StoragePartitionImpl() {
StoragePartitionImpl* StoragePartitionImpl::Create(
BrowserContext* context,
bool in_memory,
- const base::FilePath& partition_path) {
+ const base::FilePath& partition_path,
+ scoped_ptr<CookieStoreMap> cookie_store_map) {
// Ensure that these methods are called on the UI thread, except for
// unittests where a UI thread might not have been created.
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) ||
@@ -381,6 +353,7 @@ StoragePartitionImpl* StoragePartitionImpl::Create(
database_tracker.get(),
dom_storage_context.get(),
indexed_db_context.get(),
+ cookie_store_map.Pass(),
webrtc_identity_store.get());
}
@@ -425,7 +398,6 @@ void StoragePartitionImpl::ClearDataImpl(
uint32 remove_mask,
uint32 quota_storage_remove_mask,
const GURL& remove_origin,
- net::URLRequestContextGetter* rq_context,
const base::Time begin,
const base::Time end,
const base::Closure& callback) {
@@ -435,7 +407,7 @@ void StoragePartitionImpl::ClearDataImpl(
// DataDeletionHelper::DecrementTaskCountOnUI().
helper->ClearDataOnUIThread(
remove_mask, quota_storage_remove_mask, remove_origin,
- GetPath(), rq_context, dom_storage_context_, quota_manager_,
+ GetPath(), cookie_store_map_.get(), dom_storage_context_, quota_manager_,
webrtc_identity_store_, begin, end);
}
@@ -548,7 +520,7 @@ void StoragePartitionImpl::DataDeletionHelper::ClearDataOnUIThread(
uint32 quota_storage_remove_mask,
const GURL& remove_origin,
const base::FilePath& path,
- net::URLRequestContextGetter* rq_context,
+ CookieStoreMap* cookie_store_map,
DOMStorageContextWrapper* dom_storage_context,
quota::QuotaManager* quota_manager,
WebRTCIdentityStore* webrtc_identity_store,
@@ -564,11 +536,8 @@ 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, remove_origin,
- decrement_callback));
+ cookie_store_map->DeleteCookies(remove_origin, begin, end,
+ decrement_callback);
}
if (remove_mask & REMOVE_DATA_MASK_INDEXEDDB ||
@@ -627,20 +596,17 @@ void StoragePartitionImpl::DataDeletionHelper::ClearDataOnUIThread(
void StoragePartitionImpl::ClearDataForOrigin(
uint32 remove_mask,
uint32 quota_storage_remove_mask,
- const GURL& storage_origin,
- net::URLRequestContextGetter* request_context_getter) {
+ const GURL& storage_origin) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
ClearDataImpl(remove_mask, quota_storage_remove_mask, storage_origin,
- request_context_getter, base::Time(), base::Time::Max(),
- base::Bind(&base::DoNothing));
+ base::Time(), base::Time::Max(), base::Bind(&base::DoNothing));
}
void StoragePartitionImpl::ClearDataForUnboundedRange(
uint32 remove_mask,
uint32 quota_storage_remove_mask) {
ClearDataImpl(remove_mask, quota_storage_remove_mask, GURL(),
- GetURLRequestContext(), base::Time(), base::Time::Max(),
- base::Bind(&base::DoNothing));
+ base::Time(), base::Time::Max(), base::Bind(&base::DoNothing));
}
void StoragePartitionImpl::ClearDataForRange(uint32 remove_mask,
@@ -648,14 +614,18 @@ void StoragePartitionImpl::ClearDataForRange(uint32 remove_mask,
const base::Time& begin,
const base::Time& end,
const base::Closure& callback) {
- ClearDataImpl(remove_mask, quota_storage_remove_mask, GURL(),
- GetURLRequestContext(), begin, end, callback);
+ ClearDataImpl(remove_mask, quota_storage_remove_mask, GURL(), begin, end,
+ callback);
}
WebRTCIdentityStore* StoragePartitionImpl::GetWebRTCIdentityStore() {
return webrtc_identity_store_.get();
}
+const CookieStoreMap& StoragePartitionImpl::GetCookieStoreMap() {
+ return *cookie_store_map_;
+}
+
void StoragePartitionImpl::SetURLRequestContext(
net::URLRequestContextGetter* url_request_context) {
url_request_context_ = url_request_context;

Powered by Google App Engine
This is Rietveld 408576698