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/signin_client_factory.h" | 5 #include "ios/chrome/browser/signin/signin_client_factory.h" |
6 | 6 |
7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
8 #include "components/keyed_service/core/service_access_type.h" | 8 #include "components/keyed_service/core/service_access_type.h" |
9 #include "components/keyed_service/ios/browser_state_dependency_manager.h" | 9 #include "components/keyed_service/ios/browser_state_dependency_manager.h" |
10 #include "ios/chrome/browser/signin/signin_client_impl.h" | 10 #include "ios/chrome/browser/signin/signin_client_impl.h" |
11 #include "ios/chrome/browser/signin/signin_error_controller_factory.h" | 11 #include "ios/chrome/browser/signin/signin_error_controller_factory.h" |
12 #include "ios/public/provider/chrome/browser/browser_state/chrome_browser_state.
h" | 12 #include "ios/public/provider/chrome/browser/browser_state/chrome_browser_state.
h" |
13 | 13 |
14 // static | 14 // static |
15 SigninClient* SigninClientFactory::GetForBrowserState( | 15 SigninClient* SigninClientFactory::GetForBrowserState( |
16 ios::ChromeBrowserState* browser_state) { | 16 ios::ChromeBrowserState* browser_state) { |
17 return static_cast<SigninClient*>( | 17 return static_cast<SigninClient*>( |
18 GetInstance()->GetServiceForBrowserState(browser_state, true)); | 18 GetInstance()->GetServiceForBrowserState(browser_state, true)); |
19 } | 19 } |
20 | 20 |
21 // static | 21 // static |
22 SigninClientFactory* SigninClientFactory::GetInstance() { | 22 SigninClientFactory* SigninClientFactory::GetInstance() { |
23 return Singleton<SigninClientFactory>::get(); | 23 return base::Singleton<SigninClientFactory>::get(); |
24 } | 24 } |
25 | 25 |
26 SigninClientFactory::SigninClientFactory() | 26 SigninClientFactory::SigninClientFactory() |
27 : BrowserStateKeyedServiceFactory( | 27 : BrowserStateKeyedServiceFactory( |
28 "SigninClient", | 28 "SigninClient", |
29 BrowserStateDependencyManager::GetInstance()) { | 29 BrowserStateDependencyManager::GetInstance()) { |
30 DependsOn(ios::SigninErrorControllerFactory::GetInstance()); | 30 DependsOn(ios::SigninErrorControllerFactory::GetInstance()); |
31 } | 31 } |
32 | 32 |
33 SigninClientFactory::~SigninClientFactory() {} | 33 SigninClientFactory::~SigninClientFactory() {} |
34 | 34 |
35 scoped_ptr<KeyedService> SigninClientFactory::BuildServiceInstanceFor( | 35 scoped_ptr<KeyedService> SigninClientFactory::BuildServiceInstanceFor( |
36 web::BrowserState* context) const { | 36 web::BrowserState* context) const { |
37 ios::ChromeBrowserState* chrome_browser_state = | 37 ios::ChromeBrowserState* chrome_browser_state = |
38 ios::ChromeBrowserState::FromBrowserState(context); | 38 ios::ChromeBrowserState::FromBrowserState(context); |
39 return make_scoped_ptr(new SigninClientImpl( | 39 return make_scoped_ptr(new SigninClientImpl( |
40 chrome_browser_state, | 40 chrome_browser_state, |
41 ios::SigninErrorControllerFactory::GetForBrowserState( | 41 ios::SigninErrorControllerFactory::GetForBrowserState( |
42 chrome_browser_state))); | 42 chrome_browser_state))); |
43 } | 43 } |
OLD | NEW |