| 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 "chrome/browser/autofill/personal_data_manager_factory.h" | 5 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
| 6 | 6 |
| 7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
| 8 #include "chrome/browser/autofill/personal_data_manager.h" | 8 #include "chrome/browser/autofill/personal_data_manager.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/profiles/profile_dependency_manager.h" | 10 #include "chrome/browser/profiles/profile_dependency_manager.h" |
| 11 #include "chrome/browser/webdata/web_data_service_factory.h" |
| 11 | 12 |
| 12 // static | 13 // static |
| 13 PersonalDataManager* PersonalDataManagerFactory::GetForProfile( | 14 PersonalDataManager* PersonalDataManagerFactory::GetForProfile( |
| 14 Profile* profile) { | 15 Profile* profile) { |
| 15 return static_cast<PersonalDataManager*>( | 16 return static_cast<PersonalDataManager*>( |
| 16 GetInstance()->GetServiceForProfile(profile, true)); | 17 GetInstance()->GetServiceForProfile(profile, true)); |
| 17 } | 18 } |
| 18 | 19 |
| 19 // static | 20 // static |
| 20 PersonalDataManagerFactory* PersonalDataManagerFactory::GetInstance() { | 21 PersonalDataManagerFactory* PersonalDataManagerFactory::GetInstance() { |
| 21 return Singleton<PersonalDataManagerFactory>::get(); | 22 return Singleton<PersonalDataManagerFactory>::get(); |
| 22 } | 23 } |
| 23 | 24 |
| 24 PersonalDataManagerFactory::PersonalDataManagerFactory() | 25 PersonalDataManagerFactory::PersonalDataManagerFactory() |
| 25 : ProfileKeyedServiceFactory("PersonalDataManager", | 26 : ProfileKeyedServiceFactory("PersonalDataManager", |
| 26 ProfileDependencyManager::GetInstance()) { | 27 ProfileDependencyManager::GetInstance()) { |
| 27 // TODO(erg): For Shutdown() order, we need to: | 28 DependsOn(WebDataServiceFactory::GetInstance()); |
| 28 // DependsOn(WebDataServiceFactory::GetInstance()); | |
| 29 } | 29 } |
| 30 | 30 |
| 31 PersonalDataManagerFactory::~PersonalDataManagerFactory() { | 31 PersonalDataManagerFactory::~PersonalDataManagerFactory() { |
| 32 } | 32 } |
| 33 | 33 |
| 34 ProfileKeyedService* PersonalDataManagerFactory::BuildServiceInstanceFor( | 34 ProfileKeyedService* PersonalDataManagerFactory::BuildServiceInstanceFor( |
| 35 Profile* profile) const { | 35 Profile* profile) const { |
| 36 PersonalDataManager* personal_data_manager = new PersonalDataManager(); | 36 PersonalDataManager* personal_data_manager = new PersonalDataManager(); |
| 37 personal_data_manager->Init(profile); | 37 personal_data_manager->Init(profile); |
| 38 return personal_data_manager; | 38 return personal_data_manager; |
| 39 } | 39 } |
| OLD | NEW |