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

Unified Diff: chrome/browser/autofill/personal_data_manager_factory.cc

Issue 7967024: Profile shouldn't own PersonalDataManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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/autofill/personal_data_manager_factory.cc
diff --git a/chrome/browser/autofill/personal_data_manager_factory.cc b/chrome/browser/autofill/personal_data_manager_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..1d09fac332511284575a605d4358751b8ec66d49
--- /dev/null
+++ b/chrome/browser/autofill/personal_data_manager_factory.cc
@@ -0,0 +1,37 @@
+// 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/autofill/personal_data_manager_factory.h"
+
+#include "chrome/browser/autofill/personal_data_manager.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/profiles/profile_dependency_manager.h"
+
+// static
+PersonalDataManager* PersonalDataManagerFactory::GetForProfile(
+ Profile* profile) {
+ return static_cast<PersonalDataManager*>(
+ GetInstance()->GetServiceForProfile(profile, true));
+}
+
+// static
+PersonalDataManagerFactory* PersonalDataManagerFactory::GetInstance() {
+ return Singleton<PersonalDataManagerFactory>::get();
+}
+
+PersonalDataManagerFactory::PersonalDataManagerFactory()
+ : ProfileKeyedServiceFactory(ProfileDependencyManager::GetInstance()) {
+ // TODO(erg): For Shutdown() order, we need to:
Ilya Sherman 2011/09/23 03:56:34 Is this TODO intentionally unimplemented for now?
dhollowa 2011/09/23 16:30:03 Yes, this is a note to erg@ to set up dependencies
+ // DependsOn(WebDataServiceFactory::GetInstance());
+}
+
+PersonalDataManagerFactory::~PersonalDataManagerFactory() {
+}
+
+ProfileKeyedService* PersonalDataManagerFactory::BuildServiceInstanceFor(
+ Profile* profile) const {
+ PersonalDataManager* personal_data_manager = new PersonalDataManager();
+ personal_data_manager->Init(profile);
Ilya Sherman 2011/09/23 03:56:34 Do we still need to provide a constructor and an I
dhollowa 2011/09/23 16:30:03 Yes, the two-phase init is required for testing.
+ return personal_data_manager;
+}

Powered by Google App Engine
This is Rietveld 408576698