Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / net / proxy / in_process_mojo_proxy_resolver_factory.cc
blob3e58b011bc161040bf8c87e12ee0892f7dab7bf8
1 // Copyright 2015 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.
5 #include "net/proxy/in_process_mojo_proxy_resolver_factory.h"
7 #include "base/memory/singleton.h"
8 #include "net/proxy/mojo_proxy_resolver_factory_impl.h"
10 namespace net {
12 // static
13 InProcessMojoProxyResolverFactory*
14 InProcessMojoProxyResolverFactory::GetInstance() {
15 return base::Singleton<InProcessMojoProxyResolverFactory>::get();
18 InProcessMojoProxyResolverFactory::InProcessMojoProxyResolverFactory() {
19 // Implementation lifetime is strongly bound to the life of the connection via
20 // |factory_|. When |factory_| is destroyed, the Mojo connection is terminated
21 // which causes this object to be destroyed.
22 new MojoProxyResolverFactoryImpl(mojo::GetProxy(&factory_));
25 InProcessMojoProxyResolverFactory::~InProcessMojoProxyResolverFactory() =
26 default;
28 scoped_ptr<base::ScopedClosureRunner>
29 InProcessMojoProxyResolverFactory::CreateResolver(
30 const mojo::String& pac_script,
31 mojo::InterfaceRequest<interfaces::ProxyResolver> req,
32 interfaces::ProxyResolverFactoryRequestClientPtr client) {
33 factory_->CreateResolver(pac_script, req.Pass(), client.Pass());
34 return nullptr;
37 } // namespace net