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

Side by Side 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: Created 7 years, 9 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 | Annotate | Revision Log
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 "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "content/browser/fileapi/browser_file_system_helper.h" 8 #include "content/browser/fileapi/browser_file_system_helper.h"
9 #include "content/public/browser/browser_context.h" 9 #include "content/public/browser/browser_context.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
11 #include "content/public/browser/content_browser_client.h"
11 #include "content/public/browser/dom_storage_context.h" 12 #include "content/public/browser/dom_storage_context.h"
12 #include "content/public/browser/indexed_db_context.h" 13 #include "content/public/browser/indexed_db_context.h"
13 #include "net/base/completion_callback.h" 14 #include "net/base/completion_callback.h"
14 #include "net/base/net_errors.h" 15 #include "net/base/net_errors.h"
15 #include "net/cookies/cookie_monster.h" 16 #include "net/cookies/cookie_monster.h"
16 #include "net/url_request/url_request_context_getter.h" 17 #include "net/url_request/url_request_context_getter.h"
17 #include "net/url_request/url_request_context.h" 18 #include "net/url_request/url_request_context.h"
18 #include "webkit/database/database_tracker.h" 19 #include "webkit/database/database_tracker.h"
19 #include "webkit/dom_storage/dom_storage_types.h" 20 #include "webkit/dom_storage/dom_storage_types.h"
20 #include "webkit/quota/quota_manager.h" 21 #include "webkit/quota/quota_manager.h"
(...skipping 16 matching lines...) Expand all
37 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 38 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
38 std::set<GURL>::const_iterator origin; 39 std::set<GURL>::const_iterator origin;
39 for (std::set<GURL>::const_iterator origin = origins.begin(); 40 for (std::set<GURL>::const_iterator origin = origins.begin();
40 origin != origins.end(); ++origin) { 41 origin != origins.end(); ++origin) {
41 quota_manager->DeleteOriginData(*origin, quota_storage_type, 42 quota_manager->DeleteOriginData(*origin, quota_storage_type,
42 quota::QuotaClient::kAllClientsMask, 43 quota::QuotaClient::kAllClientsMask,
43 base::Bind(&DoNothingStatusCallback)); 44 base::Bind(&DoNothingStatusCallback));
44 } 45 }
45 } 46 }
46 47
48 net::CookieMonster* GetCookieMonsterForOrigin(
49 const GURL& storage_origin,
50 net::URLRequestContext* default_request_context) {
51 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
52 net::CookieStore* cookie_store =
53 content::GetContentClient()->browser()->OverrideCookieStoreForURL(
54 storage_origin, NULL);
55 if (!cookie_store) {
56 cookie_store = default_request_context->cookie_store();
57 }
58
59 return cookie_store->GetCookieMonster();
60 }
61
47 void ClearOriginOnIOThread( 62 void ClearOriginOnIOThread(
48 uint32 storage_mask, 63 uint32 storage_mask,
49 const GURL& storage_origin, 64 const GURL& storage_origin,
50 const scoped_refptr<net::URLRequestContextGetter>& request_context, 65 const scoped_refptr<net::URLRequestContextGetter>& request_context,
51 const scoped_refptr<quota::QuotaManager>& quota_manager) { 66 const scoped_refptr<quota::QuotaManager>& quota_manager) {
52 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 67 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
53 68
54 if (storage_mask & StoragePartition::kCookies) { 69 if (storage_mask & StoragePartition::kCookies) {
55 // Handle the cookies. 70 // Handle the cookies.
56 net::CookieMonster* cookie_monster = 71 net::CookieMonster* cookie_monster =
57 request_context->GetURLRequestContext()->cookie_store()-> 72 GetCookieMonsterForOrigin(storage_origin,
58 GetCookieMonster(); 73 request_context->GetURLRequestContext());
59 if (cookie_monster) 74 if (cookie_monster) {
60 cookie_monster->DeleteAllForHostAsync( 75 cookie_monster->DeleteAllForHostAsync(
61 storage_origin, net::CookieMonster::DeleteCallback()); 76 storage_origin, net::CookieMonster::DeleteCallback());
77 }
62 } 78 }
63 79
64 // Handle all HTML5 storage other than DOMStorageContext. 80 // Handle all HTML5 storage other than DOMStorageContext.
65 std::set<GURL> origins; 81 std::set<GURL> origins;
66 origins.insert(storage_origin); 82 origins.insert(storage_origin);
67 if (storage_mask & StoragePartition::kQuotaManagedTemporaryStorage) { 83 if (storage_mask & StoragePartition::kQuotaManagedTemporaryStorage) {
68 ClearQuotaManagedOriginsOnIOThread(quota_manager, 84 ClearQuotaManagedOriginsOnIOThread(quota_manager,
69 origins, 85 origins,
70 quota::kStorageTypeTemporary); 86 quota::kStorageTypeTemporary);
71 } 87 }
72 if (storage_mask & StoragePartition::kQuotaManagedPersistentStorage) { 88 if (storage_mask & StoragePartition::kQuotaManagedPersistentStorage) {
73 ClearQuotaManagedOriginsOnIOThread(quota_manager, 89 ClearQuotaManagedOriginsOnIOThread(quota_manager,
74 origins, 90 origins,
75 quota::kStorageTypePersistent); 91 quota::kStorageTypePersistent);
76 } 92 }
77 } 93 }
78 94
79 void ClearAllDataOnIOThread( 95 void ClearAllDataOnIOThread(
80 uint32 storage_mask, 96 uint32 storage_mask,
81 const scoped_refptr<net::URLRequestContextGetter>& request_context, 97 const scoped_refptr<net::URLRequestContextGetter>& request_context,
82 const scoped_refptr<quota::QuotaManager>& quota_manager) { 98 const scoped_refptr<quota::QuotaManager>& quota_manager) {
83 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 99 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
84 100
85 if (storage_mask & StoragePartition::kCookies) { 101 if (storage_mask & StoragePartition::kCookies) {
86 // Handle the cookies. 102 // Handle the cookies.
87 net::CookieMonster* cookie_monster = 103 net::CookieMonster* cookie_monster = NULL;
88 request_context->GetURLRequestContext()->cookie_store()-> 104 /*
89 GetCookieMonster(); 105 GetCookieMonsterForOrigin(storage_origin,
106 request_context->GetURLRequestContext());
107 */
90 if (cookie_monster) 108 if (cookie_monster)
91 cookie_monster->DeleteAllAsync(net::CookieMonster::DeleteCallback()); 109 cookie_monster->DeleteAllAsync(net::CookieMonster::DeleteCallback());
92 } 110 }
93 111
94 // Handle all HTML5 storage other than DOMStorageContext. 112 // Handle all HTML5 storage other than DOMStorageContext.
95 if (storage_mask & StoragePartition::kQuotaManagedTemporaryStorage) { 113 if (storage_mask & StoragePartition::kQuotaManagedTemporaryStorage) {
96 quota_manager->GetOriginsModifiedSince( 114 quota_manager->GetOriginsModifiedSince(
97 quota::kStorageTypeTemporary, base::Time(), 115 quota::kStorageTypeTemporary, base::Time(),
98 base::Bind(&ClearQuotaManagedOriginsOnIOThread, quota_manager)); 116 base::Bind(&ClearQuotaManagedOriginsOnIOThread, quota_manager));
99 } 117 }
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 DOMStorageContextImpl* StoragePartitionImpl::GetDOMStorageContext() { 265 DOMStorageContextImpl* StoragePartitionImpl::GetDOMStorageContext() {
248 return dom_storage_context_; 266 return dom_storage_context_;
249 } 267 }
250 268
251 IndexedDBContextImpl* StoragePartitionImpl::GetIndexedDBContext() { 269 IndexedDBContextImpl* StoragePartitionImpl::GetIndexedDBContext() {
252 return indexed_db_context_; 270 return indexed_db_context_;
253 } 271 }
254 272
255 void StoragePartitionImpl::AsyncClearDataForOrigin( 273 void StoragePartitionImpl::AsyncClearDataForOrigin(
256 uint32 storage_mask, 274 uint32 storage_mask,
257 const GURL& storage_origin, 275 const GURL& storage_origin) {
258 net::URLRequestContextGetter* request_context_getter) {
259 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 276 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
260 277
261 BrowserThread::PostTask( 278 BrowserThread::PostTask(
262 BrowserThread::IO, FROM_HERE, 279 BrowserThread::IO, FROM_HERE,
263 base::Bind(&ClearOriginOnIOThread, 280 base::Bind(&ClearOriginOnIOThread, storage_mask, storage_origin,
264 storage_mask, 281 url_request_context_, quota_manager_));
265 storage_origin,
266 make_scoped_refptr(request_context_getter),
267 quota_manager_));
268 282
269 if (storage_mask & kLocalDomStorage) 283 if (storage_mask & kLocalDomStorage)
270 GetDOMStorageContext()->DeleteLocalStorage(storage_origin); 284 GetDOMStorageContext()->DeleteLocalStorage(storage_origin);
271 } 285 }
272 286
273 void StoragePartitionImpl::AsyncClearData(uint32 storage_mask) { 287 void StoragePartitionImpl::AsyncClearData(uint32 storage_mask) {
274 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 288 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
275 289
276 // We ignore the media request context because it shares the same cookie store 290 // We ignore the media request context because it shares the same cookie store
277 // as the main request context. 291 // as the main request context.
(...skipping 19 matching lines...) Expand all
297 net::URLRequestContextGetter* url_request_context) { 311 net::URLRequestContextGetter* url_request_context) {
298 url_request_context_ = url_request_context; 312 url_request_context_ = url_request_context;
299 } 313 }
300 314
301 void StoragePartitionImpl::SetMediaURLRequestContext( 315 void StoragePartitionImpl::SetMediaURLRequestContext(
302 net::URLRequestContextGetter* media_url_request_context) { 316 net::URLRequestContextGetter* media_url_request_context) {
303 media_url_request_context_ = media_url_request_context; 317 media_url_request_context_ = media_url_request_context;
304 } 318 }
305 319
306 } // namespace content 320 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698