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 3 // found in the LICENSE file. 4 5 #include "chrome/browser/signin/token_service_factory.h" 6 7 #include "chrome/browser/signin/token_service.h" 8 #include "chrome/browser/webdata/web_data_service_factory.h" 9 #include "components/browser_context_keyed_service/browser_context_dependency_manager.h" 10 11 TokenServiceFactory::TokenServiceFactory() 12 : BrowserContextKeyedServiceFactory( 13 "TokenService", 14 BrowserContextDependencyManager::GetInstance()) { 15 DependsOn(WebDataServiceFactory::GetInstance()); 16 } 17 18 TokenServiceFactory::~TokenServiceFactory() {} 19 20 // static 21 TokenService* TokenServiceFactory::GetForProfile(Profile* profile) { 22 return static_cast<TokenService*>( 23 GetInstance()->GetServiceForBrowserContext(profile, true)); 24 } 25 26 // static 27 TokenServiceFactory* TokenServiceFactory::GetInstance() { 28 return Singleton<TokenServiceFactory>::get(); 29 } 30 31 BrowserContextKeyedService* TokenServiceFactory::BuildServiceInstanceFor( 32 content::BrowserContext* profile) const { 33 return new TokenService(); 34 } 35