| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/signin/account_fetcher_service_factory.h" | 5 #include "chrome/browser/signin/account_fetcher_service_factory.h" |
| 6 | 6 |
| 7 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" | 7 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/signin/account_tracker_service_factory.h" | 9 #include "chrome/browser/signin/account_tracker_service_factory.h" |
| 10 #include "chrome/browser/signin/chrome_signin_client_factory.h" | 10 #include "chrome/browser/signin/chrome_signin_client_factory.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 // static | 30 // static |
| 31 AccountFetcherService* AccountFetcherServiceFactory::GetForProfile( | 31 AccountFetcherService* AccountFetcherServiceFactory::GetForProfile( |
| 32 Profile* profile) { | 32 Profile* profile) { |
| 33 return static_cast<AccountFetcherService*>( | 33 return static_cast<AccountFetcherService*>( |
| 34 GetInstance()->GetServiceForBrowserContext(profile, true)); | 34 GetInstance()->GetServiceForBrowserContext(profile, true)); |
| 35 } | 35 } |
| 36 | 36 |
| 37 // static | 37 // static |
| 38 AccountFetcherServiceFactory* AccountFetcherServiceFactory::GetInstance() { | 38 AccountFetcherServiceFactory* AccountFetcherServiceFactory::GetInstance() { |
| 39 return Singleton<AccountFetcherServiceFactory>::get(); | 39 return base::Singleton<AccountFetcherServiceFactory>::get(); |
| 40 } | 40 } |
| 41 | 41 |
| 42 void AccountFetcherServiceFactory::RegisterProfilePrefs( | 42 void AccountFetcherServiceFactory::RegisterProfilePrefs( |
| 43 user_prefs::PrefRegistrySyncable* registry) { | 43 user_prefs::PrefRegistrySyncable* registry) { |
| 44 AccountFetcherService::RegisterPrefs(registry); | 44 AccountFetcherService::RegisterPrefs(registry); |
| 45 } | 45 } |
| 46 | 46 |
| 47 KeyedService* AccountFetcherServiceFactory::BuildServiceInstanceFor( | 47 KeyedService* AccountFetcherServiceFactory::BuildServiceInstanceFor( |
| 48 content::BrowserContext* context) const { | 48 content::BrowserContext* context) const { |
| 49 Profile* profile = Profile::FromBrowserContext(context); | 49 Profile* profile = Profile::FromBrowserContext(context); |
| 50 AccountFetcherService* service = new AccountFetcherService(); | 50 AccountFetcherService* service = new AccountFetcherService(); |
| 51 invalidation::ProfileInvalidationProvider* invalidation_provider = | 51 invalidation::ProfileInvalidationProvider* invalidation_provider = |
| 52 invalidation::ProfileInvalidationProviderFactory::GetForProfile(profile); | 52 invalidation::ProfileInvalidationProviderFactory::GetForProfile(profile); |
| 53 // Chrome OS login and guest profiles do not support invalidation. This is | 53 // Chrome OS login and guest profiles do not support invalidation. This is |
| 54 // fine as they do not have GAIA credentials anyway. http://crbug.com/358169 | 54 // fine as they do not have GAIA credentials anyway. http://crbug.com/358169 |
| 55 invalidation::InvalidationService* invalidation_service = | 55 invalidation::InvalidationService* invalidation_service = |
| 56 invalidation_provider ? invalidation_provider->GetInvalidationService() | 56 invalidation_provider ? invalidation_provider->GetInvalidationService() |
| 57 : nullptr; | 57 : nullptr; |
| 58 service->Initialize(ChromeSigninClientFactory::GetForProfile(profile), | 58 service->Initialize(ChromeSigninClientFactory::GetForProfile(profile), |
| 59 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), | 59 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), |
| 60 AccountTrackerServiceFactory::GetForProfile(profile), | 60 AccountTrackerServiceFactory::GetForProfile(profile), |
| 61 invalidation_service); | 61 invalidation_service); |
| 62 return service; | 62 return service; |
| 63 } | 63 } |
| OLD | NEW |