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