Files
electron/atom/browser/net/network_context_service_factory.cc
Robo 6c20c6e668 refactor: Enable network service (Part 1) (#17431)
* Convert InspectableWebContentsImpl::LoadNetworkResource to SimpleURLLoader

https://bugs.chromium.org/p/chromium/issues/detail?id=721408

* Plumb creation of network context with the service
2019-03-26 10:10:48 +09:00

35 lines
1.2 KiB
C++

// Copyright (c) 2019 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "atom/browser/net/network_context_service_factory.h"
#include "atom/browser/net/network_context_service.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
namespace atom {
NetworkContextService* NetworkContextServiceFactory::GetForContext(
content::BrowserContext* browser_context) {
return static_cast<NetworkContextService*>(
GetInstance()->GetServiceForBrowserContext(browser_context, true));
}
NetworkContextServiceFactory* NetworkContextServiceFactory::GetInstance() {
return base::Singleton<NetworkContextServiceFactory>::get();
}
NetworkContextServiceFactory::NetworkContextServiceFactory()
: BrowserContextKeyedServiceFactory(
"ElectronNetworkContextService",
BrowserContextDependencyManager::GetInstance()) {}
NetworkContextServiceFactory::~NetworkContextServiceFactory() {}
KeyedService* NetworkContextServiceFactory::BuildServiceInstanceFor(
content::BrowserContext* context) const {
return new NetworkContextService(static_cast<AtomBrowserContext*>(context));
}
} // namespace atom