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/extensions/warning_badge_service_factory.h" | 5 #include "chrome/browser/extensions/warning_badge_service_factory.h" |
6 | 6 |
7 #include "chrome/browser/extensions/warning_badge_service.h" | 7 #include "chrome/browser/extensions/warning_badge_service.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 9 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
10 #include "extensions/browser/extensions_browser_client.h" | 10 #include "extensions/browser/extensions_browser_client.h" |
11 #include "extensions/browser/warning_service_factory.h" | 11 #include "extensions/browser/warning_service_factory.h" |
12 | 12 |
13 using content::BrowserContext; | 13 using content::BrowserContext; |
14 | 14 |
15 namespace extensions { | 15 namespace extensions { |
16 | 16 |
17 // static | 17 // static |
18 WarningBadgeService* WarningBadgeServiceFactory::GetForBrowserContext( | 18 WarningBadgeService* WarningBadgeServiceFactory::GetForBrowserContext( |
19 BrowserContext* context) { | 19 BrowserContext* context) { |
20 return static_cast<WarningBadgeService*>( | 20 return static_cast<WarningBadgeService*>( |
21 GetInstance()->GetServiceForBrowserContext(context, true)); | 21 GetInstance()->GetServiceForBrowserContext(context, true)); |
22 } | 22 } |
23 | 23 |
24 // static | 24 // static |
25 WarningBadgeServiceFactory* WarningBadgeServiceFactory::GetInstance() { | 25 WarningBadgeServiceFactory* WarningBadgeServiceFactory::GetInstance() { |
26 return Singleton<WarningBadgeServiceFactory>::get(); | 26 return base::Singleton<WarningBadgeServiceFactory>::get(); |
27 } | 27 } |
28 | 28 |
29 WarningBadgeServiceFactory::WarningBadgeServiceFactory() | 29 WarningBadgeServiceFactory::WarningBadgeServiceFactory() |
30 : BrowserContextKeyedServiceFactory( | 30 : BrowserContextKeyedServiceFactory( |
31 "WarningBadgeService", | 31 "WarningBadgeService", |
32 BrowserContextDependencyManager::GetInstance()) { | 32 BrowserContextDependencyManager::GetInstance()) { |
33 DependsOn(WarningServiceFactory::GetInstance()); | 33 DependsOn(WarningServiceFactory::GetInstance()); |
34 } | 34 } |
35 | 35 |
36 WarningBadgeServiceFactory::~WarningBadgeServiceFactory() { | 36 WarningBadgeServiceFactory::~WarningBadgeServiceFactory() { |
37 } | 37 } |
38 | 38 |
39 KeyedService* WarningBadgeServiceFactory::BuildServiceInstanceFor( | 39 KeyedService* WarningBadgeServiceFactory::BuildServiceInstanceFor( |
40 BrowserContext* context) const { | 40 BrowserContext* context) const { |
41 return new WarningBadgeService(static_cast<Profile*>(context)); | 41 return new WarningBadgeService(static_cast<Profile*>(context)); |
42 } | 42 } |
43 | 43 |
44 BrowserContext* WarningBadgeServiceFactory::GetBrowserContextToUse( | 44 BrowserContext* WarningBadgeServiceFactory::GetBrowserContextToUse( |
45 BrowserContext* context) const { | 45 BrowserContext* context) const { |
46 // Redirected in incognito. | 46 // Redirected in incognito. |
47 return ExtensionsBrowserClient::Get()->GetOriginalContext(context); | 47 return ExtensionsBrowserClient::Get()->GetOriginalContext(context); |
48 } | 48 } |
49 | 49 |
50 bool WarningBadgeServiceFactory::ServiceIsCreatedWithBrowserContext() const { | 50 bool WarningBadgeServiceFactory::ServiceIsCreatedWithBrowserContext() const { |
51 return true; | 51 return true; |
52 } | 52 } |
53 | 53 |
54 } // namespace extensions | 54 } // namespace extensions |
OLD | NEW |