| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/notifications/extension_welcome_notification_factory.h" | 5 #include "chrome/browser/notifications/extension_welcome_notification_factory.h" |
| 6 | 6 |
| 7 #include "chrome/browser/notifications/extension_welcome_notification.h" | 7 #include "chrome/browser/notifications/extension_welcome_notification.h" |
| 8 #include "chrome/browser/notifications/notifier_state_tracker_factory.h" | 8 #include "chrome/browser/notifications/notifier_state_tracker_factory.h" |
| 9 #include "chrome/browser/profiles/incognito_helpers.h" | 9 #include "chrome/browser/profiles/incognito_helpers.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 11 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
| 13 | 13 |
| 14 // static | 14 // static |
| 15 ExtensionWelcomeNotification* | 15 ExtensionWelcomeNotification* |
| 16 ExtensionWelcomeNotificationFactory::GetForBrowserContext( | 16 ExtensionWelcomeNotificationFactory::GetForBrowserContext( |
| 17 content::BrowserContext* context) { | 17 content::BrowserContext* context) { |
| 18 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 18 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 19 return static_cast<ExtensionWelcomeNotification*>( | 19 return static_cast<ExtensionWelcomeNotification*>( |
| 20 GetInstance()->GetServiceForBrowserContext(context, true)); | 20 GetInstance()->GetServiceForBrowserContext(context, true)); |
| 21 } | 21 } |
| 22 | 22 |
| 23 // static | 23 // static |
| 24 ExtensionWelcomeNotificationFactory* | 24 ExtensionWelcomeNotificationFactory* |
| 25 ExtensionWelcomeNotificationFactory::GetInstance() { | 25 ExtensionWelcomeNotificationFactory::GetInstance() { |
| 26 return Singleton<ExtensionWelcomeNotificationFactory>::get(); | 26 return base::Singleton<ExtensionWelcomeNotificationFactory>::get(); |
| 27 } | 27 } |
| 28 | 28 |
| 29 ExtensionWelcomeNotificationFactory::ExtensionWelcomeNotificationFactory() | 29 ExtensionWelcomeNotificationFactory::ExtensionWelcomeNotificationFactory() |
| 30 : BrowserContextKeyedServiceFactory( | 30 : BrowserContextKeyedServiceFactory( |
| 31 "ExtensionWelcomeNotification", | 31 "ExtensionWelcomeNotification", |
| 32 BrowserContextDependencyManager::GetInstance()) { | 32 BrowserContextDependencyManager::GetInstance()) { |
| 33 DependsOn(NotifierStateTrackerFactory::GetInstance()); | 33 DependsOn(NotifierStateTrackerFactory::GetInstance()); |
| 34 } | 34 } |
| 35 | 35 |
| 36 ExtensionWelcomeNotificationFactory::~ExtensionWelcomeNotificationFactory() {} | 36 ExtensionWelcomeNotificationFactory::~ExtensionWelcomeNotificationFactory() {} |
| 37 | 37 |
| 38 KeyedService* ExtensionWelcomeNotificationFactory::BuildServiceInstanceFor( | 38 KeyedService* ExtensionWelcomeNotificationFactory::BuildServiceInstanceFor( |
| 39 content::BrowserContext* context) const { | 39 content::BrowserContext* context) const { |
| 40 return ExtensionWelcomeNotification::Create(static_cast<Profile*>(context)); | 40 return ExtensionWelcomeNotification::Create(static_cast<Profile*>(context)); |
| 41 } | 41 } |
| 42 | 42 |
| 43 content::BrowserContext* | 43 content::BrowserContext* |
| 44 ExtensionWelcomeNotificationFactory::GetBrowserContextToUse( | 44 ExtensionWelcomeNotificationFactory::GetBrowserContextToUse( |
| 45 content::BrowserContext* context) const { | 45 content::BrowserContext* context) const { |
| 46 return chrome::GetBrowserContextOwnInstanceInIncognito(context); | 46 return chrome::GetBrowserContextOwnInstanceInIncognito(context); |
| 47 } | 47 } |
| OLD | NEW |