| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/signin/signin_error_notifier_factory_ash.h" | 5 #include "chrome/browser/signin/signin_global_error_factory.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | |
| 8 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/signin/signin_error_controller_factory.h" | 9 #include "chrome/browser/signin/signin_error_controller_factory.h" |
| 11 #include "chrome/browser/signin/signin_error_notifier_ash.h" | 10 #include "chrome/browser/signin/signin_global_error.h" |
| 11 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
| 12 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 12 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 13 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 13 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| 14 | 14 |
| 15 SigninErrorNotifierFactory::SigninErrorNotifierFactory() | 15 #if defined(USE_ASH) |
| 16 #include "ash/shell.h" |
| 17 #endif |
| 18 |
| 19 SigninGlobalErrorFactory::SigninGlobalErrorFactory() |
| 16 : BrowserContextKeyedServiceFactory( | 20 : BrowserContextKeyedServiceFactory( |
| 17 "SigninErrorNotifier", | 21 "SigninGlobalError", |
| 18 BrowserContextDependencyManager::GetInstance()) { | 22 BrowserContextDependencyManager::GetInstance()) { |
| 19 DependsOn(SigninErrorControllerFactory::GetInstance()); | 23 DependsOn(SigninErrorControllerFactory::GetInstance()); |
| 24 DependsOn(GlobalErrorServiceFactory::GetInstance()); |
| 20 } | 25 } |
| 21 | 26 |
| 22 SigninErrorNotifierFactory::~SigninErrorNotifierFactory() {} | 27 SigninGlobalErrorFactory::~SigninGlobalErrorFactory() {} |
| 23 | 28 |
| 24 // static | 29 // static |
| 25 SigninErrorNotifier* SigninErrorNotifierFactory::GetForProfile( | 30 SigninGlobalError* SigninGlobalErrorFactory::GetForProfile( |
| 26 Profile* profile) { | 31 Profile* profile) { |
| 27 return static_cast<SigninErrorNotifier*>( | 32 return static_cast<SigninGlobalError*>( |
| 28 GetInstance()->GetServiceForBrowserContext(profile, true)); | 33 GetInstance()->GetServiceForBrowserContext(profile, true)); |
| 29 } | 34 } |
| 30 | 35 |
| 31 // static | 36 // static |
| 32 SigninErrorNotifierFactory* SigninErrorNotifierFactory::GetInstance() { | 37 SigninGlobalErrorFactory* SigninGlobalErrorFactory::GetInstance() { |
| 33 return Singleton<SigninErrorNotifierFactory>::get(); | 38 return Singleton<SigninGlobalErrorFactory>::get(); |
| 34 } | 39 } |
| 35 | 40 |
| 36 KeyedService* SigninErrorNotifierFactory::BuildServiceInstanceFor( | 41 KeyedService* SigninGlobalErrorFactory::BuildServiceInstanceFor( |
| 37 content::BrowserContext* context) const { | 42 content::BrowserContext* context) const { |
| 38 if (!ash::Shell::HasInstance()) | 43 #if defined(USE_ASH) |
| 44 if (ash::Shell::HasInstance()) |
| 39 return NULL; | 45 return NULL; |
| 46 #endif |
| 40 | 47 |
| 41 Profile* profile = static_cast<Profile*>(context); | 48 Profile* profile = static_cast<Profile*>(context); |
| 42 | 49 |
| 43 return new SigninErrorNotifier( | 50 return new SigninGlobalError( |
| 44 SigninErrorControllerFactory::GetForProfile(profile), profile); | 51 SigninErrorControllerFactory::GetForProfile(profile), profile); |
| 45 } | 52 } |
| OLD | NEW |