| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 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/api/notifications/extension_notification_dis
play_helper_factory.h" |
| 6 |
| 7 #include "chrome/browser/extensions/api/notifications/extension_notification_dis
play_helper.h" |
| 8 #include "chrome/browser/profiles/incognito_helpers.h" |
| 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 11 |
| 12 namespace extensions { |
| 13 |
| 14 // static |
| 15 ExtensionNotificationDisplayHelperFactory* |
| 16 ExtensionNotificationDisplayHelperFactory::GetInstance() { |
| 17 return base::Singleton<ExtensionNotificationDisplayHelperFactory>::get(); |
| 18 } |
| 19 |
| 20 // static |
| 21 ExtensionNotificationDisplayHelper* |
| 22 ExtensionNotificationDisplayHelperFactory::GetForProfile(Profile* profile) { |
| 23 return static_cast<ExtensionNotificationDisplayHelper*>( |
| 24 GetInstance()->GetServiceForBrowserContext(profile, true /* create */)); |
| 25 } |
| 26 |
| 27 ExtensionNotificationDisplayHelperFactory:: |
| 28 ExtensionNotificationDisplayHelperFactory() |
| 29 : BrowserContextKeyedServiceFactory( |
| 30 "ExtensionNotificationDisplayHelperFactory", |
| 31 BrowserContextDependencyManager::GetInstance()) {} |
| 32 |
| 33 ExtensionNotificationDisplayHelperFactory:: |
| 34 ~ExtensionNotificationDisplayHelperFactory() {} |
| 35 |
| 36 KeyedService* |
| 37 ExtensionNotificationDisplayHelperFactory::BuildServiceInstanceFor( |
| 38 content::BrowserContext* context) const { |
| 39 Profile* profile = Profile::FromBrowserContext(context); |
| 40 return new ExtensionNotificationDisplayHelper(profile); |
| 41 } |
| 42 |
| 43 content::BrowserContext* |
| 44 ExtensionNotificationDisplayHelperFactory::GetBrowserContextToUse( |
| 45 content::BrowserContext* context) const { |
| 46 return chrome::GetBrowserContextOwnInstanceInIncognito(context); |
| 47 } |
| 48 |
| 49 } // namespace extensions |
| OLD | NEW |