Prevent chrome://net-internals/#export from flickering
[chromium-blink-merge.git] / chrome / browser / extensions / warning_badge_service_factory.cc
blob791711240e482b5294da78847a06b81d4c5aebc3
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/warning_badge_service_factory.h"
7 #include "chrome/browser/extensions/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 {
17 // static
18 WarningBadgeService* WarningBadgeServiceFactory::GetForBrowserContext(
19 BrowserContext* context) {
20 return static_cast<WarningBadgeService*>(
21 GetInstance()->GetServiceForBrowserContext(context, true));
24 // static
25 WarningBadgeServiceFactory* WarningBadgeServiceFactory::GetInstance() {
26 return Singleton<WarningBadgeServiceFactory>::get();
29 WarningBadgeServiceFactory::WarningBadgeServiceFactory()
30 : BrowserContextKeyedServiceFactory(
31 "WarningBadgeService",
32 BrowserContextDependencyManager::GetInstance()) {
33 DependsOn(WarningServiceFactory::GetInstance());
36 WarningBadgeServiceFactory::~WarningBadgeServiceFactory() {
39 KeyedService* WarningBadgeServiceFactory::BuildServiceInstanceFor(
40 BrowserContext* context) const {
41 return new WarningBadgeService(static_cast<Profile*>(context));
44 BrowserContext* WarningBadgeServiceFactory::GetBrowserContextToUse(
45 BrowserContext* context) const {
46 // Redirected in incognito.
47 return ExtensionsBrowserClient::Get()->GetOriginalContext(context);
50 bool WarningBadgeServiceFactory::ServiceIsCreatedWithBrowserContext() const {
51 return true;
54 } // namespace extensions