18bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved. 28bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 38bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// found in the LICENSE file. 48bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 58bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#ifndef CHROME_BROWSER_SIGNIN_ACCOUNT_RECONCILOR_FACTORY_H_ 68bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#define CHROME_BROWSER_SIGNIN_ACCOUNT_RECONCILOR_FACTORY_H_ 78bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 88bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#include "base/memory/singleton.h" 9a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "components/keyed_service/content/browser_context_keyed_service_factory.h" 10c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch#include "components/signin/core/browser/account_reconcilor.h" 118bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 128bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)class AccountReconcilor; 138bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)class Profile; 148bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 158bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// Singleton that owns all AccountReconcilors and associates them with 168bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// Profiles. Listens for the Profile's destruction notification and cleans up. 178bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)class AccountReconcilorFactory : public BrowserContextKeyedServiceFactory { 188bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) public: 198bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) // Returns the instance of AccountReconcilor associated with this profile 208bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) // (creating one if none exists). Returns NULL if this profile cannot have an 218bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) // AccountReconcilor (for example, if |profile| is incognito). 228bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) static AccountReconcilor* GetForProfile(Profile* profile); 238bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 248bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) // Returns an instance of the factory singleton. 258bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) static AccountReconcilorFactory* GetInstance(); 268bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 278bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) private: 288bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) friend struct DefaultSingletonTraits<AccountReconcilorFactory>; 298bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 308bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) AccountReconcilorFactory(); 318bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) virtual ~AccountReconcilorFactory(); 328bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 338bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) // BrowserContextKeyedServiceFactory: 34a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) virtual KeyedService* BuildServiceInstanceFor( 358bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) content::BrowserContext* profile) const OVERRIDE; 368bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) virtual void RegisterProfilePrefs( 378bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) user_prefs::PrefRegistrySyncable* registry) OVERRIDE; 388bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)}; 398bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 408bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#endif // CHROME_BROWSER_SIGNIN_ACCOUNT_RECONCILOR_FACTORY_H_ 41