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.
4 
5 #ifndef SERVICES_PROXY_RESOLVER_PROXY_RESOLVER_IMPL_H_
6 #define SERVICES_PROXY_RESOLVER_PROXY_RESOLVER_IMPL_H_
7 
8 #include <map>
9 #include <memory>
10 
11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h"
13 #include "net/proxy_resolution/proxy_resolver.h"
14 #include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h"
15 
16 namespace proxy_resolver {
17 
18 class ProxyResolverV8Tracing;
19 
20 class ProxyResolverImpl : public mojom::ProxyResolver {
21  public:
22   explicit ProxyResolverImpl(std::unique_ptr<ProxyResolverV8Tracing> resolver);
23 
24   ~ProxyResolverImpl() override;
25 
26  private:
27   class Job;
28 
29   // mojom::ProxyResolver overrides.
30   void GetProxyForUrl(
31       const GURL& url,
32       const net::NetworkIsolationKey& network_isolation_key,
33       mojo::PendingRemote<mojom::ProxyResolverRequestClient> client) override;
34 
35   void DeleteJob(Job* job);
36 
37   std::unique_ptr<ProxyResolverV8Tracing> resolver_;
38   std::map<Job*, std::unique_ptr<Job>> resolve_jobs_;
39 
40   DISALLOW_COPY_AND_ASSIGN(ProxyResolverImpl);
41 };
42 
43 }  // namespace proxy_resolver
44 
45 #endif  // SERVICES_PROXY_RESOLVER_PROXY_RESOLVER_IMPL_H_
46