Chromium Code Reviews| Index: chrome/browser/extensions/api/notifications/extension_notification_display_helper_factory.cc |
| diff --git a/chrome/browser/extensions/api/notifications/extension_notification_display_helper_factory.cc b/chrome/browser/extensions/api/notifications/extension_notification_display_helper_factory.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6e0b46bd6e4fe2220f1ebb40960b81366d062dc3 |
| --- /dev/null |
| +++ b/chrome/browser/extensions/api/notifications/extension_notification_display_helper_factory.cc |
| @@ -0,0 +1,42 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/extensions/api/notifications/extension_notification_display_helper_factory.h" |
| + |
| +#include "chrome/browser/extensions/api/notifications/extension_notification_display_helper.h" |
| +#include "chrome/browser/profiles/profile.h" |
| +#include "components/keyed_service/content/browser_context_dependency_manager.h" |
| + |
| +namespace extensions { |
| + |
| +// static |
| +ExtensionNotificationDisplayHelperFactory* |
| +ExtensionNotificationDisplayHelperFactory::GetInstance() { |
| + return base::Singleton<ExtensionNotificationDisplayHelperFactory>::get(); |
| +} |
| + |
| +// static |
| +ExtensionNotificationDisplayHelper* |
| +ExtensionNotificationDisplayHelperFactory::GetForProfile(Profile* profile) { |
| + return static_cast<ExtensionNotificationDisplayHelper*>( |
| + GetInstance()->GetServiceForBrowserContext(profile, true /* create */)); |
|
dewittj
2017/03/01 17:59:08
this returns nullptr for incognito,is that what yo
Peter Beverloo
2017/04/05 23:22:12
That's a fantastic point - no, that's not that I w
Peter Beverloo
2017/04/07 17:33:29
Done.
|
| +} |
| + |
| +KeyedService* |
| +ExtensionNotificationDisplayHelperFactory::BuildServiceInstanceFor( |
| + content::BrowserContext* context) const { |
| + Profile* profile = Profile::FromBrowserContext(context); |
| + return new ExtensionNotificationDisplayHelper(profile); |
| +} |
| + |
| +ExtensionNotificationDisplayHelperFactory:: |
| + ExtensionNotificationDisplayHelperFactory() |
| + : BrowserContextKeyedServiceFactory( |
| + "ExtensionNotificationDisplayHelperFactory", |
| + BrowserContextDependencyManager::GetInstance()) {} |
| + |
| +ExtensionNotificationDisplayHelperFactory:: |
| + ~ExtensionNotificationDisplayHelperFactory() {} |
| + |
| +} // namespace extensions |