Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(314)

Unified Diff: content/browser/browser_context.cc

Issue 10535026: Move creation and ownership of DownloadManager from the embedder to content. This matches all the o… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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,17 @@
} // namespace
+DownloadManager* BrowserContext::GetDownloadManager(
Avi (use Gerrit) 2012/06/05 23:34:41 This DCHECKs if you call it more than once? Don't
jam 2012/06/05 23:47:16 I hadn't tested it yet (was parallelizing review+t
+ BrowserContext* context) {
+ DCHECK(!context->GetUserData(kDownloadManagerKeyName));
+ scoped_refptr<DownloadManager> download_manager = new DownloadManagerImpl(
+ GetContentClient()->browser()->GetNetLog());
+ download_manager->Init(context);
+ context->SetUserData(kDownloadManagerKeyName,
+ new UserDataAdapter<DownloadManager>(download_manager));
+ return download_manager;
+}
+
QuotaManager* BrowserContext::GetQuotaManager(BrowserContext* context) {
CreateQuotaManagerAndClients(context);
return UserDataAdapter<QuotaManager>::Get(context, kQuotaManagerKeyName);

Powered by Google App Engine
This is Rietveld 408576698