OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/global_error/global_error_service_factory.h" | 5 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
6 | 6 |
7 #include "chrome/browser/profiles/incognito_helpers.h" | 7 #include "chrome/browser/profiles/incognito_helpers.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/global_error/global_error_service.h" | 9 #include "chrome/browser/ui/global_error/global_error_service.h" |
10 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 10 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
11 | 11 |
12 // static | 12 // static |
13 GlobalErrorService* GlobalErrorServiceFactory::GetForProfile(Profile* profile) { | 13 GlobalErrorService* GlobalErrorServiceFactory::GetForProfile(Profile* profile) { |
14 return static_cast<GlobalErrorService*>( | 14 return static_cast<GlobalErrorService*>( |
15 GetInstance()->GetServiceForBrowserContext(profile, true)); | 15 GetInstance()->GetServiceForBrowserContext(profile, true)); |
16 } | 16 } |
17 | 17 |
18 // static | 18 // static |
19 GlobalErrorServiceFactory* GlobalErrorServiceFactory::GetInstance() { | 19 GlobalErrorServiceFactory* GlobalErrorServiceFactory::GetInstance() { |
20 return Singleton<GlobalErrorServiceFactory>::get(); | 20 return base::Singleton<GlobalErrorServiceFactory>::get(); |
21 } | 21 } |
22 | 22 |
23 GlobalErrorServiceFactory::GlobalErrorServiceFactory() | 23 GlobalErrorServiceFactory::GlobalErrorServiceFactory() |
24 : BrowserContextKeyedServiceFactory( | 24 : BrowserContextKeyedServiceFactory( |
25 "GlobalErrorService", | 25 "GlobalErrorService", |
26 BrowserContextDependencyManager::GetInstance()) { | 26 BrowserContextDependencyManager::GetInstance()) { |
27 } | 27 } |
28 | 28 |
29 GlobalErrorServiceFactory::~GlobalErrorServiceFactory() { | 29 GlobalErrorServiceFactory::~GlobalErrorServiceFactory() { |
30 } | 30 } |
31 | 31 |
32 KeyedService* GlobalErrorServiceFactory::BuildServiceInstanceFor( | 32 KeyedService* GlobalErrorServiceFactory::BuildServiceInstanceFor( |
33 content::BrowserContext* profile) const { | 33 content::BrowserContext* profile) const { |
34 return new GlobalErrorService(static_cast<Profile*>(profile)); | 34 return new GlobalErrorService(static_cast<Profile*>(profile)); |
35 } | 35 } |
36 | 36 |
37 content::BrowserContext* GlobalErrorServiceFactory::GetBrowserContextToUse( | 37 content::BrowserContext* GlobalErrorServiceFactory::GetBrowserContextToUse( |
38 content::BrowserContext* context) const { | 38 content::BrowserContext* context) const { |
39 return chrome::GetBrowserContextRedirectedInIncognito(context); | 39 return chrome::GetBrowserContextRedirectedInIncognito(context); |
40 } | 40 } |
OLD | NEW |