| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 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/subresource_filter/subresource_filter_content_settings_
manager_factory.h" | 5 #include "chrome/browser/subresource_filter/subresource_filter_content_settings_
manager_factory.h" |
| 6 | 6 |
| 7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/subresource_filter/subresource_filter_content_settings_
manager.h" | 9 #include "chrome/browser/subresource_filter/subresource_filter_content_settings_
manager.h" |
| 10 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 10 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 11 #include "components/keyed_service/core/keyed_service.h" | 11 #include "components/keyed_service/core/keyed_service.h" |
| 12 #include "content/public/browser/browser_context.h" |
| 12 | 13 |
| 13 // static | 14 // static |
| 14 void SubresourceFilterContentSettingsManagerFactory::EnsureForProfile( | 15 SubresourceFilterContentSettingsManager* |
| 16 SubresourceFilterContentSettingsManagerFactory::EnsureForProfile( |
| 15 Profile* profile) { | 17 Profile* profile) { |
| 16 GetInstance()->GetServiceForBrowserContext(profile, true /* create */); | 18 return static_cast<SubresourceFilterContentSettingsManager*>( |
| 19 GetInstance()->GetServiceForBrowserContext(profile, true /* create */)); |
| 17 } | 20 } |
| 18 | 21 |
| 19 // static | 22 // static |
| 20 SubresourceFilterContentSettingsManagerFactory* | 23 SubresourceFilterContentSettingsManagerFactory* |
| 21 SubresourceFilterContentSettingsManagerFactory::GetInstance() { | 24 SubresourceFilterContentSettingsManagerFactory::GetInstance() { |
| 22 return base::Singleton<SubresourceFilterContentSettingsManagerFactory>::get(); | 25 return base::Singleton<SubresourceFilterContentSettingsManagerFactory>::get(); |
| 23 } | 26 } |
| 24 | 27 |
| 25 SubresourceFilterContentSettingsManagerFactory:: | 28 SubresourceFilterContentSettingsManagerFactory:: |
| 26 SubresourceFilterContentSettingsManagerFactory() | 29 SubresourceFilterContentSettingsManagerFactory() |
| 27 : BrowserContextKeyedServiceFactory( | 30 : BrowserContextKeyedServiceFactory( |
| 28 "SubresourceFilterContentSettingsManager", | 31 "SubresourceFilterContentSettingsManager", |
| 29 BrowserContextDependencyManager::GetInstance()) {} | 32 BrowserContextDependencyManager::GetInstance()) {} |
| 30 | 33 |
| 31 KeyedService* | 34 KeyedService* |
| 32 SubresourceFilterContentSettingsManagerFactory::BuildServiceInstanceFor( | 35 SubresourceFilterContentSettingsManagerFactory::BuildServiceInstanceFor( |
| 33 content::BrowserContext* profile) const { | 36 content::BrowserContext* profile) const { |
| 34 return new SubresourceFilterContentSettingsManager( | 37 return new SubresourceFilterContentSettingsManager( |
| 35 static_cast<Profile*>(profile)); | 38 static_cast<Profile*>(profile)); |
| 36 } | 39 } |
| 40 |
| 41 content::BrowserContext* |
| 42 SubresourceFilterContentSettingsManagerFactory::GetBrowserContextToUse( |
| 43 content::BrowserContext* context) const { |
| 44 return context; |
| 45 } |
| OLD | NEW |