blob: ebbd0612ba9ac4d2ba8279d2868606ac35bd6e56 (
plain)
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 2015 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/signin/signin_error_controller_factory.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/account_consistency_mode_manager.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
SigninErrorControllerFactory::SigninErrorControllerFactory()
: BrowserContextKeyedServiceFactory(
"SigninErrorController",
BrowserContextDependencyManager::GetInstance()) {
DependsOn(IdentityManagerFactory::GetInstance());
}
SigninErrorControllerFactory::~SigninErrorControllerFactory() {}
// static
SigninErrorController* SigninErrorControllerFactory::GetForProfile(
Profile* profile) {
return static_cast<SigninErrorController*>(
GetInstance()->GetServiceForBrowserContext(profile, true));
}
// static
SigninErrorControllerFactory* SigninErrorControllerFactory::GetInstance() {
return base::Singleton<SigninErrorControllerFactory>::get();
}
KeyedService* SigninErrorControllerFactory::BuildServiceInstanceFor(
content::BrowserContext* context) const {
Profile* profile = Profile::FromBrowserContext(context);
SigninErrorController::AccountMode account_mode =
#if BUILDFLAG(IS_CHROMEOS_ASH)
SigninErrorController::AccountMode::ANY_ACCOUNT;
#else
AccountConsistencyModeManager::IsMirrorEnabledForProfile(profile)
? SigninErrorController::AccountMode::ANY_ACCOUNT
: SigninErrorController::AccountMode::PRIMARY_ACCOUNT;
#endif
return new SigninErrorController(
account_mode, IdentityManagerFactory::GetForProfile(profile));
}
|