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/signin/signin_error_notifier_factory_ash.h"
8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/signin/signin_error_controller_factory.h"
11 #include "chrome/browser/signin/signin_error_notifier_ash.h"
12 #include "components/keyed_service/content/browser_context_dependency_manager.h"
13 #include "components/signin/core/browser/profile_oauth2_token_service.h"
15 SigninErrorNotifierFactory::SigninErrorNotifierFactory()
16 : BrowserContextKeyedServiceFactory(
17 "SigninErrorNotifier",
18 BrowserContextDependencyManager::GetInstance()) {
19 DependsOn(SigninErrorControllerFactory::GetInstance());
22 SigninErrorNotifierFactory::~SigninErrorNotifierFactory() {}
25 SigninErrorNotifier
* SigninErrorNotifierFactory::GetForProfile(
27 return static_cast<SigninErrorNotifier
*>(
28 GetInstance()->GetServiceForBrowserContext(profile
, true));
32 SigninErrorNotifierFactory
* SigninErrorNotifierFactory::GetInstance() {
33 return base::Singleton
<SigninErrorNotifierFactory
>::get();
36 KeyedService
* SigninErrorNotifierFactory::BuildServiceInstanceFor(
37 content::BrowserContext
* context
) const {
38 if (!ash::Shell::HasInstance())
41 Profile
* profile
= static_cast<Profile
*>(context
);
43 return new SigninErrorNotifier(
44 SigninErrorControllerFactory::GetForProfile(profile
), profile
);