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

Unified Diff: trunk/src/content/browser/storage_partition_impl.cc

Issue 23551005: Revert 219709 "Remove the Extensions URLRequestContext." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: 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: trunk/src/content/browser/storage_partition_impl.cc
===================================================================
--- trunk/src/content/browser/storage_partition_impl.cc (revision 219785)
+++ trunk/src/content/browser/storage_partition_impl.cc (working copy)
@@ -9,7 +9,6 @@
#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"
@@ -17,7 +16,6 @@
#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"
@@ -45,6 +43,40 @@
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,
@@ -216,7 +248,7 @@
uint32 quota_storage_remove_mask,
const GURL& remove_origin,
const base::FilePath& path,
- CookieStoreMap* cookie_store_map,
+ net::URLRequestContextGetter* rq_context,
DOMStorageContextWrapper* dom_storage_context,
quota::QuotaManager* quota_manager,
WebRTCIdentityStore* webrtc_identity_store,
@@ -252,7 +284,6 @@
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),
@@ -261,9 +292,7 @@
database_tracker_(database_tracker),
dom_storage_context_(dom_storage_context),
indexed_db_context_(indexed_db_context),
- cookie_store_map_(cookie_store_map.Pass()),
- webrtc_identity_store_(webrtc_identity_store) {
-}
+ webrtc_identity_store_(webrtc_identity_store) {}
StoragePartitionImpl::~StoragePartitionImpl() {
// These message loop checks are just to avoid leaks in unittests.
@@ -287,8 +316,7 @@
StoragePartitionImpl* StoragePartitionImpl::Create(
BrowserContext* context,
bool in_memory,
- const base::FilePath& partition_path,
- scoped_ptr<CookieStoreMap> cookie_store_map) {
+ const base::FilePath& partition_path) {
// 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) ||
@@ -352,7 +380,6 @@
database_tracker.get(),
dom_storage_context.get(),
indexed_db_context.get(),
- cookie_store_map.Pass(),
webrtc_identity_store.get());
}
@@ -393,15 +420,11 @@
return indexed_db_context_.get();
}
-net::CookieStore* StoragePartitionImpl::GetCookieStoreForScheme(
- const std::string& scheme) {
- return GetCookieStoreMap().GetForScheme(scheme);
-}
-
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) {
@@ -411,7 +434,7 @@
// DataDeletionHelper::DecrementTaskCountOnUI().
helper->ClearDataOnUIThread(
remove_mask, quota_storage_remove_mask, remove_origin,
- GetPath(), cookie_store_map_.get(), dom_storage_context_, quota_manager_,
+ GetPath(), rq_context, dom_storage_context_, quota_manager_,
webrtc_identity_store_, begin, end);
}
@@ -524,7 +547,7 @@
uint32 quota_storage_remove_mask,
const GURL& remove_origin,
const base::FilePath& path,
- CookieStoreMap* cookie_store_map,
+ net::URLRequestContextGetter* rq_context,
DOMStorageContextWrapper* dom_storage_context,
quota::QuotaManager* quota_manager,
WebRTCIdentityStore* webrtc_identity_store,
@@ -540,8 +563,11 @@
if (remove_mask & REMOVE_DATA_MASK_COOKIES) {
// Handle the cookies.
IncrementTaskCountOnUI();
- cookie_store_map->DeleteCookies(remove_origin, begin, end,
- decrement_callback);
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
+ base::Bind(&ClearCookiesOnIOThread,
+ make_scoped_refptr(rq_context), begin, end, remove_origin,
+ decrement_callback));
}
if (remove_mask & REMOVE_DATA_MASK_INDEXEDDB ||
@@ -600,17 +626,20 @@
void StoragePartitionImpl::ClearDataForOrigin(
uint32 remove_mask,
uint32 quota_storage_remove_mask,
- const GURL& storage_origin) {
+ const GURL& storage_origin,
+ net::URLRequestContextGetter* request_context_getter) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
ClearDataImpl(remove_mask, quota_storage_remove_mask, storage_origin,
- base::Time(), base::Time::Max(), base::Bind(&base::DoNothing));
+ request_context_getter, 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(),
- base::Time(), base::Time::Max(), base::Bind(&base::DoNothing));
+ GetURLRequestContext(), base::Time(), base::Time::Max(),
+ base::Bind(&base::DoNothing));
}
void StoragePartitionImpl::ClearDataForRange(uint32 remove_mask,
@@ -618,18 +647,14 @@
const base::Time& begin,
const base::Time& end,
const base::Closure& callback) {
- ClearDataImpl(remove_mask, quota_storage_remove_mask, GURL(), begin, end,
- callback);
+ ClearDataImpl(remove_mask, quota_storage_remove_mask, GURL(),
+ GetURLRequestContext(), 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;
« no previous file with comments | « trunk/src/content/browser/storage_partition_impl.h ('k') | trunk/src/content/browser/storage_partition_impl_map.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698