OLD | NEW |
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/public/browser/browser_context.h" | 5 #include "content/public/browser/browser_context.h" |
6 | 6 |
7 #if !defined(OS_IOS) | 7 #if !defined(OS_IOS) |
8 #include "content/browser/appcache/chrome_appcache_service.h" | 8 #include "content/browser/appcache/chrome_appcache_service.h" |
9 #include "content/browser/dom_storage/dom_storage_context_impl.h" | 9 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" |
10 #include "content/browser/download/download_manager_impl.h" | 10 #include "content/browser/download/download_manager_impl.h" |
11 #include "content/browser/indexed_db/indexed_db_context_impl.h" | 11 #include "content/browser/indexed_db/indexed_db_context_impl.h" |
12 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 12 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
13 #include "content/browser/storage_partition_impl.h" | 13 #include "content/browser/storage_partition_impl.h" |
14 #include "content/browser/storage_partition_impl_map.h" | 14 #include "content/browser/storage_partition_impl_map.h" |
15 #include "content/common/child_process_host_impl.h" | 15 #include "content/common/child_process_host_impl.h" |
16 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
17 #include "content/public/browser/content_browser_client.h" | 17 #include "content/public/browser/content_browser_client.h" |
18 #include "content/public/browser/site_instance.h" | 18 #include "content/public/browser/site_instance.h" |
19 #include "net/cookies/cookie_monster.h" | 19 #include "net/cookies/cookie_monster.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 bool in_memory) { | 58 bool in_memory) { |
59 StoragePartitionImplMap* partition_map = | 59 StoragePartitionImplMap* partition_map = |
60 GetStoragePartitionMap(browser_context); | 60 GetStoragePartitionMap(browser_context); |
61 | 61 |
62 if (browser_context->IsOffTheRecord()) | 62 if (browser_context->IsOffTheRecord()) |
63 in_memory = true; | 63 in_memory = true; |
64 | 64 |
65 return partition_map->Get(partition_domain, partition_name, in_memory); | 65 return partition_map->Get(partition_domain, partition_name, in_memory); |
66 } | 66 } |
67 | 67 |
68 // Run |callback| on each DOMStorageContextImpl in |browser_context|. | 68 // Run |callback| on each DOMStorageContextWrapper in |browser_context|. |
69 void PurgeDOMStorageContextInPartition(StoragePartition* storage_partition) { | 69 void PurgeDOMStorageContextInPartition(StoragePartition* storage_partition) { |
70 static_cast<StoragePartitionImpl*>(storage_partition)-> | 70 static_cast<StoragePartitionImpl*>(storage_partition)-> |
71 GetDOMStorageContext()->PurgeMemory(); | 71 GetDOMStorageContext()->PurgeMemory(); |
72 } | 72 } |
73 | 73 |
74 void SaveSessionStateOnIOThread( | 74 void SaveSessionStateOnIOThread( |
75 const scoped_refptr<net::URLRequestContextGetter>& context_getter, | 75 const scoped_refptr<net::URLRequestContextGetter>& context_getter, |
76 appcache::AppCacheService* appcache_service) { | 76 appcache::AppCacheService* appcache_service) { |
77 net::URLRequestContext* context = context_getter->GetURLRequestContext(); | 77 net::URLRequestContext* context = context_getter->GetURLRequestContext(); |
78 context->cookie_store()->GetCookieMonster()-> | 78 context->cookie_store()->GetCookieMonster()-> |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 | 226 |
227 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO)) { | 227 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO)) { |
228 BrowserThread::PostTask( | 228 BrowserThread::PostTask( |
229 BrowserThread::IO, FROM_HERE, | 229 BrowserThread::IO, FROM_HERE, |
230 base::Bind( | 230 base::Bind( |
231 &SaveSessionStateOnIOThread, | 231 &SaveSessionStateOnIOThread, |
232 make_scoped_refptr(browser_context->GetRequestContext()), | 232 make_scoped_refptr(browser_context->GetRequestContext()), |
233 storage_partition->GetAppCacheService())); | 233 storage_partition->GetAppCacheService())); |
234 } | 234 } |
235 | 235 |
236 DOMStorageContextImpl* dom_storage_context_impl = | 236 DOMStorageContextWrapper* dom_storage_context_proxy = |
237 static_cast<DOMStorageContextImpl*>( | 237 static_cast<DOMStorageContextWrapper*>( |
238 storage_partition->GetDOMStorageContext()); | 238 storage_partition->GetDOMStorageContext()); |
239 dom_storage_context_impl->SetForceKeepSessionState(); | 239 dom_storage_context_proxy->SetForceKeepSessionState(); |
240 | 240 |
241 IndexedDBContextImpl* indexed_db_context_impl = | 241 IndexedDBContextImpl* indexed_db_context_impl = |
242 static_cast<IndexedDBContextImpl*>( | 242 static_cast<IndexedDBContextImpl*>( |
243 storage_partition->GetIndexedDBContext()); | 243 storage_partition->GetIndexedDBContext()); |
244 // No task runner in unit tests. | 244 // No task runner in unit tests. |
245 if (indexed_db_context_impl->TaskRunner()) { | 245 if (indexed_db_context_impl->TaskRunner()) { |
246 indexed_db_context_impl->TaskRunner()->PostTask( | 246 indexed_db_context_impl->TaskRunner()->PostTask( |
247 FROM_HERE, | 247 FROM_HERE, |
248 base::Bind(&SaveSessionStateOnIndexedDBThread, | 248 base::Bind(&SaveSessionStateOnIndexedDBThread, |
249 make_scoped_refptr(indexed_db_context_impl))); | 249 make_scoped_refptr(indexed_db_context_impl))); |
(...skipping 17 matching lines...) Expand all Loading... |
267 #endif // !OS_IOS | 267 #endif // !OS_IOS |
268 | 268 |
269 BrowserContext::~BrowserContext() { | 269 BrowserContext::~BrowserContext() { |
270 #if !defined(OS_IOS) | 270 #if !defined(OS_IOS) |
271 if (GetUserData(kDownloadManagerKeyName)) | 271 if (GetUserData(kDownloadManagerKeyName)) |
272 GetDownloadManager(this)->Shutdown(); | 272 GetDownloadManager(this)->Shutdown(); |
273 #endif | 273 #endif |
274 } | 274 } |
275 | 275 |
276 } // namespace content | 276 } // namespace content |
OLD | NEW |