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 namespace DesktopIOSPromotion { | |
18 | |
19 // static | |
20 SMSServiceFactory* SMSServiceFactory::GetInstance() { | |
21 return base::Singleton<SMSServiceFactory>::get(); | |
22 } | |
23 | |
24 // static | |
25 SMSService* SMSServiceFactory::GetForProfile(Profile* profile) { | |
26 return static_cast<SMSService*>( | |
27 GetInstance()->GetServiceForBrowserContext(profile, true)); | |
28 } | |
29 | |
30 KeyedService* SMSServiceFactory::BuildServiceInstanceFor( | |
31 content::BrowserContext* context) const { | |
32 Profile* profile = static_cast<Profile*>(context); | |
msramek
2017/01/27 16:38:57
nit: Profile::FromBrowserContext()
justincohen
2017/01/27 23:06:46
Done.
| |
33 return new SMSService( | |
34 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), | |
35 SigninManagerFactory::GetForProfile(profile), | |
36 profile->GetRequestContext()); | |
37 } | |
38 | |
39 SMSServiceFactory::SMSServiceFactory() | |
40 : BrowserContextKeyedServiceFactory( | |
41 "SMSServiceFactory", | |
42 BrowserContextDependencyManager::GetInstance()) { | |
43 DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance()); | |
44 DependsOn(SigninManagerFactory::GetInstance()); | |
45 } | |
46 | |
47 SMSServiceFactory::~SMSServiceFactory() {} | |
48 | |
49 } // namespace DesktopIOSPromotion | |
OLD | NEW |