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" | |
11 #include "content/browser/download/download_manager_impl.h" | 10 #include "content/browser/download/download_manager_impl.h" |
12 #include "content/browser/in_process_webkit/indexed_db_context_impl.h" | 11 #include "content/browser/in_process_webkit/indexed_db_context_impl.h" |
13 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h" | 12 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h" |
14 #include "content/public/browser/resource_context.h" | 13 #include "content/public/browser/resource_context.h" |
15 #include "content/browser/storage_partition_impl.h" | 14 #include "content/browser/storage_partition_impl.h" |
16 #include "content/browser/storage_partition_impl_map.h" | 15 #include "content/browser/storage_partition_impl_map.h" |
17 #include "content/common/child_process_host_impl.h" | 16 #include "content/common/child_process_host_impl.h" |
18 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
19 #include "content/public/browser/content_browser_client.h" | 18 #include "content/public/browser/content_browser_client.h" |
20 #include "net/base/server_bound_cert_service.h" | 19 #include "net/base/server_bound_cert_service.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 } | 72 } |
74 | 73 |
75 } // namespace | 74 } // namespace |
76 | 75 |
77 DownloadManager* BrowserContext::GetDownloadManager( | 76 DownloadManager* BrowserContext::GetDownloadManager( |
78 BrowserContext* context) { | 77 BrowserContext* context) { |
79 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 78 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
80 if (!context->GetUserData(kDownloadManagerKeyName)) { | 79 if (!context->GetUserData(kDownloadManagerKeyName)) { |
81 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get(); | 80 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get(); |
82 DCHECK(rdh); | 81 DCHECK(rdh); |
83 DownloadFileManager* file_manager = rdh->download_file_manager(); | |
84 DCHECK(file_manager); | |
85 scoped_refptr<DownloadManager> download_manager = | 82 scoped_refptr<DownloadManager> download_manager = |
86 new DownloadManagerImpl( | 83 new DownloadManagerImpl( |
87 file_manager, | |
88 scoped_ptr<DownloadItemFactory>(), | 84 scoped_ptr<DownloadItemFactory>(), |
89 GetContentClient()->browser()->GetNetLog()); | 85 GetContentClient()->browser()->GetNetLog()); |
90 | 86 |
91 context->SetUserData( | 87 context->SetUserData( |
92 kDownloadManagerKeyName, | 88 kDownloadManagerKeyName, |
93 new UserDataAdapter<DownloadManager>(download_manager)); | 89 new UserDataAdapter<DownloadManager>(download_manager)); |
94 download_manager->SetDelegate(context->GetDownloadManagerDelegate()); | 90 download_manager->SetDelegate(context->GetDownloadManagerDelegate()); |
95 download_manager->Init(context); | 91 download_manager->Init(context); |
96 } | 92 } |
97 | 93 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 ForEachStoragePartition(browser_context, | 211 ForEachStoragePartition(browser_context, |
216 base::Bind(&PurgeDOMStorageContextInPartition)); | 212 base::Bind(&PurgeDOMStorageContextInPartition)); |
217 } | 213 } |
218 | 214 |
219 BrowserContext::~BrowserContext() { | 215 BrowserContext::~BrowserContext() { |
220 if (GetUserData(kDownloadManagerKeyName)) | 216 if (GetUserData(kDownloadManagerKeyName)) |
221 GetDownloadManager(this)->Shutdown(); | 217 GetDownloadManager(this)->Shutdown(); |
222 } | 218 } |
223 | 219 |
224 } // namespace content | 220 } // namespace content |
OLD | NEW |