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 "ios/chrome/browser/signin/account_fetcher_service_factory.h" | 5 #include "ios/chrome/browser/signin/account_fetcher_service_factory.h" |
6 | 6 |
7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
8 #include "components/invalidation/impl/profile_invalidation_provider.h" | 8 #include "components/invalidation/impl/profile_invalidation_provider.h" |
9 #include "components/invalidation/public/invalidation_service.h" | 9 #include "components/invalidation/public/invalidation_service.h" |
10 #include "components/keyed_service/ios/browser_state_dependency_manager.h" | 10 #include "components/keyed_service/ios/browser_state_dependency_manager.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 // static | 33 // static |
34 AccountFetcherService* AccountFetcherServiceFactory::GetForBrowserState( | 34 AccountFetcherService* AccountFetcherServiceFactory::GetForBrowserState( |
35 ios::ChromeBrowserState* browser_state) { | 35 ios::ChromeBrowserState* browser_state) { |
36 return static_cast<AccountFetcherService*>( | 36 return static_cast<AccountFetcherService*>( |
37 GetInstance()->GetServiceForBrowserState(browser_state, true)); | 37 GetInstance()->GetServiceForBrowserState(browser_state, true)); |
38 } | 38 } |
39 | 39 |
40 // static | 40 // static |
41 AccountFetcherServiceFactory* AccountFetcherServiceFactory::GetInstance() { | 41 AccountFetcherServiceFactory* AccountFetcherServiceFactory::GetInstance() { |
42 return Singleton<AccountFetcherServiceFactory>::get(); | 42 return base::Singleton<AccountFetcherServiceFactory>::get(); |
43 } | 43 } |
44 | 44 |
45 void AccountFetcherServiceFactory::RegisterBrowserStatePrefs( | 45 void AccountFetcherServiceFactory::RegisterBrowserStatePrefs( |
46 user_prefs::PrefRegistrySyncable* registry) { | 46 user_prefs::PrefRegistrySyncable* registry) { |
47 AccountFetcherService::RegisterPrefs(registry); | 47 AccountFetcherService::RegisterPrefs(registry); |
48 } | 48 } |
49 | 49 |
50 scoped_ptr<KeyedService> AccountFetcherServiceFactory::BuildServiceInstanceFor( | 50 scoped_ptr<KeyedService> AccountFetcherServiceFactory::BuildServiceInstanceFor( |
51 web::BrowserState* context) const { | 51 web::BrowserState* context) const { |
52 ios::ChromeBrowserState* browser_state = | 52 ios::ChromeBrowserState* browser_state = |
53 ios::ChromeBrowserState::FromBrowserState(context); | 53 ios::ChromeBrowserState::FromBrowserState(context); |
54 scoped_ptr<AccountFetcherService> service(new AccountFetcherService()); | 54 scoped_ptr<AccountFetcherService> service(new AccountFetcherService()); |
55 invalidation::ProfileInvalidationProvider* invalidation_provider = | 55 invalidation::ProfileInvalidationProvider* invalidation_provider = |
56 ios::GetKeyedServiceProvider() | 56 ios::GetKeyedServiceProvider() |
57 ->GetProfileInvalidationProviderForBrowserState(browser_state); | 57 ->GetProfileInvalidationProviderForBrowserState(browser_state); |
58 invalidation::InvalidationService* invalidation_service = | 58 invalidation::InvalidationService* invalidation_service = |
59 invalidation_provider->GetInvalidationService(); | 59 invalidation_provider->GetInvalidationService(); |
60 service->Initialize( | 60 service->Initialize( |
61 SigninClientFactory::GetForBrowserState(browser_state), | 61 SigninClientFactory::GetForBrowserState(browser_state), |
62 OAuth2TokenServiceFactory::GetForBrowserState(browser_state), | 62 OAuth2TokenServiceFactory::GetForBrowserState(browser_state), |
63 ios::AccountTrackerServiceFactory::GetForBrowserState(browser_state), | 63 ios::AccountTrackerServiceFactory::GetForBrowserState(browser_state), |
64 invalidation_service); | 64 invalidation_service); |
65 return service.Pass(); | 65 return service.Pass(); |
66 } | 66 } |
67 | 67 |
68 } // namespace ios | 68 } // namespace ios |
OLD | NEW |