Index: chrome/browser/signin/signin_global_error_factory.cc |
diff --git a/chrome/browser/signin/signin_global_error_factory.cc b/chrome/browser/signin/signin_global_error_factory.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a1900a7dbef1c8e34bc8b0ec55a046665e30ed8d |
--- /dev/null |
+++ b/chrome/browser/signin/signin_global_error_factory.cc |
@@ -0,0 +1,52 @@ |
+// Copyright 2014 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_global_error_factory.h" |
+ |
+#include "chrome/browser/browser_process.h" |
+#include "chrome/browser/profiles/profile.h" |
+#include "chrome/browser/signin/signin_error_controller_factory.h" |
+#include "chrome/browser/signin/signin_global_error.h" |
+#include "chrome/browser/ui/global_error/global_error_service_factory.h" |
+#include "components/keyed_service/content/browser_context_dependency_manager.h" |
+#include "components/signin/core/browser/profile_oauth2_token_service.h" |
+ |
+#if defined(USE_ASH) |
+#include "ash/shell.h" |
+#endif |
+ |
+SigninGlobalErrorFactory::SigninGlobalErrorFactory() |
+ : BrowserContextKeyedServiceFactory( |
+ "SigninGlobalError", |
+ BrowserContextDependencyManager::GetInstance()) { |
+ DependsOn(SigninErrorControllerFactory::GetInstance()); |
+ DependsOn(GlobalErrorServiceFactory::GetInstance()); |
+} |
+ |
+SigninGlobalErrorFactory::~SigninGlobalErrorFactory() {} |
+ |
+// static |
+SigninGlobalError* SigninGlobalErrorFactory::GetForProfile( |
+ Profile* profile) { |
+ return static_cast<SigninGlobalError*>( |
+ GetInstance()->GetServiceForBrowserContext(profile, true)); |
+} |
+ |
+// static |
+SigninGlobalErrorFactory* SigninGlobalErrorFactory::GetInstance() { |
+ return Singleton<SigninGlobalErrorFactory>::get(); |
+} |
+ |
+KeyedService* SigninGlobalErrorFactory::BuildServiceInstanceFor( |
+ content::BrowserContext* context) const { |
+#if defined(USE_ASH) |
+ if (ash::Shell::HasInstance()) |
+ return NULL; |
+#endif |
+ |
+ Profile* profile = static_cast<Profile*>(context); |
+ |
+ return new SigninGlobalError( |
+ SigninErrorControllerFactory::GetForProfile(profile), profile); |
+} |