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 #if !defined(OS_IOS) | 7 #if !defined(OS_IOS) |
8 #include "content/browser/appcache/chrome_appcache_service.h" | 8 #include "content/browser/appcache/chrome_appcache_service.h" |
9 #include "webkit/database/database_tracker.h" | |
10 #include "content/browser/dom_storage/dom_storage_context_impl.h" | 9 #include "content/browser/dom_storage/dom_storage_context_impl.h" |
11 #include "content/browser/download/download_file_manager.h" | |
12 #include "content/browser/download/download_manager_impl.h" | 10 #include "content/browser/download/download_manager_impl.h" |
13 #include "content/browser/in_process_webkit/indexed_db_context_impl.h" | 11 #include "content/browser/in_process_webkit/indexed_db_context_impl.h" |
14 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h" | 12 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h" |
15 #include "content/public/browser/resource_context.h" | |
16 #include "content/public/browser/site_instance.h" | 13 #include "content/public/browser/site_instance.h" |
17 #include "content/browser/storage_partition_impl.h" | 14 #include "content/browser/storage_partition_impl.h" |
18 #include "content/browser/storage_partition_impl_map.h" | 15 #include "content/browser/storage_partition_impl_map.h" |
19 #include "content/common/child_process_host_impl.h" | 16 #include "content/common/child_process_host_impl.h" |
20 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
21 #include "content/public/browser/content_browser_client.h" | 18 #include "content/public/browser/content_browser_client.h" |
22 #include "net/base/server_bound_cert_service.h" | 19 #include "net/base/server_bound_cert_service.h" |
23 #include "net/base/server_bound_cert_store.h" | 20 #include "net/base/server_bound_cert_store.h" |
24 #include "net/cookies/cookie_monster.h" | 21 #include "net/cookies/cookie_monster.h" |
25 #include "net/cookies/cookie_store.h" | 22 #include "net/cookies/cookie_store.h" |
26 #include "net/url_request/url_request_context.h" | 23 #include "net/url_request/url_request_context.h" |
27 #include "net/url_request/url_request_context_getter.h" | 24 #include "net/url_request/url_request_context_getter.h" |
| 25 #include "webkit/database/database_tracker.h" |
28 #endif // !OS_IOS | 26 #endif // !OS_IOS |
29 | 27 |
30 using base::UserDataAdapter; | 28 using base::UserDataAdapter; |
31 | 29 |
32 namespace content { | 30 namespace content { |
33 | 31 |
34 // Only ~BrowserContext() is needed on iOS. | 32 // Only ~BrowserContext() is needed on iOS. |
35 #if !defined(OS_IOS) | 33 #if !defined(OS_IOS) |
36 namespace { | 34 namespace { |
37 | 35 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 } | 79 } |
82 | 80 |
83 } // namespace | 81 } // namespace |
84 | 82 |
85 DownloadManager* BrowserContext::GetDownloadManager( | 83 DownloadManager* BrowserContext::GetDownloadManager( |
86 BrowserContext* context) { | 84 BrowserContext* context) { |
87 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 85 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
88 if (!context->GetUserData(kDownloadManagerKeyName)) { | 86 if (!context->GetUserData(kDownloadManagerKeyName)) { |
89 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get(); | 87 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get(); |
90 DCHECK(rdh); | 88 DCHECK(rdh); |
91 DownloadFileManager* file_manager = rdh->download_file_manager(); | |
92 DCHECK(file_manager); | |
93 scoped_refptr<DownloadManager> download_manager = | 89 scoped_refptr<DownloadManager> download_manager = |
94 new DownloadManagerImpl( | 90 new DownloadManagerImpl( |
95 file_manager, | |
96 scoped_ptr<DownloadItemFactory>(), | |
97 GetContentClient()->browser()->GetNetLog()); | 91 GetContentClient()->browser()->GetNetLog()); |
98 | 92 |
99 context->SetUserData( | 93 context->SetUserData( |
100 kDownloadManagerKeyName, | 94 kDownloadManagerKeyName, |
101 new UserDataAdapter<DownloadManager>(download_manager)); | 95 new UserDataAdapter<DownloadManager>(download_manager)); |
102 download_manager->SetDelegate(context->GetDownloadManagerDelegate()); | 96 download_manager->SetDelegate(context->GetDownloadManagerDelegate()); |
103 download_manager->Init(context); | 97 download_manager->Init(context); |
104 } | 98 } |
105 | 99 |
106 return UserDataAdapter<DownloadManager>::Get( | 100 return UserDataAdapter<DownloadManager>::Get( |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 #endif // !OS_IOS | 201 #endif // !OS_IOS |
208 | 202 |
209 BrowserContext::~BrowserContext() { | 203 BrowserContext::~BrowserContext() { |
210 #if !defined(OS_IOS) | 204 #if !defined(OS_IOS) |
211 if (GetUserData(kDownloadManagerKeyName)) | 205 if (GetUserData(kDownloadManagerKeyName)) |
212 GetDownloadManager(this)->Shutdown(); | 206 GetDownloadManager(this)->Shutdown(); |
213 #endif | 207 #endif |
214 } | 208 } |
215 | 209 |
216 } // namespace content | 210 } // namespace content |
OLD | NEW |