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 #include "content/browser/appcache/chrome_appcache_service.h" | 7 #include "content/browser/appcache/chrome_appcache_service.h" |
8 #include "webkit/database/database_tracker.h" | 8 #include "webkit/database/database_tracker.h" |
9 #include "content/browser/dom_storage/dom_storage_context_impl.h" | 9 #include "content/browser/dom_storage/dom_storage_context_impl.h" |
| 10 #include "content/browser/download/download_file_manager.h" |
10 #include "content/browser/download/download_manager_impl.h" | 11 #include "content/browser/download/download_manager_impl.h" |
11 #include "content/browser/in_process_webkit/indexed_db_context_impl.h" | 12 #include "content/browser/in_process_webkit/indexed_db_context_impl.h" |
12 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h" | 13 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h" |
13 #include "content/public/browser/resource_context.h" | 14 #include "content/public/browser/resource_context.h" |
14 #include "content/browser/storage_partition.h" | 15 #include "content/browser/storage_partition.h" |
15 #include "content/browser/storage_partition_map.h" | 16 #include "content/browser/storage_partition_map.h" |
16 #include "content/common/child_process_host_impl.h" | 17 #include "content/common/child_process_host_impl.h" |
17 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
18 #include "content/public/browser/content_browser_client.h" | 19 #include "content/public/browser/content_browser_client.h" |
19 #include "net/base/server_bound_cert_service.h" | 20 #include "net/base/server_bound_cert_service.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 } | 110 } |
110 | 111 |
111 } // namespace | 112 } // namespace |
112 | 113 |
113 DownloadManager* BrowserContext::GetDownloadManager( | 114 DownloadManager* BrowserContext::GetDownloadManager( |
114 BrowserContext* context) { | 115 BrowserContext* context) { |
115 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 116 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
116 if (!context->GetUserData(kDownloadManagerKeyName)) { | 117 if (!context->GetUserData(kDownloadManagerKeyName)) { |
117 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get(); | 118 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get(); |
118 DCHECK(rdh); | 119 DCHECK(rdh); |
| 120 DownloadFileManager* file_manager = rdh->download_file_manager(); |
| 121 DCHECK(file_manager); |
119 scoped_refptr<DownloadManager> download_manager = | 122 scoped_refptr<DownloadManager> download_manager = |
120 new DownloadManagerImpl( | 123 new DownloadManagerImpl( |
| 124 file_manager, |
121 scoped_ptr<DownloadItemFactory>(), | 125 scoped_ptr<DownloadItemFactory>(), |
122 GetContentClient()->browser()->GetNetLog()); | 126 GetContentClient()->browser()->GetNetLog()); |
123 | 127 |
124 context->SetUserData( | 128 context->SetUserData( |
125 kDownloadManagerKeyName, | 129 kDownloadManagerKeyName, |
126 new UserDataAdapter<DownloadManager>(download_manager)); | 130 new UserDataAdapter<DownloadManager>(download_manager)); |
127 download_manager->SetDelegate(context->GetDownloadManagerDelegate()); | 131 download_manager->SetDelegate(context->GetDownloadManagerDelegate()); |
128 download_manager->Init(context); | 132 download_manager->Init(context); |
129 } | 133 } |
130 | 134 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 ForEachDOMStorageContext(browser_context, | 257 ForEachDOMStorageContext(browser_context, |
254 base::Bind(&DOMStorageContextImpl::PurgeMemory)); | 258 base::Bind(&DOMStorageContextImpl::PurgeMemory)); |
255 } | 259 } |
256 | 260 |
257 BrowserContext::~BrowserContext() { | 261 BrowserContext::~BrowserContext() { |
258 if (GetUserData(kDownloadManagerKeyName)) | 262 if (GetUserData(kDownloadManagerKeyName)) |
259 GetDownloadManager(this)->Shutdown(); | 263 GetDownloadManager(this)->Shutdown(); |
260 } | 264 } |
261 | 265 |
262 } // namespace content | 266 } // namespace content |
OLD | NEW |