OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/net/profile_network_context_service_factory.h" |
| 6 |
| 7 #include "chrome/browser/net/profile_network_context_service.h" |
| 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 10 |
| 11 ProfileNetworkContextService* |
| 12 ProfileNetworkContextServiceFactory::GetForContext( |
| 13 content::BrowserContext* browser_context) { |
| 14 return static_cast<ProfileNetworkContextService*>( |
| 15 GetInstance()->GetServiceForBrowserContext(browser_context, true)); |
| 16 } |
| 17 |
| 18 ProfileNetworkContextServiceFactory* |
| 19 ProfileNetworkContextServiceFactory::GetInstance() { |
| 20 return base::Singleton<ProfileNetworkContextServiceFactory>::get(); |
| 21 } |
| 22 |
| 23 ProfileNetworkContextServiceFactory::ProfileNetworkContextServiceFactory() |
| 24 : BrowserContextKeyedServiceFactory( |
| 25 "ProfileNetworkContextService", |
| 26 BrowserContextDependencyManager::GetInstance()) {} |
| 27 |
| 28 ProfileNetworkContextServiceFactory::~ProfileNetworkContextServiceFactory() {} |
| 29 |
| 30 KeyedService* ProfileNetworkContextServiceFactory::BuildServiceInstanceFor( |
| 31 content::BrowserContext* profile) const { |
| 32 return new ProfileNetworkContextService(Profile::FromBrowserContext(profile)); |
| 33 } |
| 34 |
| 35 content::BrowserContext* |
| 36 ProfileNetworkContextServiceFactory::GetBrowserContextToUse( |
| 37 content::BrowserContext* context) const { |
| 38 // Create separate service for incognito profiles. |
| 39 return context; |
| 40 } |
OLD | NEW |