This source file includes following definitions.
- GetForProfile
- GetInstance
- BuildServiceInstanceFor
- GetBrowserContextToUse
#include "chrome/browser/autofill/personal_data_manager_factory.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/singleton.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/incognito_helpers.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/webdata/web_data_service_factory.h"
#include "components/autofill/core/browser/personal_data_manager.h"
#include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
namespace autofill {
PersonalDataManager* PersonalDataManagerFactory::GetForProfile(
Profile* profile) {
return static_cast<PersonalDataManager*>(
GetInstance()->GetServiceForBrowserContext(profile, true));
}
PersonalDataManagerFactory* PersonalDataManagerFactory::GetInstance() {
return Singleton<PersonalDataManagerFactory>::get();
}
PersonalDataManagerFactory::PersonalDataManagerFactory()
: BrowserContextKeyedServiceFactory(
"PersonalDataManager",
BrowserContextDependencyManager::GetInstance()) {
DependsOn(WebDataServiceFactory::GetInstance());
}
PersonalDataManagerFactory::~PersonalDataManagerFactory() {
}
KeyedService* PersonalDataManagerFactory::BuildServiceInstanceFor(
content::BrowserContext* context) const {
Profile* profile = Profile::FromBrowserContext(context);
PersonalDataManager* service =
new PersonalDataManager(g_browser_process->GetApplicationLocale());
service->Init(WebDataServiceFactory::GetAutofillWebDataForProfile(
profile, Profile::EXPLICIT_ACCESS),
profile->GetPrefs(),
profile->IsOffTheRecord());
return service;
}
content::BrowserContext* PersonalDataManagerFactory::GetBrowserContextToUse(
content::BrowserContext* context) const {
return chrome::GetBrowserContextOwnInstanceInIncognito(context);
}
}