forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchrome_cryptauth_service_factory.cc
48 lines (40 loc) · 1.88 KB
/
chrome_cryptauth_service_factory.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright 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/cryptauth/chrome_cryptauth_service_factory.h"
#include "chrome/browser/cryptauth/chrome_cryptauth_service.h"
#include "chrome/browser/gcm/gcm_profile_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "chrome/browser/signin/signin_manager_factory.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "components/pref_registry/pref_registry_syncable.h"
// static
cryptauth::CryptAuthService*
ChromeCryptAuthServiceFactory::GetForBrowserContext(
content::BrowserContext* context) {
return static_cast<ChromeCryptAuthService*>(
GetInstance()->GetServiceForBrowserContext(context, true));
}
// static
ChromeCryptAuthServiceFactory* ChromeCryptAuthServiceFactory::GetInstance() {
return base::Singleton<ChromeCryptAuthServiceFactory>::get();
}
ChromeCryptAuthServiceFactory::ChromeCryptAuthServiceFactory()
: BrowserContextKeyedServiceFactory(
"CryptAuthService",
BrowserContextDependencyManager::GetInstance()) {
DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance());
DependsOn(SigninManagerFactory::GetInstance());
DependsOn(gcm::GCMProfileServiceFactory::GetInstance());
}
ChromeCryptAuthServiceFactory::~ChromeCryptAuthServiceFactory() {}
KeyedService* ChromeCryptAuthServiceFactory::BuildServiceInstanceFor(
content::BrowserContext* context) const {
Profile* profile = Profile::FromBrowserContext(context);
return ChromeCryptAuthService::Create(profile).release();
}
void ChromeCryptAuthServiceFactory::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) {
cryptauth::CryptAuthService::RegisterProfilePrefs(registry);
}