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.h" | 14 #include "content/browser/storage_partition.h" |
16 #include "content/browser/storage_partition_map.h" | 15 #include "content/browser/storage_partition_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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 } | 103 } |
105 | 104 |
106 } // namespace | 105 } // namespace |
107 | 106 |
108 DownloadManager* BrowserContext::GetDownloadManager( | 107 DownloadManager* BrowserContext::GetDownloadManager( |
109 BrowserContext* context) { | 108 BrowserContext* context) { |
110 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 109 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
111 if (!context->GetUserData(kDownloadManagerKeyName)) { | 110 if (!context->GetUserData(kDownloadManagerKeyName)) { |
112 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get(); | 111 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get(); |
113 DCHECK(rdh); | 112 DCHECK(rdh); |
114 DownloadFileManager* file_manager = rdh->download_file_manager(); | |
115 DCHECK(file_manager); | |
116 scoped_refptr<DownloadManager> download_manager = | 113 scoped_refptr<DownloadManager> download_manager = |
117 new DownloadManagerImpl( | 114 new DownloadManagerImpl( |
118 file_manager, | |
119 scoped_ptr<DownloadItemFactory>(), | 115 scoped_ptr<DownloadItemFactory>(), |
120 GetContentClient()->browser()->GetNetLog()); | 116 GetContentClient()->browser()->GetNetLog()); |
121 | 117 |
122 context->SetUserData( | 118 context->SetUserData( |
123 kDownloadManagerKeyName, | 119 kDownloadManagerKeyName, |
124 new UserDataAdapter<DownloadManager>(download_manager)); | 120 new UserDataAdapter<DownloadManager>(download_manager)); |
125 download_manager->SetDelegate(context->GetDownloadManagerDelegate()); | 121 download_manager->SetDelegate(context->GetDownloadManagerDelegate()); |
126 download_manager->Init(context); | 122 download_manager->Init(context); |
127 } | 123 } |
128 | 124 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 ForEachDOMStorageContext(browser_context, | 239 ForEachDOMStorageContext(browser_context, |
244 base::Bind(&DOMStorageContextImpl::PurgeMemory)); | 240 base::Bind(&DOMStorageContextImpl::PurgeMemory)); |
245 } | 241 } |
246 | 242 |
247 BrowserContext::~BrowserContext() { | 243 BrowserContext::~BrowserContext() { |
248 if (GetUserData(kDownloadManagerKeyName)) | 244 if (GetUserData(kDownloadManagerKeyName)) |
249 GetDownloadManager(this)->Shutdown(); | 245 GetDownloadManager(this)->Shutdown(); |
250 } | 246 } |
251 | 247 |
252 } // namespace content | 248 } // namespace content |
OLD | NEW |