| 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_profile_context_f
actory.h" | 5 #include "chrome/browser/subresource_filter/subresource_filter_profile_context_f
actory.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_profile_context.h
" | 9 #include "chrome/browser/subresource_filter/subresource_filter_profile_context.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 | 12 |
| 13 // static | 13 // static |
| 14 void SubresourceFilterProfileContextFactory::EnsureForProfile( | 14 SubresourceFilterProfileContext* |
| 15 Profile* profile) { | 15 SubresourceFilterProfileContextFactory::GetForProfile(Profile* profile) { |
| 16 GetInstance()->GetServiceForBrowserContext(profile, true /* create */); | 16 return static_cast<SubresourceFilterProfileContext*>( |
| 17 GetInstance()->GetServiceForBrowserContext(profile, true /* create */)); |
| 17 } | 18 } |
| 18 | 19 |
| 19 // static | 20 // static |
| 20 SubresourceFilterProfileContextFactory* | 21 SubresourceFilterProfileContextFactory* |
| 21 SubresourceFilterProfileContextFactory::GetInstance() { | 22 SubresourceFilterProfileContextFactory::GetInstance() { |
| 22 return base::Singleton<SubresourceFilterProfileContextFactory>::get(); | 23 return base::Singleton<SubresourceFilterProfileContextFactory>::get(); |
| 23 } | 24 } |
| 24 | 25 |
| 25 SubresourceFilterProfileContextFactory::SubresourceFilterProfileContextFactory() | 26 SubresourceFilterProfileContextFactory::SubresourceFilterProfileContextFactory() |
| 26 : BrowserContextKeyedServiceFactory( | 27 : BrowserContextKeyedServiceFactory( |
| 27 "SubresourceFilterProfileContext", | 28 "SubresourceFilterProfileContext", |
| 28 BrowserContextDependencyManager::GetInstance()) {} | 29 BrowserContextDependencyManager::GetInstance()) {} |
| 29 | 30 |
| 30 KeyedService* SubresourceFilterProfileContextFactory::BuildServiceInstanceFor( | 31 KeyedService* SubresourceFilterProfileContextFactory::BuildServiceInstanceFor( |
| 31 content::BrowserContext* profile) const { | 32 content::BrowserContext* profile) const { |
| 32 return new SubresourceFilterProfileContext(static_cast<Profile*>(profile)); | 33 return new SubresourceFilterProfileContext(static_cast<Profile*>(profile)); |
| 33 } | 34 } |
| 35 |
| 36 content::BrowserContext* |
| 37 SubresourceFilterProfileContextFactory::GetBrowserContextToUse( |
| 38 content::BrowserContext* context) const { |
| 39 return context; |
| 40 } |
| OLD | NEW |