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

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: compile gdi. 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 f7cda5c42820279dfacf257189a1cd986608bdb8..01a545dcd135934c310cb862940a137996679a20 100644
--- a/content/browser/storage_partition_impl.cc
+++ b/content/browser/storage_partition_impl.cc
@@ -11,8 +11,10 @@
#include "content/browser/gpu/shader_disk_cache.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/cookie_store_map.h"
#include "content/public/browser/dom_storage_context.h"
#include "content/public/browser/indexed_db_context.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"
@@ -41,30 +43,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 base::Closure& callback) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- net::CookieStore* cookie_store = rq_context->
- GetURLRequestContext()->cookie_store();
- cookie_store->DeleteAllCreatedBetweenAsync(begin, end,
- base::Bind(&OnClearedCookies, callback));
-}
-
void OnQuotaManagedOriginDeleted(const GURL& origin,
quota::StorageType type,
size_t* origins_to_delete_count,
@@ -237,7 +215,7 @@ struct StoragePartitionImpl::DataDeletionHelper {
uint32 quota_storage_remove_mask,
const GURL& remove_origin,
const base::FilePath& path,
- net::URLRequestContextGetter* rq_context,
+ CookieStoreMapImpl* cookie_store_map,
DOMStorageContextImpl* dom_storage_context,
quota::QuotaManager* quota_manager,
const base::Time begin,
@@ -272,6 +250,7 @@ StoragePartitionImpl::StoragePartitionImpl(
webkit_database::DatabaseTracker* database_tracker,
DOMStorageContextImpl* dom_storage_context,
IndexedDBContextImpl* indexed_db_context,
+ scoped_ptr<CookieStoreMapImpl> cookie_store_map,
scoped_ptr<WebRTCIdentityStore> webrtc_identity_store)
: partition_path_(partition_path),
quota_manager_(quota_manager),
@@ -280,7 +259,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.Pass()) {}
+ cookie_store_map_(cookie_store_map.Pass()),
+ webrtc_identity_store_(webrtc_identity_store.Pass()) {
+}
StoragePartitionImpl::~StoragePartitionImpl() {
// These message loop checks are just to avoid leaks in unittests.
@@ -301,7 +282,8 @@ StoragePartitionImpl::~StoragePartitionImpl() {
StoragePartitionImpl* StoragePartitionImpl::Create(
BrowserContext* context,
bool in_memory,
- const base::FilePath& partition_path) {
+ const base::FilePath& partition_path,
+ scoped_ptr<CookieStoreMapImpl> 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) ||
@@ -365,6 +347,7 @@ StoragePartitionImpl* StoragePartitionImpl::Create(
database_tracker.get(),
dom_storage_context.get(),
indexed_db_context.get(),
+ cookie_store_map.Pass(),
webrtc_identity_store.Pass());
}
@@ -405,11 +388,14 @@ IndexedDBContextImpl* StoragePartitionImpl::GetIndexedDBContext() {
return indexed_db_context_.get();
}
+const CookieStoreMapImpl& StoragePartitionImpl::GetCookieStoreMap() {
+ return *cookie_store_map_;
+}
+
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) {
@@ -419,7 +405,8 @@ void StoragePartitionImpl::ClearDataImpl(
// DataDeletionHelper::DecrementTaskCountOnUI().
helper->ClearDataOnUIThread(
remove_mask, quota_storage_remove_mask, remove_origin,
- GetPath(), rq_context, dom_storage_context_, quota_manager_, begin, end);
+ GetPath(), cookie_store_map_.get(), dom_storage_context_, quota_manager_,
+ begin, end);
}
void StoragePartitionImpl::
@@ -531,7 +518,7 @@ void StoragePartitionImpl::DataDeletionHelper::ClearDataOnUIThread(
uint32 quota_storage_remove_mask,
const GURL& remove_origin,
const base::FilePath& path,
- net::URLRequestContextGetter* rq_context,
+ CookieStoreMapImpl* cookie_store_map,
DOMStorageContextImpl* dom_storage_context,
quota::QuotaManager* quota_manager,
const base::Time begin,
@@ -546,11 +533,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,
- decrement_callback));
+ cookie_store_map->DeleteCookies(remove_origin, begin, end,
+ decrement_callback);
}
if (remove_mask & REMOVE_DATA_MASK_INDEXEDDB ||
@@ -597,20 +581,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,
@@ -618,8 +599,8 @@ 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() {

Powered by Google App Engine
This is Rietveld 408576698