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