OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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/ui/desktop_ios_promotion/sms_service_factory.h" |
| 6 |
| 7 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 8 #include "chrome/browser/signin/signin_manager_factory.h" |
| 9 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 10 #include "chrome/browser/ui/desktop_ios_promotion/sms_service.h" |
| 11 #include "components/browser_sync/profile_sync_service.h" |
| 12 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 13 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| 14 #include "components/signin/core/browser/signin_manager.h" |
| 15 #include "net/url_request/url_request_context_getter.h" |
| 16 |
| 17 // static |
| 18 SMSServiceFactory* SMSServiceFactory::GetInstance() { |
| 19 return base::Singleton<SMSServiceFactory>::get(); |
| 20 } |
| 21 |
| 22 // static |
| 23 SMSService* SMSServiceFactory::GetForProfile(Profile* profile) { |
| 24 return static_cast<SMSService*>( |
| 25 GetInstance()->GetServiceForBrowserContext(profile, true)); |
| 26 } |
| 27 |
| 28 KeyedService* SMSServiceFactory::BuildServiceInstanceFor( |
| 29 content::BrowserContext* context) const { |
| 30 Profile* profile = Profile::FromBrowserContext(context); |
| 31 return new SMSService( |
| 32 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), |
| 33 SigninManagerFactory::GetForProfile(profile), |
| 34 profile->GetRequestContext()); |
| 35 } |
| 36 |
| 37 SMSServiceFactory::SMSServiceFactory() |
| 38 : BrowserContextKeyedServiceFactory( |
| 39 "SMSServiceFactory", |
| 40 BrowserContextDependencyManager::GetInstance()) { |
| 41 DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance()); |
| 42 DependsOn(SigninManagerFactory::GetInstance()); |
| 43 } |
| 44 |
| 45 SMSServiceFactory::~SMSServiceFactory() {} |
OLD | NEW |