summaryrefslogtreecommitdiffstats
path: root/net/proxy/mojo_proxy_resolver_factory_impl.h
blob: 4c8252e3bbf446459dbe5cfd9e022a54e26643f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright 2015 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.

#ifndef NET_PROXY_MOJO_PROXY_RESOLVER_FACTORY_IMPL_H_
#define NET_PROXY_MOJO_PROXY_RESOLVER_FACTORY_IMPL_H_

#include <set>

#include "base/callback.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
#include "net/interfaces/proxy_resolver_service.mojom.h"

namespace net {
class HostResolver;
class ProxyResolverErrorObserver;
class ProxyResolverV8TracingFactory;

class MojoProxyResolverFactoryImpl : public interfaces::ProxyResolverFactory {
 public:
  explicit MojoProxyResolverFactoryImpl(
      mojo::InterfaceRequest<interfaces::ProxyResolverFactory> request);
  MojoProxyResolverFactoryImpl(
      scoped_ptr<ProxyResolverV8TracingFactory> proxy_resolver_factory,
      mojo::InterfaceRequest<interfaces::ProxyResolverFactory> request);

  ~MojoProxyResolverFactoryImpl() override;

 private:
  class Job;

  // interfaces::ProxyResolverFactory override.
  void CreateResolver(
      const mojo::String& pac_script,
      mojo::InterfaceRequest<interfaces::ProxyResolver> request,
      interfaces::ProxyResolverFactoryRequestClientPtr client) override;

  void RemoveJob(Job* job);

  const scoped_ptr<ProxyResolverV8TracingFactory> proxy_resolver_impl_factory_;
  mojo::StrongBinding<interfaces::ProxyResolverFactory> binding_;

  std::set<Job*> jobs_;

  DISALLOW_COPY_AND_ASSIGN(MojoProxyResolverFactoryImpl);
};

}  // namespace net

#endif  // NET_PROXY_MOJO_PROXY_RESOLVER_FACTORY_IMPL_H_