| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/engagement/site_engagement_service_factory.h" | 5 #include "chrome/browser/engagement/site_engagement_service_factory.h" |
| 6 | 6 |
| 7 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 7 #include "chrome/browser/engagement/site_engagement_service.h" | 8 #include "chrome/browser/engagement/site_engagement_service.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 9 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 10 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 10 | 11 |
| 11 // static | 12 // static |
| 12 SiteEngagementService* SiteEngagementServiceFactory::GetForProfile( | 13 SiteEngagementService* SiteEngagementServiceFactory::GetForProfile( |
| 13 Profile* profile) { | 14 Profile* profile) { |
| 14 return static_cast<SiteEngagementService*>( | 15 return static_cast<SiteEngagementService*>( |
| 15 GetInstance()->GetServiceForBrowserContext(profile, true)); | 16 GetInstance()->GetServiceForBrowserContext(profile, true)); |
| 16 } | 17 } |
| 17 | 18 |
| 18 // static | 19 // static |
| 19 SiteEngagementServiceFactory* SiteEngagementServiceFactory::GetInstance() { | 20 SiteEngagementServiceFactory* SiteEngagementServiceFactory::GetInstance() { |
| 20 return base::Singleton<SiteEngagementServiceFactory>::get(); | 21 return base::Singleton<SiteEngagementServiceFactory>::get(); |
| 21 } | 22 } |
| 22 | 23 |
| 23 SiteEngagementServiceFactory::SiteEngagementServiceFactory() | 24 SiteEngagementServiceFactory::SiteEngagementServiceFactory() |
| 24 : BrowserContextKeyedServiceFactory( | 25 : BrowserContextKeyedServiceFactory( |
| 25 "SiteEngagementService", | 26 "SiteEngagementService", |
| 26 BrowserContextDependencyManager::GetInstance()) { | 27 BrowserContextDependencyManager::GetInstance()) { |
| 28 DependsOn(HostContentSettingsMapFactory::GetInstance()); |
| 27 } | 29 } |
| 28 | 30 |
| 29 SiteEngagementServiceFactory::~SiteEngagementServiceFactory() { | 31 SiteEngagementServiceFactory::~SiteEngagementServiceFactory() { |
| 30 } | 32 } |
| 31 | 33 |
| 32 bool SiteEngagementServiceFactory::ServiceIsNULLWhileTesting() const { | 34 bool SiteEngagementServiceFactory::ServiceIsNULLWhileTesting() const { |
| 33 return true; | 35 return true; |
| 34 } | 36 } |
| 35 | 37 |
| 36 KeyedService* SiteEngagementServiceFactory::BuildServiceInstanceFor( | 38 KeyedService* SiteEngagementServiceFactory::BuildServiceInstanceFor( |
| 37 content::BrowserContext* profile) const { | 39 content::BrowserContext* profile) const { |
| 38 return new SiteEngagementService(static_cast<Profile*>(profile)); | 40 return new SiteEngagementService(static_cast<Profile*>(profile)); |
| 39 } | 41 } |
| OLD | NEW |