1// Copyright 2013 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#include "chrome/browser/signin/account_reconcilor_factory.h" 6 7#include "chrome/browser/profiles/profile.h" 8#include "chrome/browser/signin/chrome_signin_client_factory.h" 9#include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 10#include "chrome/browser/signin/signin_manager_factory.h" 11#include "components/keyed_service/content/browser_context_dependency_manager.h" 12 13AccountReconcilorFactory::AccountReconcilorFactory() 14 : BrowserContextKeyedServiceFactory( 15 "AccountReconcilor", 16 BrowserContextDependencyManager::GetInstance()) { 17 DependsOn(ChromeSigninClientFactory::GetInstance()); 18 DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance()); 19 DependsOn(SigninManagerFactory::GetInstance()); 20} 21 22AccountReconcilorFactory::~AccountReconcilorFactory() {} 23 24// static 25AccountReconcilor* AccountReconcilorFactory::GetForProfile( 26 Profile* profile) { 27 return static_cast<AccountReconcilor*>( 28 GetInstance()->GetServiceForBrowserContext(profile, true)); 29} 30 31// static 32AccountReconcilorFactory* AccountReconcilorFactory::GetInstance() { 33 return Singleton<AccountReconcilorFactory>::get(); 34} 35 36KeyedService* AccountReconcilorFactory::BuildServiceInstanceFor( 37 content::BrowserContext* context) const { 38 Profile* profile = Profile::FromBrowserContext(context); 39 AccountReconcilor* reconcilor = new AccountReconcilor( 40 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), 41 SigninManagerFactory::GetForProfile(profile), 42 ChromeSigninClientFactory::GetForProfile(profile)); 43 reconcilor->Initialize(true /* start_reconcile_if_tokens_available */); 44 return reconcilor; 45} 46 47void AccountReconcilorFactory::RegisterProfilePrefs( 48 user_prefs::PrefRegistrySyncable* registry) { 49} 50