1 // Copyright 2014 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.
5 #include "chrome/browser/chromeos/login/saml/saml_offline_signin_limiter_factory.h"
7 #include "base/time/clock.h"
8 #include "chrome/browser/chromeos/login/saml/saml_offline_signin_limiter.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "components/keyed_service/content/browser_context_dependency_manager.h"
11 #include "components/keyed_service/core/keyed_service.h"
12 #include "content/public/browser/browser_context.h"
16 base::Clock
* SAMLOfflineSigninLimiterFactory::clock_for_testing_
= NULL
;
19 SAMLOfflineSigninLimiterFactory
*
20 SAMLOfflineSigninLimiterFactory::GetInstance() {
21 return base::Singleton
<SAMLOfflineSigninLimiterFactory
>::get();
25 SAMLOfflineSigninLimiter
* SAMLOfflineSigninLimiterFactory::GetForProfile(
27 return static_cast<SAMLOfflineSigninLimiter
*>(
28 GetInstance()->GetServiceForBrowserContext(profile
, true));
32 void SAMLOfflineSigninLimiterFactory::SetClockForTesting(base::Clock
* clock
) {
33 clock_for_testing_
= clock
;
36 SAMLOfflineSigninLimiterFactory::SAMLOfflineSigninLimiterFactory()
37 : BrowserContextKeyedServiceFactory(
38 "SAMLOfflineSigninLimiter",
39 BrowserContextDependencyManager::GetInstance()) {
42 SAMLOfflineSigninLimiterFactory::~SAMLOfflineSigninLimiterFactory() {
45 KeyedService
* SAMLOfflineSigninLimiterFactory::BuildServiceInstanceFor(
46 content::BrowserContext
* context
) const {
47 return new SAMLOfflineSigninLimiter(static_cast<Profile
*>(context
),
51 } // namespace chromeos