| Index: content/browser/storage_partition_impl.cc | 
| diff --git a/content/browser/storage_partition_impl.cc b/content/browser/storage_partition_impl.cc | 
| index 1775b5fcef819699ab2a25676f6b39ef9e0cd3d2..2ebb0945934692dd172ee4b292d7dabbd3413dfe 100644 | 
| --- a/content/browser/storage_partition_impl.cc | 
| +++ b/content/browser/storage_partition_impl.cc | 
| @@ -12,10 +12,12 @@ | 
| #include "content/common/dom_storage/dom_storage_types.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/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, | 
| +                           CookieStoreMapImpl* cookie_store_map, | 
| DOMStorageContextWrapper* dom_storage_context, | 
| quota::QuotaManager* quota_manager, | 
| const base::Time begin, | 
| @@ -284,6 +252,7 @@ StoragePartitionImpl::StoragePartitionImpl( | 
| webkit_database::DatabaseTracker* database_tracker, | 
| DOMStorageContextWrapper* 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), | 
| @@ -292,7 +261,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. | 
| @@ -313,7 +284,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) || | 
| @@ -377,6 +349,7 @@ StoragePartitionImpl* StoragePartitionImpl::Create( | 
| database_tracker.get(), | 
| dom_storage_context.get(), | 
| indexed_db_context.get(), | 
| +                                  cookie_store_map.Pass(), | 
| webrtc_identity_store.Pass()); | 
| } | 
|  | 
| @@ -421,7 +394,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) { | 
| @@ -431,7 +403,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:: | 
| @@ -543,7 +516,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, | 
| DOMStorageContextWrapper* dom_storage_context, | 
| quota::QuotaManager* quota_manager, | 
| const base::Time begin, | 
| @@ -558,11 +531,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 || | 
| @@ -609,20 +579,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, | 
| @@ -630,14 +597,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 CookieStoreMapImpl& StoragePartitionImpl::GetCookieStoreMap() { | 
| +  return *cookie_store_map_; | 
| +} | 
| + | 
| void StoragePartitionImpl::SetURLRequestContext( | 
| net::URLRequestContextGetter* url_request_context) { | 
| url_request_context_ = url_request_context; | 
|  |