blob: 52ddcfadf0315a98aacdc4bcd4b996785b2fbcc5 [file] [log] [blame]
// Copyright 2013 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/signin/account_reconcilor_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/chrome_signin_client_factory.h"
#include "chrome/browser/signin/gaia_cookie_manager_service_factory.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "chrome/browser/signin/signin_manager_factory.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
AccountReconcilorFactory::AccountReconcilorFactory()
: BrowserContextKeyedServiceFactory(
"AccountReconcilor",
BrowserContextDependencyManager::GetInstance()) {
DependsOn(ChromeSigninClientFactory::GetInstance());
DependsOn(GaiaCookieManagerServiceFactory::GetInstance());
DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance());
DependsOn(SigninManagerFactory::GetInstance());
}
AccountReconcilorFactory::~AccountReconcilorFactory() {}
// static
AccountReconcilor* AccountReconcilorFactory::GetForProfile(
Profile* profile) {
return static_cast<AccountReconcilor*>(
GetInstance()->GetServiceForBrowserContext(profile, true));
}
// static
AccountReconcilorFactory* AccountReconcilorFactory::GetInstance() {
return base::Singleton<AccountReconcilorFactory>::get();
}
KeyedService* AccountReconcilorFactory::BuildServiceInstanceFor(
content::BrowserContext* context) const {
Profile* profile = Profile::FromBrowserContext(context);
AccountReconcilor* reconcilor = new AccountReconcilor(
ProfileOAuth2TokenServiceFactory::GetForProfile(profile),
SigninManagerFactory::GetForProfile(profile),
ChromeSigninClientFactory::GetForProfile(profile),
GaiaCookieManagerServiceFactory::GetForProfile(profile));
reconcilor->Initialize(true /* start_reconcile_if_tokens_available */);
return reconcilor;
}
void AccountReconcilorFactory::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) {
}