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/extensions/extension_warning_badge_service_factory.h"
7 #include "chrome/browser/extensions/extension_warning_badge_service.h"
8 #include "chrome/browser/profiles/profile.h"
9 #include "components/keyed_service/content/browser_context_dependency_manager.h"
10 #include "extensions/browser/extensions_browser_client.h"
11 #include "extensions/browser/warning_service_factory.h"
13 using content::BrowserContext
;
15 namespace extensions
{
18 ExtensionWarningBadgeService
*
19 ExtensionWarningBadgeServiceFactory::GetForBrowserContext(
20 BrowserContext
* context
) {
21 return static_cast<ExtensionWarningBadgeService
*>(
22 GetInstance()->GetServiceForBrowserContext(context
, true));
26 ExtensionWarningBadgeServiceFactory
*
27 ExtensionWarningBadgeServiceFactory::GetInstance() {
28 return Singleton
<ExtensionWarningBadgeServiceFactory
>::get();
31 ExtensionWarningBadgeServiceFactory::ExtensionWarningBadgeServiceFactory()
32 : BrowserContextKeyedServiceFactory(
33 "ExtensionWarningBadgeService",
34 BrowserContextDependencyManager::GetInstance()) {
35 DependsOn(WarningServiceFactory::GetInstance());
38 ExtensionWarningBadgeServiceFactory::~ExtensionWarningBadgeServiceFactory() {
41 KeyedService
* ExtensionWarningBadgeServiceFactory::BuildServiceInstanceFor(
42 BrowserContext
* context
) const {
43 return new ExtensionWarningBadgeService(static_cast<Profile
*>(context
));
46 BrowserContext
* ExtensionWarningBadgeServiceFactory::GetBrowserContextToUse(
47 BrowserContext
* context
) const {
48 // Redirected in incognito.
49 return ExtensionsBrowserClient::Get()->GetOriginalContext(context
);
52 bool ExtensionWarningBadgeServiceFactory::ServiceIsCreatedWithBrowserContext()
57 } // namespace extensions