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/notifications/extension_welcome_notification_factory.h"
7 #include "chrome/browser/notifications/extension_welcome_notification.h"
8 #include "chrome/browser/notifications/notifier_state_tracker_factory.h"
9 #include "chrome/browser/profiles/incognito_helpers.h"
10 #include "chrome/browser/profiles/profile.h"
11 #include "components/keyed_service/content/browser_context_dependency_manager.h"
12 #include "content/public/browser/browser_thread.h"
15 ExtensionWelcomeNotification
*
16 ExtensionWelcomeNotificationFactory::GetForBrowserContext(
17 content::BrowserContext
* context
) {
18 DCHECK_CURRENTLY_ON(content::BrowserThread::UI
);
19 return static_cast<ExtensionWelcomeNotification
*>(
20 GetInstance()->GetServiceForBrowserContext(context
, true));
24 ExtensionWelcomeNotificationFactory
*
25 ExtensionWelcomeNotificationFactory::GetInstance() {
26 return Singleton
<ExtensionWelcomeNotificationFactory
>::get();
29 ExtensionWelcomeNotificationFactory::ExtensionWelcomeNotificationFactory()
30 : BrowserContextKeyedServiceFactory(
31 "ExtensionWelcomeNotification",
32 BrowserContextDependencyManager::GetInstance()) {
33 DependsOn(NotifierStateTrackerFactory::GetInstance());
36 ExtensionWelcomeNotificationFactory::~ExtensionWelcomeNotificationFactory() {}
38 KeyedService
* ExtensionWelcomeNotificationFactory::BuildServiceInstanceFor(
39 content::BrowserContext
* context
) const {
40 return ExtensionWelcomeNotification::Create(static_cast<Profile
*>(context
));
43 content::BrowserContext
*
44 ExtensionWelcomeNotificationFactory::GetBrowserContextToUse(
45 content::BrowserContext
* context
) const {
46 return chrome::GetBrowserContextOwnInstanceInIncognito(context
);