Chromium Code Reviews| Index: content/browser/browser_context.cc |
| =================================================================== |
| --- content/browser/browser_context.cc (revision 140592) |
| +++ content/browser/browser_context.cc (working copy) |
| @@ -6,10 +6,12 @@ |
| #include "content/browser/appcache/chrome_appcache_service.h" |
| #include "content/browser/dom_storage/dom_storage_context_impl.h" |
| +#include "content/browser/download/download_manager_impl.h" |
| #include "content/browser/fileapi/browser_file_system_helper.h" |
| #include "content/browser/in_process_webkit/indexed_db_context_impl.h" |
| #include "content/browser/resource_context_impl.h" |
| #include "content/public/browser/browser_thread.h" |
| +#include "content/public/browser/content_browser_client.h" |
| #include "content/public/common/content_constants.h" |
| #include "net/base/server_bound_cert_service.h" |
| #include "net/base/server_bound_cert_store.h" |
| @@ -30,6 +32,7 @@ |
| static const char* kAppCacheServicKeyName = "content_appcache_service_tracker"; |
| static const char* kDatabaseTrackerKeyName = "content_database_tracker"; |
| static const char* kDOMStorageContextKeyName = "content_dom_storage_context"; |
| +static const char* kDownloadManagerKeyName = "download_manager"; |
| static const char* kFileSystemContextKeyName = "content_file_system_context"; |
| static const char* kIndexedDBContextKeyName = "content_indexed_db_context"; |
| static const char* kQuotaManagerKeyName = "content_quota_manager"; |
| @@ -136,6 +139,22 @@ |
| } // namespace |
| +DownloadManager* BrowserContext::GetDownloadManager( |
| + BrowserContext* context) { |
| + if(!context->GetUserData(kDownloadManagerKeyName)) { |
|
Avi (use Gerrit)
2012/06/06 14:49:45
style nit: space between if (
|
| + scoped_refptr<DownloadManager> download_manager = new DownloadManagerImpl( |
| + GetContentClient()->browser()->GetNetLog()); |
| + context->SetUserData( |
| + kDownloadManagerKeyName, |
| + new UserDataAdapter<DownloadManager>(download_manager)); |
| + download_manager->SetDelegate(context->GetDownloadManagerDelegate()); |
| + download_manager->Init(context); |
| + } |
| + |
| + return UserDataAdapter<DownloadManager>::Get( |
| + context, kDownloadManagerKeyName); |
| +} |
| + |
| QuotaManager* BrowserContext::GetQuotaManager(BrowserContext* context) { |
| CreateQuotaManagerAndClients(context); |
| return UserDataAdapter<QuotaManager>::Get(context, kQuotaManagerKeyName); |
| @@ -229,6 +248,9 @@ |
| if (GetUserData(kDOMStorageContextKeyName)) |
| GetDOMStorageContextImpl(this)->Shutdown(); |
| + |
| + if (GetUserData(kDownloadManagerKeyName)) |
| + GetDownloadManager(this)->Shutdown(); |
| } |
| } // namespace content |