Popular sites on the NTP: re-download popular suggestions once per Chrome run
[chromium-blink-merge.git] / chrome / browser / signin / signin_error_notifier_factory_ash.cc
blobbc777ecbbb495e773872ee457ef33e909324a49c
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"
7 #include "ash/shell.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() {}
24 // static
25 SigninErrorNotifier* SigninErrorNotifierFactory::GetForProfile(
26 Profile* profile) {
27 return static_cast<SigninErrorNotifier*>(
28 GetInstance()->GetServiceForBrowserContext(profile, true));
31 // static
32 SigninErrorNotifierFactory* SigninErrorNotifierFactory::GetInstance() {
33 return base::Singleton<SigninErrorNotifierFactory>::get();
36 KeyedService* SigninErrorNotifierFactory::BuildServiceInstanceFor(
37 content::BrowserContext* context) const {
38 if (!ash::Shell::HasInstance())
39 return NULL;
41 Profile* profile = static_cast<Profile*>(context);
43 return new SigninErrorNotifier(
44 SigninErrorControllerFactory::GetForProfile(profile), profile);