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 "content/browser/dom_storage/dom_storage_context_impl.h" | 9 #include "content/browser/dom_storage/dom_storage_context_impl.h" |
9 #include "content/browser/download/download_file_factory.h" | 10 #include "content/browser/download/download_file_manager.h" |
10 #include "content/browser/download/download_item_factory.h" | |
11 #include "content/browser/download/download_manager_impl.h" | 11 #include "content/browser/download/download_manager_impl.h" |
12 #include "content/browser/in_process_webkit/indexed_db_context_impl.h" | 12 #include "content/browser/in_process_webkit/indexed_db_context_impl.h" |
13 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h" | 13 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h" |
| 14 #include "content/public/browser/resource_context.h" |
14 #include "content/browser/storage_partition_impl.h" | 15 #include "content/browser/storage_partition_impl.h" |
15 #include "content/browser/storage_partition_impl_map.h" | 16 #include "content/browser/storage_partition_impl_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 "content/public/browser/resource_context.h" | |
20 #include "net/base/server_bound_cert_service.h" | 20 #include "net/base/server_bound_cert_service.h" |
21 #include "net/base/server_bound_cert_store.h" | 21 #include "net/base/server_bound_cert_store.h" |
22 #include "net/cookies/cookie_monster.h" | 22 #include "net/cookies/cookie_monster.h" |
23 #include "net/cookies/cookie_store.h" | 23 #include "net/cookies/cookie_store.h" |
24 #include "net/url_request/url_request_context.h" | 24 #include "net/url_request/url_request_context.h" |
25 #include "webkit/database/database_tracker.h" | |
26 | 25 |
27 using base::UserDataAdapter; | 26 using base::UserDataAdapter; |
28 | 27 |
29 // Key names on BrowserContext. | 28 // Key names on BrowserContext. |
30 static const char* kDownloadManagerKeyName = "download_manager"; | 29 static const char* kDownloadManagerKeyName = "download_manager"; |
31 static const char* kStorageParitionMapKeyName = "content_storage_partition_map"; | 30 static const char* kStorageParitionMapKeyName = "content_storage_partition_map"; |
32 | 31 |
33 namespace content { | 32 namespace content { |
34 | 33 |
35 namespace { | 34 namespace { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 } | 73 } |
75 | 74 |
76 } // namespace | 75 } // namespace |
77 | 76 |
78 DownloadManager* BrowserContext::GetDownloadManager( | 77 DownloadManager* BrowserContext::GetDownloadManager( |
79 BrowserContext* context) { | 78 BrowserContext* context) { |
80 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 79 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
81 if (!context->GetUserData(kDownloadManagerKeyName)) { | 80 if (!context->GetUserData(kDownloadManagerKeyName)) { |
82 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get(); | 81 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get(); |
83 DCHECK(rdh); | 82 DCHECK(rdh); |
| 83 DownloadFileManager* file_manager = rdh->download_file_manager(); |
| 84 DCHECK(file_manager); |
84 scoped_refptr<DownloadManager> download_manager = | 85 scoped_refptr<DownloadManager> download_manager = |
85 new DownloadManagerImpl( | 86 new DownloadManagerImpl( |
| 87 file_manager, |
86 scoped_ptr<DownloadItemFactory>(), | 88 scoped_ptr<DownloadItemFactory>(), |
87 scoped_ptr<DownloadFileFactory>(), | |
88 GetContentClient()->browser()->GetNetLog()); | 89 GetContentClient()->browser()->GetNetLog()); |
89 | 90 |
90 context->SetUserData( | 91 context->SetUserData( |
91 kDownloadManagerKeyName, | 92 kDownloadManagerKeyName, |
92 new UserDataAdapter<DownloadManager>(download_manager)); | 93 new UserDataAdapter<DownloadManager>(download_manager)); |
93 download_manager->SetDelegate(context->GetDownloadManagerDelegate()); | 94 download_manager->SetDelegate(context->GetDownloadManagerDelegate()); |
94 download_manager->Init(context); | 95 download_manager->Init(context); |
95 } | 96 } |
96 | 97 |
97 return UserDataAdapter<DownloadManager>::Get( | 98 return UserDataAdapter<DownloadManager>::Get( |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 ForEachStoragePartition(browser_context, | 208 ForEachStoragePartition(browser_context, |
208 base::Bind(&PurgeDOMStorageContextInPartition)); | 209 base::Bind(&PurgeDOMStorageContextInPartition)); |
209 } | 210 } |
210 | 211 |
211 BrowserContext::~BrowserContext() { | 212 BrowserContext::~BrowserContext() { |
212 if (GetUserData(kDownloadManagerKeyName)) | 213 if (GetUserData(kDownloadManagerKeyName)) |
213 GetDownloadManager(this)->Shutdown(); | 214 GetDownloadManager(this)->Shutdown(); |
214 } | 215 } |
215 | 216 |
216 } // namespace content | 217 } // namespace content |
OLD | NEW |