Port Chromium's blink_tests target to GN.
[chromium-blink-merge.git] / net / proxy / mojo_proxy_resolver_factory_impl.h
blob29bc6536a57f71bf658a816aef38e4d172d0a126
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 #ifndef NET_PROXY_MOJO_PROXY_RESOLVER_FACTORY_IMPL_H_
6 #define NET_PROXY_MOJO_PROXY_RESOLVER_FACTORY_IMPL_H_
8 #include <set>
10 #include "base/callback.h"
11 #include "net/interfaces/proxy_resolver_service.mojom.h"
12 #include "net/proxy/proxy_resolver.h"
13 #include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
15 namespace net {
16 class HostResolver;
17 class ProxyResolverFactory;
19 class MojoProxyResolverFactoryImpl : public interfaces::ProxyResolverFactory {
20 public:
21 using Factory = base::Callback<scoped_ptr<net::ProxyResolverFactory>(
22 HostResolver*,
23 const ProxyResolver::LoadStateChangedCallback&)>;
25 explicit MojoProxyResolverFactoryImpl(
26 mojo::InterfaceRequest<interfaces::ProxyResolverFactory> request);
27 MojoProxyResolverFactoryImpl(
28 const Factory& proxy_resolver_factory,
29 mojo::InterfaceRequest<interfaces::ProxyResolverFactory> request);
31 ~MojoProxyResolverFactoryImpl() override;
33 private:
34 class Job;
36 // interfaces::ProxyResolverFactory override.
37 void CreateResolver(
38 const mojo::String& pac_script,
39 mojo::InterfaceRequest<interfaces::ProxyResolver> request,
40 interfaces::HostResolverPtr host_resolver,
41 interfaces::ProxyResolverFactoryRequestClientPtr client) override;
43 void RemoveJob(Job* job);
45 const Factory proxy_resolver_impl_factory_;
46 mojo::StrongBinding<interfaces::ProxyResolverFactory> binding_;
48 std::set<Job*> jobs_;
50 DISALLOW_COPY_AND_ASSIGN(MojoProxyResolverFactoryImpl);
53 } // namespace net
55 #endif // NET_PROXY_MOJO_PROXY_RESOLVER_FACTORY_IMPL_H_