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" | |
9 #include "content/browser/dom_storage/dom_storage_context_impl.h" | 8 #include "content/browser/dom_storage/dom_storage_context_impl.h" |
10 #include "content/browser/download/download_file_manager.h" | 9 #include "content/browser/download/download_file_factory.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" | |
15 #include "content/public/browser/site_instance.h" | 14 #include "content/public/browser/site_instance.h" |
16 #include "content/browser/storage_partition_impl.h" | 15 #include "content/browser/storage_partition_impl.h" |
17 #include "content/browser/storage_partition_impl_map.h" | 16 #include "content/browser/storage_partition_impl_map.h" |
18 #include "content/common/child_process_host_impl.h" | 17 #include "content/common/child_process_host_impl.h" |
19 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
20 #include "content/public/browser/content_browser_client.h" | 19 #include "content/public/browser/content_browser_client.h" |
| 20 #include "content/public/browser/resource_context.h" |
21 #include "net/base/server_bound_cert_service.h" | 21 #include "net/base/server_bound_cert_service.h" |
22 #include "net/base/server_bound_cert_store.h" | 22 #include "net/base/server_bound_cert_store.h" |
23 #include "net/cookies/cookie_monster.h" | 23 #include "net/cookies/cookie_monster.h" |
24 #include "net/cookies/cookie_store.h" | 24 #include "net/cookies/cookie_store.h" |
25 #include "net/url_request/url_request_context.h" | 25 #include "net/url_request/url_request_context.h" |
26 #include "net/url_request/url_request_context_getter.h" | 26 #include "net/url_request/url_request_context_getter.h" |
| 27 #include "webkit/database/database_tracker.h" |
27 | 28 |
28 using base::UserDataAdapter; | 29 using base::UserDataAdapter; |
29 | 30 |
30 // Key names on BrowserContext. | 31 // Key names on BrowserContext. |
31 static const char* kDownloadManagerKeyName = "download_manager"; | 32 static const char* kDownloadManagerKeyName = "download_manager"; |
32 static const char* kStorageParitionMapKeyName = "content_storage_partition_map"; | 33 static const char* kStorageParitionMapKeyName = "content_storage_partition_map"; |
33 | 34 |
34 namespace content { | 35 namespace content { |
35 | 36 |
36 namespace { | 37 namespace { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 } | 78 } |
78 | 79 |
79 } // namespace | 80 } // namespace |
80 | 81 |
81 DownloadManager* BrowserContext::GetDownloadManager( | 82 DownloadManager* BrowserContext::GetDownloadManager( |
82 BrowserContext* context) { | 83 BrowserContext* context) { |
83 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 84 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
84 if (!context->GetUserData(kDownloadManagerKeyName)) { | 85 if (!context->GetUserData(kDownloadManagerKeyName)) { |
85 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get(); | 86 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get(); |
86 DCHECK(rdh); | 87 DCHECK(rdh); |
87 DownloadFileManager* file_manager = rdh->download_file_manager(); | |
88 DCHECK(file_manager); | |
89 scoped_refptr<DownloadManager> download_manager = | 88 scoped_refptr<DownloadManager> download_manager = |
90 new DownloadManagerImpl( | 89 new DownloadManagerImpl( |
91 file_manager, | |
92 scoped_ptr<DownloadItemFactory>(), | 90 scoped_ptr<DownloadItemFactory>(), |
| 91 scoped_ptr<DownloadFileFactory>(), |
93 GetContentClient()->browser()->GetNetLog()); | 92 GetContentClient()->browser()->GetNetLog()); |
94 | 93 |
95 context->SetUserData( | 94 context->SetUserData( |
96 kDownloadManagerKeyName, | 95 kDownloadManagerKeyName, |
97 new UserDataAdapter<DownloadManager>(download_manager)); | 96 new UserDataAdapter<DownloadManager>(download_manager)); |
98 download_manager->SetDelegate(context->GetDownloadManagerDelegate()); | 97 download_manager->SetDelegate(context->GetDownloadManagerDelegate()); |
99 download_manager->Init(context); | 98 download_manager->Init(context); |
100 } | 99 } |
101 | 100 |
102 return UserDataAdapter<DownloadManager>::Get( | 101 return UserDataAdapter<DownloadManager>::Get( |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 ForEachStoragePartition(browser_context, | 218 ForEachStoragePartition(browser_context, |
220 base::Bind(&PurgeDOMStorageContextInPartition)); | 219 base::Bind(&PurgeDOMStorageContextInPartition)); |
221 } | 220 } |
222 | 221 |
223 BrowserContext::~BrowserContext() { | 222 BrowserContext::~BrowserContext() { |
224 if (GetUserData(kDownloadManagerKeyName)) | 223 if (GetUserData(kDownloadManagerKeyName)) |
225 GetDownloadManager(this)->Shutdown(); | 224 GetDownloadManager(this)->Shutdown(); |
226 } | 225 } |
227 | 226 |
228 } // namespace content | 227 } // namespace content |
OLD | NEW |