Index: chrome/browser/ui/desktop_ios_promotion/sms_service_factory.cc |
diff --git a/chrome/browser/ui/desktop_ios_promotion/sms_service_factory.cc b/chrome/browser/ui/desktop_ios_promotion/sms_service_factory.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7da59988416a00ad2af2bc967759e7783c9a1ffb |
--- /dev/null |
+++ b/chrome/browser/ui/desktop_ios_promotion/sms_service_factory.cc |
@@ -0,0 +1,49 @@ |
+// Copyright (c) 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/ui/desktop_ios_promotion/sms_service_factory.h" |
+ |
+#include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
+#include "chrome/browser/signin/signin_manager_factory.h" |
+#include "chrome/browser/sync/profile_sync_service_factory.h" |
+#include "chrome/browser/ui/desktop_ios_promotion/sms_service.h" |
+#include "components/browser_sync/profile_sync_service.h" |
+#include "components/keyed_service/content/browser_context_dependency_manager.h" |
+#include "components/signin/core/browser/profile_oauth2_token_service.h" |
+#include "components/signin/core/browser/signin_manager.h" |
+#include "net/url_request/url_request_context_getter.h" |
+ |
+namespace DesktopIOSPromotion { |
+ |
+// static |
+SMSServiceFactory* SMSServiceFactory::GetInstance() { |
+ return base::Singleton<SMSServiceFactory>::get(); |
+} |
+ |
+// static |
+SMSService* SMSServiceFactory::GetForProfile(Profile* profile) { |
+ return static_cast<SMSService*>( |
+ GetInstance()->GetServiceForBrowserContext(profile, true)); |
+} |
+ |
+KeyedService* SMSServiceFactory::BuildServiceInstanceFor( |
+ content::BrowserContext* context) const { |
+ Profile* profile = static_cast<Profile*>(context); |
+ return new SMSService( |
+ ProfileOAuth2TokenServiceFactory::GetForProfile(profile), |
+ SigninManagerFactory::GetForProfile(profile), |
+ profile->GetRequestContext()); |
+} |
+ |
+SMSServiceFactory::SMSServiceFactory() |
+ : BrowserContextKeyedServiceFactory( |
+ "SMSServiceFactory", |
+ BrowserContextDependencyManager::GetInstance()) { |
+ DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance()); |
+ DependsOn(SigninManagerFactory::GetInstance()); |
+} |
+ |
+SMSServiceFactory::~SMSServiceFactory() {} |
+ |
+} // namespace DesktopIOSPromotion |