Chromium Code Reviews| Index: chrome/browser/net/profile_network_context_service_factory.cc |
| diff --git a/chrome/browser/net/profile_network_context_service_factory.cc b/chrome/browser/net/profile_network_context_service_factory.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..3ab33703e4c6479f40c3aa829e74a13b88f4f81f |
| --- /dev/null |
| +++ b/chrome/browser/net/profile_network_context_service_factory.cc |
| @@ -0,0 +1,40 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/net/profile_network_context_service_factory.h" |
| + |
| +#include "chrome/browser/net/profile_network_context_service.h" |
| +#include "chrome/browser/profiles/profile.h" |
| +#include "components/keyed_service/content/browser_context_dependency_manager.h" |
| + |
| +ProfileNetworkContextService* |
| +ProfileNetworkContextServiceFactory::GetForContext( |
| + content::BrowserContext* browser_context) { |
| + return static_cast<ProfileNetworkContextService*>( |
| + GetInstance()->GetServiceForBrowserContext(browser_context, true)); |
| +} |
| + |
| +ProfileNetworkContextServiceFactory* |
| +ProfileNetworkContextServiceFactory::GetInstance() { |
| + return base::Singleton<ProfileNetworkContextServiceFactory>::get(); |
| +} |
| + |
| +ProfileNetworkContextServiceFactory::ProfileNetworkContextServiceFactory() |
| + : BrowserContextKeyedServiceFactory( |
| + "ProfileNetworkContextService", |
| + BrowserContextDependencyManager::GetInstance()) {} |
| + |
| +ProfileNetworkContextServiceFactory::~ProfileNetworkContextServiceFactory() {} |
| + |
| +KeyedService* ProfileNetworkContextServiceFactory::BuildServiceInstanceFor( |
| + content::BrowserContext* profile) const { |
| + return new ProfileNetworkContextService(Profile::FromBrowserContext(profile)); |
| +} |
| + |
| +content::BrowserContext* |
| +ProfileNetworkContextServiceFactory::GetBrowserContextToUse( |
| + content::BrowserContext* context) const { |
| + // Create separate service for incognito profiles. |
|
Randy Smith (Not in Mondays)
2017/07/19 19:31:10
Is this a TODO?
mmenke
2017/07/19 20:35:38
No, that's what this line of code does. The defau
|
| + return context; |
| +} |