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

Unified Diff: chrome/browser/download/download_service_factory.cc

Issue 8135017: Refactor downloads into a ProfileKeyedService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporated latest rounds of comments from John. Created 9 years, 2 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: chrome/browser/download/download_service_factory.cc
diff --git a/chrome/browser/download/download_service_factory.cc b/chrome/browser/download/download_service_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..473597c1109df4c6cab33c11f5d9c55e96f870aa
--- /dev/null
+++ b/chrome/browser/download/download_service_factory.cc
@@ -0,0 +1,44 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/download/download_service_factory.h"
+
+#include "chrome/browser/download/download_service.h"
+#include "chrome/browser/profiles/profile_dependency_manager.h"
+
+// static
+DownloadService* DownloadServiceFactory::GetForProfile(
+ Profile* profile) {
+ return static_cast<DownloadService*>(
+ GetInstance()->GetServiceForProfile(profile, true));
+}
+
+// static
+DownloadServiceFactory* DownloadServiceFactory::GetInstance() {
+ return Singleton<DownloadServiceFactory>::get();
+}
+
+DownloadServiceFactory::DownloadServiceFactory()
+ : ProfileKeyedServiceFactory(
+ ProfileDependencyManager::GetInstance()) {
+ // TODO(rdsmith): For Shutdown() order we need to:
+ // DependsOn(HistoryServiceDataFactory::GetInstance());
+}
+
+DownloadServiceFactory::~DownloadServiceFactory() {
+}
+
+ProfileKeyedService* DownloadServiceFactory::BuildServiceInstanceFor(
+ Profile* profile) const {
+ DownloadService* service = new DownloadService(profile);
+
+ // No need for initialization; initialization can be done on first
+ // use of service.
+
+ return service;
+}
+
+bool DownloadServiceFactory::ServiceHasOwnInstanceInIncognito() {
+ return true;
+}
« no previous file with comments | « chrome/browser/download/download_service_factory.h ('k') | chrome/browser/download/save_page_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698